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 | #include <cr_htable.h>
|
---|
18 | #include <cr_compositor.h>
|
---|
19 |
|
---|
20 | #ifdef VBOX_WITH_CRHGSMI
|
---|
21 | # include <VBox/VBoxVideo.h>
|
---|
22 |
|
---|
23 | #include <iprt/cdefs.h>
|
---|
24 |
|
---|
25 | RT_C_DECLS_BEGIN
|
---|
26 |
|
---|
27 | extern uint8_t* g_pvVRamBase;
|
---|
28 | extern uint32_t g_cbVRam;
|
---|
29 | extern HCRHGSMICMDCOMPLETION g_hCrHgsmiCompletion;
|
---|
30 | extern PFNCRHGSMICMDCOMPLETION g_pfnCrHgsmiCompletion;
|
---|
31 |
|
---|
32 | #define VBOXCRHGSMI_PTR(_off, _t) ((_t*)(g_pvVRamBase + (_off)))
|
---|
33 | #define VBOXCRHGSMI_PTR_SAFE(_off, _cb, _t) ((_t*)crServerCrHgsmiPtrGet(_off, _cb))
|
---|
34 |
|
---|
35 | DECLINLINE(void*) crServerCrHgsmiPtrGet(VBOXVIDEOOFFSET offBuffer, uint32_t cbBuffer)
|
---|
36 | {
|
---|
37 | return ((offBuffer) + (cbBuffer) <= g_cbVRam ? VBOXCRHGSMI_PTR(offBuffer, void) : NULL);
|
---|
38 | }
|
---|
39 |
|
---|
40 | DECLINLINE(void) crServerCrHgsmiCmdComplete(struct VBOXVDMACMD_CHROMIUM_CMD *pCmd, int cmdProcessingRc)
|
---|
41 | {
|
---|
42 | g_pfnCrHgsmiCompletion(g_hCrHgsmiCompletion, pCmd, cmdProcessingRc);
|
---|
43 | }
|
---|
44 |
|
---|
45 | #define VBOXCRHGSMI_CMD_COMPLETE(_pData, _rc) do { \
|
---|
46 | Assert(CRVBOXHGSMI_CMDDATA_IS_HGSMICMD(_pData)); \
|
---|
47 | CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData); \
|
---|
48 | CRVBOXHGSMI_CMDDATA_RC(_pData, _rc); \
|
---|
49 | crServerCrHgsmiCmdComplete((_pData)->pHgsmiCmd, VINF_SUCCESS); \
|
---|
50 | } while (0)
|
---|
51 |
|
---|
52 | #define VBOXCRHGSMI_CMD_CHECK_COMPLETE(_pData, _rc) do { \
|
---|
53 | if (CRVBOXHGSMI_CMDDATA_IS_SET(_pData)) { \
|
---|
54 | VBOXCRHGSMI_CMD_COMPLETE(_pData, _rc); \
|
---|
55 | } \
|
---|
56 | } while (0)
|
---|
57 |
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * This is the base number for window and context IDs
|
---|
62 | */
|
---|
63 | #define MAGIC_OFFSET 5000
|
---|
64 |
|
---|
65 | extern CRServer cr_server;
|
---|
66 |
|
---|
67 | /* Semaphore wait queue node */
|
---|
68 | typedef struct _wqnode {
|
---|
69 | RunQueue *q;
|
---|
70 | struct _wqnode *next;
|
---|
71 | } wqnode;
|
---|
72 |
|
---|
73 | typedef struct {
|
---|
74 | GLuint count;
|
---|
75 | GLuint num_waiting;
|
---|
76 | RunQueue **waiting;
|
---|
77 | } CRServerBarrier;
|
---|
78 |
|
---|
79 | typedef struct {
|
---|
80 | GLuint count;
|
---|
81 | wqnode *waiting, *tail;
|
---|
82 | } CRServerSemaphore;
|
---|
83 |
|
---|
84 | typedef struct {
|
---|
85 | GLuint id;
|
---|
86 | GLint projParamStart;
|
---|
87 | GLfloat projMat[16]; /* projection matrix, accumulated via calls to */
|
---|
88 | /* glProgramLocalParameterARB, glProgramParameterNV */
|
---|
89 | } CRServerProgram;
|
---|
90 |
|
---|
91 | void crServerSetVBoxConfiguration();
|
---|
92 | void crServerSetVBoxConfigurationHGCM();
|
---|
93 | void crServerInitDispatch(void);
|
---|
94 | void crServerReturnValue( const void *payload, unsigned int payload_len );
|
---|
95 | void crServerWriteback(void);
|
---|
96 | int crServerRecv( CRConnection *conn, CRMessage *msg, unsigned int len );
|
---|
97 | void crServerSerializeRemoteStreams(void);
|
---|
98 | void crServerAddToRunQueue( CRClient *client );
|
---|
99 | void crServerDeleteClient( CRClient *client );
|
---|
100 |
|
---|
101 |
|
---|
102 | void crServerApplyBaseProjection( const CRmatrix *baseProj );
|
---|
103 | void crServerApplyViewMatrix( const CRmatrix *view );
|
---|
104 | void crServerSetOutputBounds( const CRMuralInfo *mural, int extNum );
|
---|
105 | void crServerComputeViewportBounds( const CRViewportState *v, CRMuralInfo *mural );
|
---|
106 |
|
---|
107 | GLboolean crServerInitializeBucketing(CRMuralInfo *mural);
|
---|
108 |
|
---|
109 | void crComputeOverlapGeom(double *quads, int nquad, CRPoly ***res);
|
---|
110 | void crComputeKnockoutGeom(double *quads, int nquad, int my_quad_idx, CRPoly **res);
|
---|
111 |
|
---|
112 | int crServerGetCurrentEye(void);
|
---|
113 |
|
---|
114 | GLboolean crServerClientInBeginEnd(const CRClient *client);
|
---|
115 |
|
---|
116 | GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID);
|
---|
117 | GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID);
|
---|
118 | GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID);
|
---|
119 | void crServerMuralTerm(CRMuralInfo *mural);
|
---|
120 | GLboolean crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height);
|
---|
121 | void crServerMuralPosition(CRMuralInfo *mural, GLint x, GLint y);
|
---|
122 | void crServerMuralVisibleRegion( CRMuralInfo *mural, GLint cRects, const GLint *pRects );
|
---|
123 | void crServerMuralShow( CRMuralInfo *mural, GLint state );
|
---|
124 |
|
---|
125 | GLint crServerGenerateID(GLint *pCounter);
|
---|
126 |
|
---|
127 | GLint crServerSPUWindowID(GLint serverWindow);
|
---|
128 |
|
---|
129 | GLuint crServerTranslateProgramID(GLuint id);
|
---|
130 |
|
---|
131 | CRMuralInfo * crServerGetDummyMural(GLint visualBits);
|
---|
132 |
|
---|
133 | void crServerCheckMuralGeometry(CRMuralInfo *mural);
|
---|
134 | void crServerCheckAllMuralGeometry(CRMuralInfo *pMI);
|
---|
135 | GLboolean crServerSupportRedirMuralFBO(void);
|
---|
136 |
|
---|
137 | void crVBoxServerMuralFbResizeBegin(HCR_FRAMEBUFFER hFb);
|
---|
138 | void crVBoxServerMuralFbResizeEnd(HCR_FRAMEBUFFER hFb);
|
---|
139 |
|
---|
140 | void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void*pvData);
|
---|
141 | void crVBoxServerCheckVisibilityEvent(int32_t idScreen);
|
---|
142 |
|
---|
143 | void crServerRedirMuralFbClear(CRMuralInfo *mural);
|
---|
144 |
|
---|
145 | void crServerWindowReparent(CRMuralInfo *pMural);
|
---|
146 |
|
---|
147 | void crServerRedirMuralFBO(CRMuralInfo *mural, bool fEnabled);
|
---|
148 | void crServerDeleteMuralFBO(CRMuralInfo *mural);
|
---|
149 | void crServerPresentFBO(CRMuralInfo *mural);
|
---|
150 | GLboolean crServerIsRedirectedToFBO();
|
---|
151 | GLint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer);
|
---|
152 | void crServerMuralFBOSwapBuffers(CRMuralInfo *mural);
|
---|
153 |
|
---|
154 | HCR_FRAMEBUFFER CrPMgrFbGetFirstEnabled();
|
---|
155 | HCR_FRAMEBUFFER CrPMgrFbGetNextEnabled(HCR_FRAMEBUFFER hFb);
|
---|
156 | HCR_FRAMEBUFFER CrPMgrFbGetFirstInitialized();
|
---|
157 | HCR_FRAMEBUFFER CrPMgrFbGetNextInitialized(HCR_FRAMEBUFFER hFb);
|
---|
158 |
|
---|
159 |
|
---|
160 | #define CR_SERVER_FBO_BB_IDX(_mural) ((_mural)->iBbBuffer)
|
---|
161 | #define CR_SERVER_FBO_FB_IDX(_mural) (((_mural)->iBbBuffer + 1) % ((_mural)->cBuffers))
|
---|
162 | /* returns a valid index to be used for negative _idx, i.e. for GL_NONE cases */
|
---|
163 | //#define CR_SERVER_FBO_ADJUST_IDX(_mural, _idx) ((_idx) >= 0 ? (_idx) : CR_SERVER_FBO_BB_IDX(_mural))
|
---|
164 | /* just a helper that uses CR_SERVER_FBO_ADJUST_IDX for getting mural's FBO id for buffer index*/
|
---|
165 | //#define CR_SERVER_FBO_FOR_IDX(_mural, _idx) ((_mural)->aidFBOs[CR_SERVER_FBO_ADJUST_IDX((_mural), (_idx))])
|
---|
166 | //#define CR_SERVER_FBO_TEX_FOR_IDX(_mural, _idx) ((_mural)->aidColorTexs[CR_SERVER_FBO_ADJUST_IDX((_mural), (_idx))])
|
---|
167 | #define CR_SERVER_FBO_FOR_IDX(_mural, _idx) ((_idx) >= 0 ? (_mural)->aidFBOs[(_idx)] : 0)
|
---|
168 | #define CR_SERVER_FBO_TEX_FOR_IDX(_mural, _idx) ((_idx) >= 0 ? (_mural)->aidColorTexs[(_idx)] : 0)
|
---|
169 |
|
---|
170 | int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer);
|
---|
171 |
|
---|
172 | void crServerPerformMakeCurrent( CRMuralInfo *mural, CRContextInfo *ctxInfo );
|
---|
173 |
|
---|
174 | PCR_BLITTER crServerVBoxBlitterGet();
|
---|
175 | PCR_BLITTER crServerVBoxBlitterGetInitialized();
|
---|
176 |
|
---|
177 | DECLINLINE(void) crServerVBoxBlitterWinInit(CR_BLITTER_WINDOW *win, CRMuralInfo *mural)
|
---|
178 | {
|
---|
179 | win->Base.id = mural->spuWindow;
|
---|
180 | win->Base.visualBits = mural->CreateInfo.visualBits;
|
---|
181 | win->width = mural->width;
|
---|
182 | win->height = mural->height;
|
---|
183 | }
|
---|
184 |
|
---|
185 | DECLINLINE(void) crServerVBoxBlitterCtxInit(CR_BLITTER_CONTEXT *ctx, CRContextInfo *ctxInfo)
|
---|
186 | {
|
---|
187 | ctx->Base.id = ctxInfo->SpuContext;
|
---|
188 | if (ctx->Base.id < 0)
|
---|
189 | ctx->Base.id = cr_server.MainContextInfo.SpuContext;
|
---|
190 | ctx->Base.visualBits = cr_server.curClient->currentCtxInfo->CreateInfo.visualBits;
|
---|
191 | }
|
---|
192 |
|
---|
193 | /* display worker thread.
|
---|
194 | * see comments for CR_SERVER_RPW struct definition in cr_server.h */
|
---|
195 | DECLINLINE(void) crServerXchgI8(int8_t *pu8Val1, int8_t *pu8Val2)
|
---|
196 | {
|
---|
197 | int8_t tmp;
|
---|
198 | tmp = *pu8Val1;
|
---|
199 | *pu8Val1 = *pu8Val2;
|
---|
200 | *pu8Val2 = tmp;
|
---|
201 | }
|
---|
202 |
|
---|
203 | #ifdef DEBUG
|
---|
204 | # define CR_GLERR_CHECK(_op) do { \
|
---|
205 | GLenum status; \
|
---|
206 | while ((status = cr_server.head_spu->dispatch_table.GetError()) != GL_NO_ERROR) {/*Assert(0);*/} \
|
---|
207 | _op \
|
---|
208 | while ((status = cr_server.head_spu->dispatch_table.GetError()) != GL_NO_ERROR) {Assert(0);} \
|
---|
209 | } while (0)
|
---|
210 | #else
|
---|
211 | # define CR_GLERR_CHECK(_op) do { \
|
---|
212 | _op \
|
---|
213 | } while (0)
|
---|
214 | #endif
|
---|
215 |
|
---|
216 | #ifdef DEBUG_misha
|
---|
217 | # define CR_SERVER_RPW_DEBUG
|
---|
218 | #endif
|
---|
219 | /* *
|
---|
220 | * _name : Draw, Submitted, Worker, Gpu
|
---|
221 | */
|
---|
222 |
|
---|
223 | #ifdef CR_SERVER_RPW_DEBUG
|
---|
224 | # define crServerRpwEntryDbgVerify(_pE) crServerRpwEntryDbgDoVerify(_pE)
|
---|
225 | #else
|
---|
226 | # define crServerRpwEntryDbgVerify(_pE) do {} while (0)
|
---|
227 | #endif
|
---|
228 |
|
---|
229 |
|
---|
230 | #define CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _name) ((_pEntry)->iTex##_name > 0)
|
---|
231 |
|
---|
232 | #define CR_SERVER_RPW_ENTRY_TEX_INVALIDATE(_pEntry, _name) do { \
|
---|
233 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
234 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _name)); \
|
---|
235 | (_pEntry)->iTex##_name = -(_pEntry)->iTex##_name; \
|
---|
236 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
237 | } while (0)
|
---|
238 |
|
---|
239 | #define CR_SERVER_RPW_ENTRY_TEX_PROMOTE(_pEntry, _fromName, _toName) do { \
|
---|
240 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
241 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _fromName)); \
|
---|
242 | Assert(!CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _toName)); \
|
---|
243 | crServerXchgI8(&(_pEntry)->iTex##_fromName, &(_pEntry)->iTex##_toName); \
|
---|
244 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
245 | } while (0)
|
---|
246 |
|
---|
247 | #define CR_SERVER_RPW_ENTRY_TEX_XCHG_VALID(_pEntry, _fromName, _toName) do { \
|
---|
248 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
249 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _fromName)); \
|
---|
250 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _toName)); \
|
---|
251 | crServerXchgI8(&(_pEntry)->iTex##_fromName, &(_pEntry)->iTex##_toName); \
|
---|
252 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _fromName)); \
|
---|
253 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _toName)); \
|
---|
254 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
255 | } while (0)
|
---|
256 |
|
---|
257 |
|
---|
258 | #define CR_SERVER_RPW_ENTRY_TEX_PROMOTE_KEEPVALID(_pEntry, _fromName, _toName) do { \
|
---|
259 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
260 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _fromName)); \
|
---|
261 | Assert(!CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _toName)); \
|
---|
262 | crServerXchgI8(&(_pEntry)->iTex##_fromName, &(_pEntry)->iTex##_toName); \
|
---|
263 | (_pEntry)->iTex##_fromName = -(_pEntry)->iTex##_fromName; \
|
---|
264 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _fromName)); \
|
---|
265 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(_pEntry, _toName)); \
|
---|
266 | crServerRpwEntryDbgVerify(_pEntry); \
|
---|
267 | } while (0)
|
---|
268 |
|
---|
269 | #define CR_SERVER_RPW_ENTRY_TEX(_pEntry, _name) ((_pEntry)->aidWorkerTexs[(_pEntry)->iTex##_name - 1])
|
---|
270 |
|
---|
271 | #define CR_SERVER_RPW_ENTRY_PBO_NEXT_ID(_i) (((_i) + 1) % 2)
|
---|
272 | #define CR_SERVER_RPW_ENTRY_PBO_IS_ACTIVE(_pEntry) ((_pEntry)->iCurPBO >= 0)
|
---|
273 | #define CR_SERVER_RPW_ENTRY_PBO_CUR(_pEntry) ((_pEntry)->aidPBOs[(_pEntry)->iCurPBO])
|
---|
274 | #define CR_SERVER_RPW_ENTRY_PBO_COMPLETED(_pEntry) ((_pEntry)->aidPBOs[CR_SERVER_RPW_ENTRY_PBO_NEXT_ID((_pEntry)->iCurPBO)])
|
---|
275 | #define CR_SERVER_RPW_ENTRY_PBO_FLIP(_pEntry) do { \
|
---|
276 | (_pEntry)->iCurPBO = CR_SERVER_RPW_ENTRY_PBO_NEXT_ID((_pEntry)->iCurPBO); \
|
---|
277 | } while (0)
|
---|
278 |
|
---|
279 | #ifdef CR_SERVER_RPW_DEBUG
|
---|
280 | DECLINLINE(void) crServerRpwEntryDbgDoVerify(CR_SERVER_RPW_ENTRY *pEntry)
|
---|
281 | {
|
---|
282 | int tstMask = 0;
|
---|
283 | int8_t iVal;
|
---|
284 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(pEntry, Draw));
|
---|
285 |
|
---|
286 | #define CR_VERVER_RPW_ENTRY_DBG_CHECKVAL(_v) do { \
|
---|
287 | iVal = RT_ABS(_v); \
|
---|
288 | Assert(iVal > 0); \
|
---|
289 | Assert(iVal < 5); \
|
---|
290 | Assert(!(tstMask & (1 << iVal))); \
|
---|
291 | tstMask |= (1 << iVal); \
|
---|
292 | } while (0)
|
---|
293 |
|
---|
294 | CR_VERVER_RPW_ENTRY_DBG_CHECKVAL(pEntry->iTexDraw);
|
---|
295 | CR_VERVER_RPW_ENTRY_DBG_CHECKVAL(pEntry->iTexSubmitted);
|
---|
296 | CR_VERVER_RPW_ENTRY_DBG_CHECKVAL(pEntry->iTexWorker);
|
---|
297 | CR_VERVER_RPW_ENTRY_DBG_CHECKVAL(pEntry->iTexGpu);
|
---|
298 | Assert(tstMask == 0x1E);
|
---|
299 | }
|
---|
300 | #endif
|
---|
301 |
|
---|
302 | DECLINLINE(bool) crServerRpwIsInitialized(const CR_SERVER_RPW *pWorker)
|
---|
303 | {
|
---|
304 | return !!pWorker->ctxId;
|
---|
305 | }
|
---|
306 | int crServerRpwInit(CR_SERVER_RPW *pWorker);
|
---|
307 | int crServerRpwTerm(CR_SERVER_RPW *pWorker);
|
---|
308 | DECLINLINE(bool) crServerRpwEntryIsInitialized(const CR_SERVER_RPW_ENTRY *pEntry)
|
---|
309 | {
|
---|
310 | return !!pEntry->pfnData;
|
---|
311 | }
|
---|
312 | int crServerRpwEntryInit(CR_SERVER_RPW *pWorker, CR_SERVER_RPW_ENTRY *pEntry, uint32_t width, uint32_t height, PFNCR_SERVER_RPW_DATA pfnData);
|
---|
313 | int crServerRpwEntryCleanup(CR_SERVER_RPW *pWorker, CR_SERVER_RPW_ENTRY *pEntry);
|
---|
314 | int crServerRpwEntryResize(CR_SERVER_RPW *pWorker, CR_SERVER_RPW_ENTRY *pEntry, uint32_t width, uint32_t height);
|
---|
315 | int crServerRpwEntrySubmit(CR_SERVER_RPW *pWorker, CR_SERVER_RPW_ENTRY *pEntry);
|
---|
316 | int crServerRpwEntryWaitComplete(CR_SERVER_RPW *pWorker, CR_SERVER_RPW_ENTRY *pEntry);
|
---|
317 | int crServerRpwEntryCancel(CR_SERVER_RPW *pWorker, CR_SERVER_RPW_ENTRY *pEntry);
|
---|
318 | DECLINLINE(void) crServerRpwEntryDrawSettingsToTex(const CR_SERVER_RPW_ENTRY *pEntry, VBOXVR_TEXTURE *pTex)
|
---|
319 | {
|
---|
320 | pTex->width = pEntry->Size.cx;
|
---|
321 | pTex->height = pEntry->Size.cy;
|
---|
322 | pTex->target = GL_TEXTURE_2D;
|
---|
323 | Assert(CR_SERVER_RPW_ENTRY_TEX_IS_VALID(pEntry, Draw));
|
---|
324 | pTex->hwid = CR_SERVER_RPW_ENTRY_TEX(pEntry, Draw);
|
---|
325 | }
|
---|
326 | /**/
|
---|
327 |
|
---|
328 | typedef struct CR_SERVER_CTX_SWITCH
|
---|
329 | {
|
---|
330 | GLuint idDrawFBO, idReadFBO;
|
---|
331 | CRContext *pNewCtx;
|
---|
332 | CRContext *pOldCtx;
|
---|
333 | } CR_SERVER_CTX_SWITCH;
|
---|
334 |
|
---|
335 | DECLINLINE(void) crServerCtxSwitchPrepare(CR_SERVER_CTX_SWITCH *pData, CRContext *pNewCtx)
|
---|
336 | {
|
---|
337 | CRMuralInfo *pCurrentMural = cr_server.currentMural;
|
---|
338 | CRContextInfo *pCurCtxInfo = cr_server.currentCtxInfo;
|
---|
339 | GLuint idDrawFBO, idReadFBO;
|
---|
340 | CRContext *pCurCtx = pCurCtxInfo ? pCurCtxInfo->pContext : NULL;
|
---|
341 |
|
---|
342 | CRASSERT(pCurCtx == crStateGetCurrent());
|
---|
343 |
|
---|
344 | if (pCurrentMural)
|
---|
345 | {
|
---|
346 | idDrawFBO = CR_SERVER_FBO_FOR_IDX(pCurrentMural, pCurrentMural->iCurDrawBuffer);
|
---|
347 | idReadFBO = CR_SERVER_FBO_FOR_IDX(pCurrentMural, pCurrentMural->iCurReadBuffer);
|
---|
348 | }
|
---|
349 | else
|
---|
350 | {
|
---|
351 | idDrawFBO = 0;
|
---|
352 | idReadFBO = 0;
|
---|
353 | }
|
---|
354 |
|
---|
355 | crStateSwitchPrepare(pNewCtx, pCurCtx, idDrawFBO, idReadFBO);
|
---|
356 |
|
---|
357 | pData->idDrawFBO = idDrawFBO;
|
---|
358 | pData->idReadFBO = idReadFBO;
|
---|
359 | pData->pNewCtx = pNewCtx;
|
---|
360 | pData->pOldCtx = pCurCtx;
|
---|
361 | }
|
---|
362 |
|
---|
363 | DECLINLINE(void) crServerCtxSwitchPostprocess(CR_SERVER_CTX_SWITCH *pData)
|
---|
364 | {
|
---|
365 | crStateSwitchPostprocess(pData->pOldCtx, pData->pNewCtx, pData->idDrawFBO, pData->idReadFBO);
|
---|
366 | }
|
---|
367 |
|
---|
368 | void crServerInitTmpCtxDispatch();
|
---|
369 |
|
---|
370 | int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal);
|
---|
371 |
|
---|
372 | typedef struct CR_FBMAP
|
---|
373 | {
|
---|
374 | uint8_t Map[(CR_MAX_GUEST_MONITORS+7)/8];
|
---|
375 | } CR_FBMAP;
|
---|
376 |
|
---|
377 | DECLINLINE(void) CrFBmInit(CR_FBMAP *pMap)
|
---|
378 | {
|
---|
379 | memset(pMap, 0, sizeof (*pMap));
|
---|
380 | }
|
---|
381 |
|
---|
382 | DECLINLINE(bool) CrFBmIsSet(CR_FBMAP *pMap, uint32_t i)
|
---|
383 | {
|
---|
384 | return ASMBitTest(&pMap->Map, i);
|
---|
385 | }
|
---|
386 |
|
---|
387 | DECLINLINE(void) CrFBmSet(CR_FBMAP *pMap, uint32_t i)
|
---|
388 | {
|
---|
389 | return ASMBitSet(&pMap->Map, i);
|
---|
390 | }
|
---|
391 |
|
---|
392 | DECLINLINE(void) CrFBmClear(CR_FBMAP *pMap, uint32_t i)
|
---|
393 | {
|
---|
394 | return ASMBitClear(&pMap->Map, i);
|
---|
395 | }
|
---|
396 |
|
---|
397 | /*helper function that calls CrFbUpdateBegin for all enabled framebuffers */
|
---|
398 | int CrPMgrHlpGlblUpdateBegin(CR_FBMAP *pMap);
|
---|
399 | /*helper function that calls CrFbUpdateEnd for all framebuffers being updated */
|
---|
400 | void CrPMgrHlpGlblUpdateEnd(CR_FBMAP *pMap);
|
---|
401 | HCR_FRAMEBUFFER CrPMgrFbGetFirstEnabled();
|
---|
402 | HCR_FRAMEBUFFER CrPMgrFbGetNextEnabled(HCR_FRAMEBUFFER hFb);
|
---|
403 | int CrPMgrModeVrdp(bool fEnable);
|
---|
404 | int CrPMgrModeRootVr(bool fEnable);
|
---|
405 | int CrPMgrRootVrUpdate();
|
---|
406 | int CrPMgrViewportUpdate(uint32_t idScreen);
|
---|
407 | int CrPMgrScreenChanged(uint32_t idScreen);
|
---|
408 | int CrPMgrNotifyResize(HCR_FRAMEBUFFER hFb);
|
---|
409 | int CrPMgrSaveState(PSSMHANDLE pSSM);
|
---|
410 | int CrPMgrLoadState(PSSMHANDLE pSSM, uint32_t version);
|
---|
411 | HCR_FRAMEBUFFER CrPMgrFbGet(uint32_t idScreen);
|
---|
412 | /*cleanup stuff*/
|
---|
413 |
|
---|
414 | int CrPMgrInit();
|
---|
415 | void CrPMgrTerm();
|
---|
416 |
|
---|
417 | int CrFbResize(HCR_FRAMEBUFFER hFb, const struct VBVAINFOSCREEN * pScreen, void *pvVRAM);
|
---|
418 | bool CrFbIsEnabled(HCR_FRAMEBUFFER hFb);
|
---|
419 | int CrFbEntryCreateForTexId(HCR_FRAMEBUFFER hFb, GLuint idTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry);
|
---|
420 | int CrFbEntryCreateForTexData(HCR_FRAMEBUFFER hFb, struct CR_TEXDATA *pTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry);
|
---|
421 | void CrFbEntryAddRef(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry);
|
---|
422 | void CrFbEntryRelease(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry);
|
---|
423 | const struct VBVAINFOSCREEN* CrFbGetScreenInfo(HCR_FRAMEBUFFER hFb);
|
---|
424 | const struct VBOXVR_SCR_COMPOSITOR* CrFbGetCompositor(HCR_FRAMEBUFFER hFb);
|
---|
425 | const struct VBOXVR_SCR_COMPOSITOR_ENTRY* CrFbEntryGetCompositorEntry(HCR_FRAMEBUFFER_ENTRY hEntry);
|
---|
426 |
|
---|
427 | /* start doing modifications to the framebuffer */
|
---|
428 | int CrFbUpdateBegin(HCR_FRAMEBUFFER hFb);
|
---|
429 | /*below commands can only be used in Framebuffer update mode, i.e. after the CrFbUpdateBegin succeeded */
|
---|
430 | int CrFbEntryRegions(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry);
|
---|
431 |
|
---|
432 | /* complete doing modifications to the framebuffer */
|
---|
433 | void CrFbUpdateEnd(HCR_FRAMEBUFFER hFb);
|
---|
434 |
|
---|
435 | int CrFbEntryRegionsAdd(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated);
|
---|
436 | int CrFbEntryRegionsSet(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated);
|
---|
437 |
|
---|
438 | int CrFbEntryTexDataUpdate(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY pEntry, struct CR_TEXDATA *pTex);
|
---|
439 |
|
---|
440 | CRHTABLE_HANDLE CrFbDDataAllocSlot(HCR_FRAMEBUFFER hFb);
|
---|
441 | void CrFbDDataReleaseSlot(HCR_FRAMEBUFFER hFb, CRHTABLE_HANDLE hSlot);
|
---|
442 | int CrFbDDataEntryPut(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot, void *pvData);
|
---|
443 | void* CrFbDDataEntryGet(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot);
|
---|
444 |
|
---|
445 | CR_TEXDATA* CrFbTexDataCreate(const VBOXVR_TEXTURE *pTex);
|
---|
446 | void CrFbTexDataInit(CR_TEXDATA* pFbTex, const VBOXVR_TEXTURE *pTex, PFNCRTEXDATA_RELEASED pfnTextureReleased);
|
---|
447 |
|
---|
448 | //#define VBOX_WITH_CRSERVER_DUMPER
|
---|
449 | #ifdef VBOX_WITH_CRSERVER_DUMPER
|
---|
450 | void crServerDumpCheckTerm();
|
---|
451 | int crServerDumpCheckInit();
|
---|
452 | void crServerDumpBuffer(int idx);
|
---|
453 | void crServerDumpTextures();
|
---|
454 | void crServerDumpTexture(const VBOXVR_TEXTURE *pTex);
|
---|
455 | void crServerDumpShader(GLint id);
|
---|
456 | void crServerDumpProgram(GLint id);
|
---|
457 | void crServerDumpCurrentProgram();
|
---|
458 | void crServerDumpRecompileDumpCurrentProgram();
|
---|
459 | void crServerRecompileCurrentProgram();
|
---|
460 | void crServerDumpCurrentProgramUniforms();
|
---|
461 | void crServerDumpCurrentProgramAttribs();
|
---|
462 | void crServerDumpFramesCheck();
|
---|
463 | void crServerDumpState();
|
---|
464 | void crServerDumpDrawel(const char*pszFormat, ...);
|
---|
465 | void crServerDumpDrawelv(GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal);
|
---|
466 |
|
---|
467 | extern int64_t g_CrDbgDumpPid;
|
---|
468 | extern unsigned long g_CrDbgDumpEnabled;
|
---|
469 | extern unsigned long g_CrDbgDumpDraw;
|
---|
470 | extern unsigned long g_CrDbgDumpDrawFramesSettings;
|
---|
471 | extern unsigned long g_CrDbgDumpDrawFramesAppliedSettings;
|
---|
472 | extern unsigned long g_CrDbgDumpDrawFramesCount;
|
---|
473 |
|
---|
474 | extern uint32_t g_CrDbgDumpVertattrFixupOn;
|
---|
475 |
|
---|
476 | bool crServerDumpFilterDmp(unsigned long event, CR_DUMPER *pDumper);
|
---|
477 | bool crServerDumpFilterOpEnter(unsigned long event, CR_DUMPER *pDumper);
|
---|
478 | void crServerDumpFilterOpLeave(unsigned long event, CR_DUMPER *pDumper);
|
---|
479 |
|
---|
480 | //#define CR_SERVER_DUMP_MASK_OP 0x0000fffc
|
---|
481 | //#define CR_SERVER_DUMP_OFF_OP 2
|
---|
482 | //
|
---|
483 | //#define CR_SERVER_DUMP_MASK_DIR 0x00000003
|
---|
484 | //#define CR_SERVER_DUMP_OFF_DIR 0
|
---|
485 | //
|
---|
486 | //#define CR_SERVER_DUMP_MASK_DMP 0xffff0000
|
---|
487 | //#define CR_SERVER_DUMP_OFF_DMP 16
|
---|
488 | //
|
---|
489 | //#define CR_SERVER_DUMP_MAKE_OP(_v) (1 << ((_v) + CR_SERVER_DUMP_OFF_OP))
|
---|
490 | //#define CR_SERVER_DUMP_MAKE_DIR(_v) (1 << ((_v) + CR_SERVER_DUMP_OFF_DIR))
|
---|
491 | //#define CR_SERVER_DUMP_MAKE_DMP(_v) (1 << ((_v) + CR_SERVER_DUMP_OFF_DMP))
|
---|
492 | //
|
---|
493 | //#define CR_SERVER_DUMP_GET_OP(_v) ((_v) & CR_SERVER_DUMP_MASK_OP)
|
---|
494 | //#define CR_SERVER_DUMP_GET_DMP(_v) ((_v) & CR_SERVER_DUMP_MASK_DMP)
|
---|
495 | //#define CR_SERVER_DUMP_GET_DIR(_v) ((_v) & CR_SERVER_DUMP_MASK_DIR)
|
---|
496 | //
|
---|
497 | //#define CR_SERVER_DUMP_ISANY_OP(_v1, _v2) (!!(CR_SERVER_DUMP_GET_OP(_v1) & CR_SERVER_DUMP_GET_OP(_v2)))
|
---|
498 | //#define CR_SERVER_DUMP_ISANY_DIR(_v1, _v2) (!!(CR_SERVER_DUMP_GET_DIR(_v1) & CR_SERVER_DUMP_GET_DIR(_v2)))
|
---|
499 | //#define CR_SERVER_DUMP_ISANY_DMP(_v1, _v2) (!!(CR_SERVER_DUMP_GET_DMP(_v1) & CR_SERVER_DUMP_GET_DMP(_v2)))
|
---|
500 | //
|
---|
501 | //#define CR_SERVER_DUMP_ISANY_OP(_v1, _v2) ((CR_SERVER_DUMP_GET_OP(_v1) & CR_SERVER_DUMP_GET_OP(_v2)) == CR_SERVER_DUMP_GET_OP(_v2))
|
---|
502 | //#define CR_SERVER_DUMP_ISANY_DIR(_v1, _v2) ((CR_SERVER_DUMP_GET_DIR(_v1) & CR_SERVER_DUMP_GET_DIR(_v2)) == CR_SERVER_DUMP_GET_DIR(_v2))
|
---|
503 | //#define CR_SERVER_DUMP_ISANY_DMP(_v1, _v2) ((CR_SERVER_DUMP_GET_DMP(_v1) & CR_SERVER_DUMP_GET_DMP(_v2)) == CR_SERVER_DUMP_GET_DMP(_v2))
|
---|
504 | //
|
---|
505 | //#define CR_SERVER_DUMP_F_DIR_ENTER CR_SERVER_DUMP_MAKE_DIR(0)
|
---|
506 | //#define CR_SERVER_DUMP_F_DIR_LEAVE CR_SERVER_DUMP_MAKE_DIR(1)
|
---|
507 | //
|
---|
508 | //#define CR_SERVER_DUMP_F_OP_DRAW CR_SERVER_DUMP_MAKE_OP(0)
|
---|
509 | //#define CR_SERVER_DUMP_F_OP_SWAPBUFFERS CR_SERVER_DUMP_MAKE_OP(1)
|
---|
510 | //#define CR_SERVER_DUMP_F_OP_LINK_PROGRAM CR_SERVER_DUMP_MAKE_OP(2)
|
---|
511 | //#define CR_SERVER_DUMP_F_OP_COMPILE_PROGRAM CR_SERVER_DUMP_MAKE_OP(3)
|
---|
512 | //
|
---|
513 | //#define CR_SERVER_DUMP_F_DMP_BUFF CR_SERVER_DUMP_MAKE_DMP(0)
|
---|
514 | //#define CR_SERVER_DUMP_F_DMP_TEX CR_SERVER_DUMP_MAKE_DMP(0)
|
---|
515 | //#define CR_SERVER_DUMP_F_DMP_PROGRAM CR_SERVER_DUMP_MAKE_DMP(0)
|
---|
516 | //#define CR_SERVER_DUMP_F_DMP_PROGRAM_UNIFORMS CR_SERVER_DUMP_MAKE_DMP(0)
|
---|
517 | //#define CR_SERVER_DUMP_F_DMP_STATE CR_SERVER_DUMP_MAKE_DMP(0)
|
---|
518 | //
|
---|
519 | //#define CR_SERVER_DUMP_GET_OP(_v) ((_v) & CR_SERVER_DUMP_MASK_OP)
|
---|
520 | //#define CR_SERVER_DUMP_GET_DMP(_v) ((_v) & CR_SERVER_DUMP_MASK_DMP)
|
---|
521 | //#define CR_SERVER_DUMP_GET_DIR(_v) ((_v) & CR_SERVER_DUMP_MASK_DIR)
|
---|
522 |
|
---|
523 | #define CR_SERVER_DUMP_F_DRAW_BUFF_ENTER 0x00000001
|
---|
524 | #define CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE 0x00000002
|
---|
525 | #define CR_SERVER_DUMP_F_DRAW_STATE_ENTER 0x00000004
|
---|
526 | #define CR_SERVER_DUMP_F_DRAW_STATE_LEAVE 0x00000008
|
---|
527 | #define CR_SERVER_DUMP_F_DRAW_TEX_ENTER 0x00000010
|
---|
528 | #define CR_SERVER_DUMP_F_DRAW_TEX_LEAVE 0x00000020
|
---|
529 | #define CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER 0x00000040
|
---|
530 | #define CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE 0x00000080
|
---|
531 | #define CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_ENTER 0x00000100
|
---|
532 | #define CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_LEAVE 0x00000200
|
---|
533 | #define CR_SERVER_DUMP_F_DRAW_PROGRAM_ATTRIBS_ENTER 0x00000400
|
---|
534 | #define CR_SERVER_DUMP_F_DRAW_PROGRAM_ATTRIBS_LEAVE 0x00000800
|
---|
535 |
|
---|
536 | #define CR_SERVER_DUMP_F_DRAW_ENTER_ALL (CR_SERVER_DUMP_F_DRAW_BUFF_ENTER \
|
---|
537 | | CR_SERVER_DUMP_F_DRAW_TEX_ENTER \
|
---|
538 | | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER \
|
---|
539 | | CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_ENTER \
|
---|
540 | | CR_SERVER_DUMP_F_DRAW_STATE_ENTER \
|
---|
541 | | CR_SERVER_DUMP_F_DRAW_PROGRAM_ATTRIBS_ENTER)
|
---|
542 |
|
---|
543 | #define CR_SERVER_DUMP_F_DRAW_LEAVE_ALL (CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE \
|
---|
544 | | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE \
|
---|
545 | | CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE \
|
---|
546 | | CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_LEAVE \
|
---|
547 | | CR_SERVER_DUMP_F_DRAW_STATE_LEAVE \
|
---|
548 | | CR_SERVER_DUMP_F_DRAW_PROGRAM_ATTRIBS_LEAVE)
|
---|
549 |
|
---|
550 | #define CR_SERVER_DUMP_F_DRAW_ALL (CR_SERVER_DUMP_F_DRAW_ENTER_ALL | CR_SERVER_DUMP_F_DRAW_LEAVE_ALL)
|
---|
551 |
|
---|
552 | #define CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER 0x00010000
|
---|
553 | #define CR_SERVER_DUMP_F_SWAPBUFFERS_LEAVE 0x00020000
|
---|
554 | #define CR_SERVER_DUMP_F_TEXPRESENT 0x00040000
|
---|
555 | #define CR_SERVER_DUMP_F_DRAWEL 0x00100000
|
---|
556 | #define CR_SERVER_DUMP_F_COMPILE_SHADER 0x01000000
|
---|
557 | #define CR_SERVER_DUMP_F_SHADER_SOURCE 0x02000000
|
---|
558 | #define CR_SERVER_DUMP_F_LINK_PROGRAM 0x04000000
|
---|
559 |
|
---|
560 |
|
---|
561 | #define CR_SERVER_DUMP_DEFAULT_FILTER_OP(_ev) ((((_ev) & g_CrDbgDumpDraw) != 0) \
|
---|
562 | || ((_ev) == CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER && g_CrDbgDumpDrawFramesCount))
|
---|
563 |
|
---|
564 | #define CR_SERVER_DUMP_DEFAULT_FILTER_DMP(_ev) (((_ev) & g_CrDbgDumpDraw) != 0)
|
---|
565 |
|
---|
566 | #define CR_SERVER_DUMP_FILTER_OP(_ev, _pDumper) (g_CrDbgDumpEnabled \
|
---|
567 | && (!g_CrDbgDumpPid \
|
---|
568 | || (g_CrDbgDumpPid > 0 && ((uint64_t)g_CrDbgDumpPid) == cr_server.curClient->pid) \
|
---|
569 | || (g_CrDbgDumpPid < 0 && ((uint64_t)(-g_CrDbgDumpPid)) != cr_server.curClient->pid)) \
|
---|
570 | && crServerDumpFilterOpEnter((_ev), (_pDumper)))
|
---|
571 | #define CR_SERVER_DUMP_FILTER_DMP(_ev, _pDumper) (crServerDumpFilterDmp((_ev), (_pDumper)))
|
---|
572 |
|
---|
573 | #define CR_SERVER_DUMP_DRAW_ENTER() do { \
|
---|
574 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_DRAW_ENTER_ALL, cr_server.Recorder.pDumper)) break; \
|
---|
575 | crServerDumpCheckInit(); \
|
---|
576 | crDmpStrF(cr_server.Recorder.pDumper, "==ENTER[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
577 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_STATE_ENTER, cr_server.Recorder.pDumper)) { crServerDumpState(); } \
|
---|
578 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgram(); } \
|
---|
579 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_ENTER, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgramUniforms(); } \
|
---|
580 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_ATTRIBS_ENTER, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgramAttribs(); } \
|
---|
581 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_TEX_ENTER, cr_server.Recorder.pDumper)) { crServerDumpTextures(); } \
|
---|
582 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER, cr_server.Recorder.pDumper)) { crServerDumpBuffer(-1); } \
|
---|
583 | crDmpStrF(cr_server.Recorder.pDumper, "==Done ENTER[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
584 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_DRAW_ENTER_ALL, cr_server.Recorder.pDumper); \
|
---|
585 | } while (0)
|
---|
586 |
|
---|
587 | #define CR_SERVER_DUMP_DRAW_LEAVE() do { \
|
---|
588 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_DRAW_LEAVE_ALL, cr_server.Recorder.pDumper)) break; \
|
---|
589 | crServerDumpCheckInit(); \
|
---|
590 | crDmpStrF(cr_server.Recorder.pDumper, "==LEAVE[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
591 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_TEX_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpTextures(); } \
|
---|
592 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpBuffer(-1); } \
|
---|
593 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_UNIFORMS_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgramUniforms(); } \
|
---|
594 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_ATTRIBS_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgramAttribs(); } \
|
---|
595 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpCurrentProgram(); } \
|
---|
596 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_DRAW_STATE_LEAVE, cr_server.Recorder.pDumper)) { crServerDumpState(); } \
|
---|
597 | crDmpStrF(cr_server.Recorder.pDumper, "==Done LEAVE[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
598 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_DRAW_LEAVE_ALL, cr_server.Recorder.pDumper); \
|
---|
599 | } while (0)
|
---|
600 |
|
---|
601 | #define CR_SERVER_DUMP_COMPILE_SHADER(_id) do { \
|
---|
602 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_COMPILE_SHADER, cr_server.Recorder.pDumper)) break; \
|
---|
603 | crServerDumpCheckInit(); \
|
---|
604 | crDmpStrF(cr_server.Recorder.pDumper, "==[%d] %s", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
605 | crServerDumpShader((_id)); \
|
---|
606 | crDmpStrF(cr_server.Recorder.pDumper, "==Done[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
607 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_COMPILE_SHADER, cr_server.Recorder.pDumper); \
|
---|
608 | } while (0)
|
---|
609 |
|
---|
610 | #define CR_SERVER_DUMP_SHADER_SOURCE(_id) do { \
|
---|
611 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_SHADER_SOURCE, cr_server.Recorder.pDumper)) break; \
|
---|
612 | crServerDumpCheckInit(); \
|
---|
613 | crDmpStrF(cr_server.Recorder.pDumper, "==[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
614 | crServerDumpShader((_id)); \
|
---|
615 | crDmpStrF(cr_server.Recorder.pDumper, "==Done[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
616 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_SHADER_SOURCE, cr_server.Recorder.pDumper); \
|
---|
617 | } while (0)
|
---|
618 |
|
---|
619 | #define CR_SERVER_DUMP_LINK_PROGRAM(_id) do { \
|
---|
620 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_LINK_PROGRAM, cr_server.Recorder.pDumper)) break; \
|
---|
621 | crServerDumpCheckInit(); \
|
---|
622 | crDmpStrF(cr_server.Recorder.pDumper, "==[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
623 | crServerDumpProgram((_id)); \
|
---|
624 | crDmpStrF(cr_server.Recorder.pDumper, "==Done[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
625 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_LINK_PROGRAM, cr_server.Recorder.pDumper); \
|
---|
626 | } while (0)
|
---|
627 |
|
---|
628 | #define CR_SERVER_DUMP_SWAPBUFFERS_ENTER() do { \
|
---|
629 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER, cr_server.Recorder.pDumper)) break; \
|
---|
630 | crServerDumpCheckInit(); \
|
---|
631 | crDmpStrF(cr_server.Recorder.pDumper, "==ENTER[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
632 | if (CR_SERVER_DUMP_FILTER_DMP(CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER, cr_server.Recorder.pDumper)) { crServerDumpBuffer(CR_SERVER_FBO_BB_IDX(cr_server.currentMural)); } \
|
---|
633 | if (g_CrDbgDumpDrawFramesCount) { crServerDumpFramesCheck(); } \
|
---|
634 | crDmpStrF(cr_server.Recorder.pDumper, "==Done ENTER[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
635 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER, cr_server.Recorder.pDumper); \
|
---|
636 | } while (0)
|
---|
637 |
|
---|
638 | #define CR_SERVER_DUMP_TEXPRESENT(_pTex) do { \
|
---|
639 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_TEXPRESENT, cr_server.Recorder.pDumper)) break; \
|
---|
640 | crServerDumpCheckInit(); \
|
---|
641 | crDmpStrF(cr_server.Recorder.pDumper, "==[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
642 | crServerDumpTexture((_pTex)); \
|
---|
643 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_TEXPRESENT, cr_server.Recorder.pDumper); \
|
---|
644 | } while (0)
|
---|
645 |
|
---|
646 | #define CR_SERVER_DUMP_SWAPBUFFERS_LEAVE() do { \
|
---|
647 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_SWAPBUFFERS_LEAVE, cr_server.Recorder.pDumper)) break; \
|
---|
648 | crDmpStrF(cr_server.Recorder.pDumper, "==LEAVE[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
649 | crServerDumpCheckInit(); \
|
---|
650 | crDmpStrF(cr_server.Recorder.pDumper, "==Done LEAVE[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
651 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_SWAPBUFFERS_LEAVE, cr_server.Recorder.pDumper); \
|
---|
652 | } while (0)
|
---|
653 |
|
---|
654 | #define CR_SERVER_DUMP_DRAWEL_F(_msg) do { \
|
---|
655 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_DRAWEL, cr_server.Recorder.pDumper)) break; \
|
---|
656 | crServerDumpCheckInit(); \
|
---|
657 | crDmpStrF(cr_server.Recorder.pDumper, "==[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
658 | crServerDumpDrawel _msg; \
|
---|
659 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_DRAWEL, cr_server.Recorder.pDumper); \
|
---|
660 | } while (0)
|
---|
661 |
|
---|
662 | #define CR_SERVER_DUMP_DRAWEL_V(_index, _pszElFormat, _cbEl, _pvVal, _cVal) do { \
|
---|
663 | if (!CR_SERVER_DUMP_FILTER_OP(CR_SERVER_DUMP_F_DRAWEL, cr_server.Recorder.pDumper)) break; \
|
---|
664 | crServerDumpCheckInit(); \
|
---|
665 | crDmpStrF(cr_server.Recorder.pDumper, "==[%d] %s==", (uint32_t)cr_server.curClient->pid, __FUNCTION__); \
|
---|
666 | crServerDumpDrawelv((_index), (_pszElFormat), (_cbEl), (_pvVal), (_cVal)); \
|
---|
667 | crServerDumpFilterOpLeave(CR_SERVER_DUMP_F_DRAWEL, cr_server.Recorder.pDumper); \
|
---|
668 | } while (0)
|
---|
669 | #else /* if !defined VBOX_WITH_CRSERVER_DUMPER */
|
---|
670 | #define CR_SERVER_DUMP_DRAW_ENTER() do {} while (0)
|
---|
671 | #define CR_SERVER_DUMP_DRAW_LEAVE() do {} while (0)
|
---|
672 | #define CR_SERVER_DUMP_COMPILE_SHADER(_id) do {} while (0)
|
---|
673 | #define CR_SERVER_DUMP_LINK_PROGRAM(_id) do {} while (0)
|
---|
674 | #define CR_SERVER_DUMP_TEXPRESENT(_pTex) do {} while (0)
|
---|
675 | #define CR_SERVER_DUMP_SWAPBUFFERS_ENTER() do {} while (0)
|
---|
676 | #define CR_SERVER_DUMP_SWAPBUFFERS_LEAVE() do {} while (0)
|
---|
677 | #define CR_SERVER_DUMP_SHADER_SOURCE(_id) do {} while (0)
|
---|
678 | #define CR_SERVER_DUMP_DRAWEL_F(_msg) do {} while (0)
|
---|
679 | #define CR_SERVER_DUMP_DRAWEL_V(_index, _pszElFormat, _cbEl, _pvVal, _cVal) do {} while (0)
|
---|
680 | #endif /* !VBOX_WITH_CRSERVER_DUMPER */
|
---|
681 |
|
---|
682 | RT_C_DECLS_END
|
---|
683 |
|
---|
684 | #endif /* CR_SERVER_H */
|
---|