1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_SERVER_H
|
---|
8 | #define CR_SERVER_H
|
---|
9 |
|
---|
10 | #include "cr_protocol.h"
|
---|
11 | #include "cr_glstate.h"
|
---|
12 | #include "spu_dispatch_table.h"
|
---|
13 |
|
---|
14 | #include "state/cr_currentpointers.h"
|
---|
15 |
|
---|
16 | #include "cr_server.h"
|
---|
17 |
|
---|
18 | #ifdef VBOX_WITH_CRHGSMI
|
---|
19 | # include <VBox/VBoxVideo.h>
|
---|
20 |
|
---|
21 | extern uint8_t* g_pvVRamBase;
|
---|
22 | extern uint32_t g_cbVRam;
|
---|
23 | extern HCRHGSMICMDCOMPLETION g_hCrHgsmiCompletion;
|
---|
24 | extern PFNCRHGSMICMDCOMPLETION g_pfnCrHgsmiCompletion;
|
---|
25 |
|
---|
26 | #define VBOXCRHGSMI_PTR(_off, _t) ((_t*)(g_pvVRamBase + (_off)))
|
---|
27 | #define VBOXCRHGSMI_PTR_SAFE(_off, _cb, _t) ((_t*)crServerCrHgsmiPtrGet(_off, _cb))
|
---|
28 |
|
---|
29 | DECLINLINE(void*) crServerCrHgsmiPtrGet(VBOXVIDEOOFFSET offBuffer, uint32_t cbBuffer)
|
---|
30 | {
|
---|
31 | return ((offBuffer) + (cbBuffer) <= g_cbVRam ? VBOXCRHGSMI_PTR(offBuffer, void) : NULL);
|
---|
32 | }
|
---|
33 |
|
---|
34 | DECLINLINE(void) crServerCrHgsmiCmdComplete(struct VBOXVDMACMD_CHROMIUM_CMD *pCmd, int cmdProcessingRc)
|
---|
35 | {
|
---|
36 | g_pfnCrHgsmiCompletion(g_hCrHgsmiCompletion, pCmd, cmdProcessingRc);
|
---|
37 | }
|
---|
38 |
|
---|
39 | #define VBOXCRHGSMI_CMD_COMPLETE(_pData, _rc) do { \
|
---|
40 | CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData); \
|
---|
41 | CRVBOXHGSMI_CMDDATA_RC(_pData, _rc); \
|
---|
42 | crServerCrHgsmiCmdComplete((_pData)->pCmd, VINF_SUCCESS); \
|
---|
43 | } while (0)
|
---|
44 |
|
---|
45 | #define VBOXCRHGSMI_CMD_CHECK_COMPLETE(_pData, _rc) do { \
|
---|
46 | if (CRVBOXHGSMI_CMDDATA_IS_SET(_pData)) { \
|
---|
47 | VBOXCRHGSMI_CMD_COMPLETE(_pData, _rc); \
|
---|
48 | } \
|
---|
49 | } while (0)
|
---|
50 |
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * This is the base number for window and context IDs
|
---|
55 | */
|
---|
56 | #define MAGIC_OFFSET 5000
|
---|
57 |
|
---|
58 | extern CRServer cr_server;
|
---|
59 |
|
---|
60 | /* Semaphore wait queue node */
|
---|
61 | typedef struct _wqnode {
|
---|
62 | RunQueue *q;
|
---|
63 | struct _wqnode *next;
|
---|
64 | } wqnode;
|
---|
65 |
|
---|
66 | typedef struct {
|
---|
67 | GLuint count;
|
---|
68 | GLuint num_waiting;
|
---|
69 | RunQueue **waiting;
|
---|
70 | } CRServerBarrier;
|
---|
71 |
|
---|
72 | typedef struct {
|
---|
73 | GLuint count;
|
---|
74 | wqnode *waiting, *tail;
|
---|
75 | } CRServerSemaphore;
|
---|
76 |
|
---|
77 | typedef struct {
|
---|
78 | GLuint id;
|
---|
79 | GLint projParamStart;
|
---|
80 | GLfloat projMat[16]; /* projection matrix, accumulated via calls to */
|
---|
81 | /* glProgramLocalParameterARB, glProgramParameterNV */
|
---|
82 | } CRServerProgram;
|
---|
83 |
|
---|
84 | void crServerSetVBoxConfiguration();
|
---|
85 | void crServerSetVBoxConfigurationHGCM();
|
---|
86 | void crServerInitDispatch(void);
|
---|
87 | void crServerReturnValue( const void *payload, unsigned int payload_len );
|
---|
88 | void crServerWriteback(void);
|
---|
89 | int crServerRecv( CRConnection *conn, CRMessage *msg, unsigned int len );
|
---|
90 | void crServerSerializeRemoteStreams(void);
|
---|
91 | void crServerAddToRunQueue( CRClient *client );
|
---|
92 | void crServerDeleteClient( CRClient *client );
|
---|
93 |
|
---|
94 |
|
---|
95 | void crServerApplyBaseProjection( const CRmatrix *baseProj );
|
---|
96 | void crServerApplyViewMatrix( const CRmatrix *view );
|
---|
97 | void crServerSetOutputBounds( const CRMuralInfo *mural, int extNum );
|
---|
98 | void crServerComputeViewportBounds( const CRViewportState *v, CRMuralInfo *mural );
|
---|
99 |
|
---|
100 | GLboolean crServerInitializeBucketing(CRMuralInfo *mural);
|
---|
101 |
|
---|
102 | void crComputeOverlapGeom(double *quads, int nquad, CRPoly ***res);
|
---|
103 | void crComputeKnockoutGeom(double *quads, int nquad, int my_quad_idx, CRPoly **res);
|
---|
104 |
|
---|
105 | int crServerGetCurrentEye(void);
|
---|
106 |
|
---|
107 | GLboolean crServerClientInBeginEnd(const CRClient *client);
|
---|
108 |
|
---|
109 | GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID);
|
---|
110 | GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID);
|
---|
111 |
|
---|
112 | void crServerCreateInfoDeleteCB(void *data);
|
---|
113 |
|
---|
114 | GLint crServerGenerateID(GLint *pCounter);
|
---|
115 |
|
---|
116 | GLint crServerSPUWindowID(GLint serverWindow);
|
---|
117 |
|
---|
118 | GLuint crServerTranslateProgramID(GLuint id);
|
---|
119 |
|
---|
120 | void crServerSetupOutputRedirect(CRMuralInfo *mural);
|
---|
121 | void crServerCheckMuralGeometry(CRMuralInfo *mural);
|
---|
122 | GLboolean crServerSupportRedirMuralFBO(void);
|
---|
123 | void crServerRedirMuralFBO(CRMuralInfo *mural, GLboolean redir);
|
---|
124 | void crServerCreateMuralFBO(CRMuralInfo *mural);
|
---|
125 | void crServerDeleteMuralFBO(CRMuralInfo *mural);
|
---|
126 | void crServerPresentFBO(CRMuralInfo *mural);
|
---|
127 | GLboolean crServerIsRedirectedToFBO();
|
---|
128 |
|
---|
129 | int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer);
|
---|
130 |
|
---|
131 | #endif /* CR_SERVER_H */
|
---|