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