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