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 INCLUDE_CR_SERVER_H
|
---|
8 | #define INCLUDE_CR_SERVER_H
|
---|
9 |
|
---|
10 | #include "cr_spu.h"
|
---|
11 | #include "cr_net.h"
|
---|
12 | #include "cr_hash.h"
|
---|
13 | #include "cr_protocol.h"
|
---|
14 | #include "cr_glstate.h"
|
---|
15 | #include "cr_vreg.h"
|
---|
16 | #include "cr_blitter.h"
|
---|
17 | #include "spu_dispatch_table.h"
|
---|
18 | #include "cr_dump.h"
|
---|
19 |
|
---|
20 | #include "state/cr_currentpointers.h"
|
---|
21 |
|
---|
22 | #include <iprt/types.h>
|
---|
23 | #include <iprt/err.h>
|
---|
24 | #include <iprt/string.h>
|
---|
25 | #include <iprt/list.h>
|
---|
26 | #include <iprt/thread.h>
|
---|
27 | #include <iprt/critsect.h>
|
---|
28 | #include <iprt/semaphore.h>
|
---|
29 | #include <iprt/memcache.h>
|
---|
30 |
|
---|
31 | #include <VBox/vmm/ssm.h>
|
---|
32 |
|
---|
33 | #include <VBox/VBoxVideo.h>
|
---|
34 | #include <VBox/Hardware/VBoxVideoVBE.h>
|
---|
35 | #include <VBox/VBoxVideo3D.h>
|
---|
36 |
|
---|
37 | #ifdef __cplusplus
|
---|
38 | extern "C" {
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #define CR_MAX_WINDOWS 100
|
---|
42 | #define CR_MAX_CLIENTS 64
|
---|
43 |
|
---|
44 | /*@todo must match MaxGuestMonitors from SchemaDefs.h*/
|
---|
45 | #define CR_MAX_GUEST_MONITORS VBOX_VIDEO_MAX_SCREENS
|
---|
46 |
|
---|
47 | typedef DECLCALLBACKPTR(void, PFNCRSERVERPRESENTFBO) (void *data, int32_t screenId, int32_t x, int32_t y, uint32_t w, uint32_t h);
|
---|
48 |
|
---|
49 | /* Callbacks for output of the rendered frames.
|
---|
50 | *
|
---|
51 | * This allows to pass rendered frames to an external component rather than draw them on screen.
|
---|
52 | *
|
---|
53 | * An external component registers the redirection callbacks using crVBoxServerOutputRedirectSet.
|
---|
54 | *
|
---|
55 | * The list of formats supported by the caller is obtained using CRORContextProperty.
|
---|
56 | * The actual format choosed by the service is passed as a CRORBegin parameter.
|
---|
57 | */
|
---|
58 | typedef struct {
|
---|
59 | const void *pvContext; /* Supplied by crVBoxServerOutputRedirectSet. */
|
---|
60 | DECLR3CALLBACKMEMBER(void, CRORBegin, (const void *pvContext, void **ppvInstance,
|
---|
61 | const char *pszFormat));
|
---|
62 | DECLR3CALLBACKMEMBER(void, CRORGeometry, (void *pvInstance,
|
---|
63 | int32_t x, int32_t y, uint32_t w, uint32_t h));
|
---|
64 | DECLR3CALLBACKMEMBER(void, CRORVisibleRegion, (void *pvInstance,
|
---|
65 | uint32_t cRects, const RTRECT *paRects));
|
---|
66 | DECLR3CALLBACKMEMBER(void, CRORFrame, (void *pvInstance,
|
---|
67 | void *pvData, uint32_t cbData));
|
---|
68 | DECLR3CALLBACKMEMBER(void, CROREnd, (void *pvInstance));
|
---|
69 | DECLR3CALLBACKMEMBER(int, CRORContextProperty, (const void *pvContext, uint32_t index,
|
---|
70 | void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut));
|
---|
71 | } CROutputRedirect;
|
---|
72 |
|
---|
73 | typedef struct {
|
---|
74 | CRrecti imagewindow; /**< coordinates in mural space */
|
---|
75 | CRrectf bounds; /**< normalized coordinates in [-1,-1] x [1,1] */
|
---|
76 | CRrecti outputwindow; /**< coordinates in server's rendering window */
|
---|
77 | CRrecti clippedImagewindow; /**< imagewindow clipped to current viewport */
|
---|
78 | CRmatrix baseProjection; /**< pre-multiplied onto projection matrix */
|
---|
79 | CRrecti scissorBox; /**< passed to back-end OpenGL */
|
---|
80 | CRrecti viewport; /**< passed to back-end OpenGL */
|
---|
81 | GLuint serialNo; /**< an optimization */
|
---|
82 | } CRExtent;
|
---|
83 |
|
---|
84 | struct BucketingInfo;
|
---|
85 |
|
---|
86 | typedef struct {
|
---|
87 | char *pszDpyName;
|
---|
88 | GLint visualBits;
|
---|
89 | int32_t externalID;
|
---|
90 | } CRCreateInfo_t;
|
---|
91 |
|
---|
92 | typedef struct {
|
---|
93 | char *pszDpyName;
|
---|
94 | int32_t externalID;
|
---|
95 | GLint requestedVisualBits;
|
---|
96 | GLint realVisualBits;
|
---|
97 | } CRCreateInfoEx_t;
|
---|
98 |
|
---|
99 | /* VRAM->RAM worker thread */
|
---|
100 |
|
---|
101 | typedef enum
|
---|
102 | {
|
---|
103 | CR_SERVER_RPW_STATE_UNINITIALIZED = 0,
|
---|
104 | CR_SERVER_RPW_STATE_INITIALIZING,
|
---|
105 | CR_SERVER_RPW_STATE_INITIALIZED,
|
---|
106 | CR_SERVER_RPW_STATE_UNINITIALIZING,
|
---|
107 | } CR_SERVER_RPW_STATE;
|
---|
108 |
|
---|
109 | /* worker control command */
|
---|
110 | typedef enum
|
---|
111 | {
|
---|
112 | CR_SERVER_RPW_CTL_TYPE_UNDEFINED = 0,
|
---|
113 | CR_SERVER_RPW_CTL_TYPE_WAIT_COMPLETE,
|
---|
114 | CR_SERVER_RPW_CTL_TYPE_TERM
|
---|
115 | } CR_SERVER_RPW_CTL_TYPE;
|
---|
116 |
|
---|
117 | struct CR_SERVER_RPW_ENTRY;
|
---|
118 |
|
---|
119 | typedef struct CR_SERVER_RPW_CTL {
|
---|
120 | CR_SERVER_RPW_CTL_TYPE enmType;
|
---|
121 | int rc;
|
---|
122 | RTSEMEVENT hCompleteEvent;
|
---|
123 | /* valid for *_WAIT_COMPLETE and *_CANCEL */
|
---|
124 | struct CR_SERVER_RPW_ENTRY *pEntry;
|
---|
125 | } CR_SERVER_RPW_CTL;
|
---|
126 |
|
---|
127 |
|
---|
128 | struct CR_SERVER_RPW_ENTRY;
|
---|
129 |
|
---|
130 | typedef DECLCALLBACKPTR(void, PFNCR_SERVER_RPW_DATA) (const struct CR_SERVER_RPW_ENTRY* pEntry, void *pvEntryTexData);
|
---|
131 |
|
---|
132 | typedef DECLCALLBACKPTR(void, PFNCRSERVERNOTIFYEVENT) (int32_t screenId, uint32_t uEvent, void*pvData);
|
---|
133 |
|
---|
134 | typedef struct CR_SERVER_RPW_ENTRY
|
---|
135 | {
|
---|
136 | RTRECTSIZE Size;
|
---|
137 | /* We have to use 4 textures here.
|
---|
138 | *
|
---|
139 | * 1. iDrawTex - the texture clients can draw to and then submit it for contents acquisition via crServerRpwEntrySubmit
|
---|
140 | * 2. iSubmittedTex - the texture submitted to the worker for processing and, whose processing has not start yet,
|
---|
141 | * i.e. it is being in the queue and can be safely removed/replaced [from] there
|
---|
142 | * 3. iWorkerTex - the texture being prepared & passed by the worker to the GPU (stage 1 of a worker contents acquisition process)
|
---|
143 | * 4. iGpuTex - the texture passed/processed to/by the GPU, whose data is then acquired by the server (stage 2 of a worker contents acquisition process)
|
---|
144 | *
|
---|
145 | * - There can be valid distinct iGpuTex, iWorkerTex, iSubmittedTex and iDrawTex present simultaneously.
|
---|
146 | * - Either or both of iSubmittedTex and iFreeTex are always valid
|
---|
147 | *
|
---|
148 | * Detail:
|
---|
149 | *
|
---|
150 | * - iSubmittedTex and iFreeTex modifications are performed under CR_SERVER_RPW::CritSect lock.
|
---|
151 | *
|
---|
152 | * - iDrawTex can only be changed by client side (i.e. the crServerRpwEntrySubmit caller), this is why client thread can access it w/o a lock
|
---|
153 | * - iSubmittedTex and iFreeTex can be modified by both client and worker, so lock is always required
|
---|
154 | *
|
---|
155 | * - iDrawTex can be accessed by client code only
|
---|
156 | * - iWorkerTex and iGpuTex can be accessed by worker code only
|
---|
157 | * - iSubmittedTex and iFreeTex can be accessed under CR_SERVER_RPW::CritSect lock only
|
---|
158 | * - either or both of iSubmittedTex and iFreeTex are always valid (see below for more explanation),
|
---|
159 | * this is why client can easily determine the new iDrawTex value on Submit, i.e. :
|
---|
160 | *
|
---|
161 | * (if initial iSubmittedTex was valid)
|
---|
162 | * ---------------
|
---|
163 | * | ^
|
---|
164 | * > |
|
---|
165 | * Submit-> iDrawTex -> iSubmittedTex
|
---|
166 | * ^
|
---|
167 | * | (if initial iSubmittedTex was NOT valid)
|
---|
168 | * iFreeTex
|
---|
169 | *
|
---|
170 | * - The worker can invalidate the iSubmittedTex (i.e. do iSubmittedTex -> iWorkerTex) only after it is done
|
---|
171 | * with the last iWorkerTex -> iGpuTex transformation freeing the previously used iGpuTex to iFreeTex.
|
---|
172 | *
|
---|
173 | * - A simplified worker iXxxTex transformation logic is:
|
---|
174 | * 1. iFreeTex is initially valid
|
---|
175 | * 2. iSubmittedTex -> iWorkerTex;
|
---|
176 | * 3. submit iWorkerTex acquire request to the GPU
|
---|
177 | * 4. complete current iGpuTex
|
---|
178 | * 5. iGpuTex -> iFreeTex
|
---|
179 | * 6. iWorkerTex -> iGpuTex
|
---|
180 | * 7. goto 1
|
---|
181 | *
|
---|
182 | * */
|
---|
183 | int8_t iTexDraw;
|
---|
184 | int8_t iTexSubmitted;
|
---|
185 | int8_t iTexWorker;
|
---|
186 | int8_t iTexGpu;
|
---|
187 | int8_t iCurPBO;
|
---|
188 | GLuint aidWorkerTexs[4];
|
---|
189 | GLuint aidPBOs[2];
|
---|
190 | RTLISTNODE WorkEntry;
|
---|
191 | RTLISTNODE WorkerWorkEntry;
|
---|
192 | RTLISTNODE GpuSubmittedEntry;
|
---|
193 | PFNCR_SERVER_RPW_DATA pfnData;
|
---|
194 | } CR_SERVER_RPW_ENTRY;
|
---|
195 |
|
---|
196 | typedef struct CR_SERVER_RPW {
|
---|
197 | RTLISTNODE WorkList;
|
---|
198 | RTCRITSECT CritSect;
|
---|
199 | RTSEMEVENT hSubmitEvent;
|
---|
200 | /* only one outstanding command is supported,
|
---|
201 | * and ctl requests must be cynchronized, hold it right here */
|
---|
202 | CR_SERVER_RPW_CTL Ctl;
|
---|
203 | int ctxId;
|
---|
204 | GLint ctxVisBits;
|
---|
205 | RTTHREAD hThread;
|
---|
206 | } CR_SERVER_RPW;
|
---|
207 | /* */
|
---|
208 |
|
---|
209 | /* FRAMEBUFFER */
|
---|
210 | typedef struct CR_FRAMEBUFFER *HCR_FRAMEBUFFER;
|
---|
211 | typedef struct CR_FRAMEBUFFER_ENTRY *HCR_FRAMEBUFFER_ENTRY;
|
---|
212 | /* */
|
---|
213 |
|
---|
214 | typedef struct CR_FBDATA
|
---|
215 | {
|
---|
216 | HCR_FRAMEBUFFER hFb;
|
---|
217 | HCR_FRAMEBUFFER_ENTRY hFbEntry;
|
---|
218 | CR_TEXDATA* apTexDatas[2];
|
---|
219 | } CR_FBDATA;
|
---|
220 | /**
|
---|
221 | * Mural info
|
---|
222 | */
|
---|
223 | typedef struct {
|
---|
224 | GLuint width, height;
|
---|
225 | GLint gX, gY; /*guest coordinates*/
|
---|
226 | GLint hX, hY; /*host coordinates, screenID related*/
|
---|
227 |
|
---|
228 | int spuWindow; /*the SPU's corresponding window ID */
|
---|
229 |
|
---|
230 | int screenId;
|
---|
231 |
|
---|
232 | GLboolean bVisible; /*guest window is visible*/
|
---|
233 | GLubyte u8Unused; /*redirect to FBO instead of real host window*/
|
---|
234 | GLboolean bFbDraw; /*GL_FRONT buffer is drawn to directly*/
|
---|
235 | GLboolean fReserved;
|
---|
236 |
|
---|
237 | GLint cVisibleRects; /*count of visible rects*/
|
---|
238 | GLint *pVisibleRects; /*visible rects left, top, right, bottom*/
|
---|
239 | GLboolean bReceivedRects; /*indicates if guest did any updates for visible regions*/
|
---|
240 |
|
---|
241 | GLuint cBuffers;
|
---|
242 | GLuint iBbBuffer;
|
---|
243 | GLuint aidFBOs[2];
|
---|
244 | GLuint aidColorTexs[2];
|
---|
245 |
|
---|
246 | void *pvReserved;
|
---|
247 |
|
---|
248 | CRCreateInfoEx_t CreateInfo;
|
---|
249 |
|
---|
250 | /* to avoid saved state breakage we need to keep RT_OFFSETOF(CRMuralInfo, CreateInfo) intact
|
---|
251 | * this is why we place some FBO stuff to the tail
|
---|
252 | * @todo: once we need to increment a saved state version, we could refactor this structure */
|
---|
253 | GLint iCurDrawBuffer;
|
---|
254 | GLint iCurReadBuffer;
|
---|
255 |
|
---|
256 | GLuint idDepthStencilRB;
|
---|
257 | GLuint fboWidth, fboHeight;
|
---|
258 |
|
---|
259 | GLboolean fHasParentWindow;
|
---|
260 |
|
---|
261 | GLboolean fRedirected;
|
---|
262 | GLboolean fForcePresentState;
|
---|
263 | GLboolean fOrPresentOnReenable;
|
---|
264 |
|
---|
265 | GLboolean fIsVisible;
|
---|
266 |
|
---|
267 | CR_TEXDATA aTexs[2];
|
---|
268 | uint32_t cUsedFBDatas;
|
---|
269 | CR_FBDATA *apUsedFBDatas[CR_MAX_GUEST_MONITORS];
|
---|
270 | CR_FBDATA aFBDatas[CR_MAX_GUEST_MONITORS];
|
---|
271 |
|
---|
272 | /* bitfield representing contexts the mural has been ever current with
|
---|
273 | * we just reuse CR_STATE_SHAREDOBJ_USAGE_XXX API here for simplicity */
|
---|
274 | CRbitvalue ctxUsage[CR_MAX_BITARRAY];
|
---|
275 | } CRMuralInfo;
|
---|
276 |
|
---|
277 | typedef struct {
|
---|
278 | CRContext *pContext;
|
---|
279 | int SpuContext;
|
---|
280 | CRCreateInfoEx_t CreateInfo;
|
---|
281 | CRMuralInfo * currentMural;
|
---|
282 | } CRContextInfo;
|
---|
283 |
|
---|
284 | /**
|
---|
285 | * A client is basically an upstream Cr Node (connected via mothership)
|
---|
286 | */
|
---|
287 | typedef struct _crclient {
|
---|
288 | int spu_id; /**< id of the last SPU in the client's SPU chain */
|
---|
289 | CRConnection *conn; /**< network connection from the client */
|
---|
290 | int number; /**< a unique number for each client */
|
---|
291 | uint64_t pid; /*guest pid*/
|
---|
292 | GLint currentContextNumber;
|
---|
293 | CRContextInfo *currentCtxInfo;
|
---|
294 | GLint currentWindow;
|
---|
295 | CRMuralInfo *currentMural;
|
---|
296 | GLint windowList[CR_MAX_WINDOWS];
|
---|
297 | GLint contextList[CR_MAX_CONTEXTS];
|
---|
298 | #ifdef VBOXCR_LOGFPS
|
---|
299 | uint64_t timeUsed;
|
---|
300 | #endif
|
---|
301 | } CRClient;
|
---|
302 |
|
---|
303 | typedef struct _crclientnode {
|
---|
304 | CRClient *pClient;
|
---|
305 | struct _crclientnode *prev, *next;
|
---|
306 | } CRClientNode;
|
---|
307 |
|
---|
308 | typedef struct CRPoly_t {
|
---|
309 | int npoints;
|
---|
310 | double *points;
|
---|
311 | struct CRPoly_t *next;
|
---|
312 | } CRPoly;
|
---|
313 |
|
---|
314 | /**
|
---|
315 | * There's one of these run queue entries per client
|
---|
316 | * The run queue is a circular, doubly-linked list of these objects.
|
---|
317 | */
|
---|
318 | typedef struct RunQueue_t {
|
---|
319 | CRClient *client;
|
---|
320 | int blocked;
|
---|
321 | struct RunQueue_t *next;
|
---|
322 | struct RunQueue_t *prev;
|
---|
323 | } RunQueue;
|
---|
324 |
|
---|
325 | typedef struct {
|
---|
326 | GLint freeWindowID;
|
---|
327 | GLint freeContextID;
|
---|
328 | GLint freeClientID;
|
---|
329 | } CRServerFreeIDsPool_t;
|
---|
330 |
|
---|
331 | typedef struct {
|
---|
332 | int32_t x, y;
|
---|
333 | uint32_t w, h;
|
---|
334 | uint64_t winID;
|
---|
335 | } CRScreenInfo;
|
---|
336 |
|
---|
337 | typedef struct {
|
---|
338 | RTRECT Rect;
|
---|
339 | } CRScreenViewportInfo;
|
---|
340 |
|
---|
341 | /* BFB (BlitFramebuffer Blitter) flags
|
---|
342 | * so far only CR_SERVER_BFB_ON_ALWAIS is supported and is alwais used if any flag is set */
|
---|
343 | #define CR_SERVER_BFB_DISABLED 0
|
---|
344 | #define CR_SERVER_BFB_ON_INVERTED_BLIT 1
|
---|
345 | #define CR_SERVER_BFB_ON_STRAIGHT_BLIT 2
|
---|
346 | #define CR_SERVER_BFB_ON_ALWAIS (CR_SERVER_BFB_ON_INVERTED_BLIT | CR_SERVER_BFB_ON_STRAIGHT_BLIT)
|
---|
347 |
|
---|
348 | typedef struct {
|
---|
349 | unsigned short tcpip_port;
|
---|
350 |
|
---|
351 | CRScreenInfo screen[CR_MAX_GUEST_MONITORS];
|
---|
352 | CRScreenViewportInfo screenVieport[CR_MAX_GUEST_MONITORS];
|
---|
353 | int screenCount;
|
---|
354 |
|
---|
355 | int numClients;
|
---|
356 | CRClient *clients[CR_MAX_CLIENTS]; /**< array [numClients] */
|
---|
357 | CRClient *curClient;
|
---|
358 | CRClientNode *pCleanupClient; /*list of clients with pending clean up*/
|
---|
359 | CRCurrentStatePointers current;
|
---|
360 |
|
---|
361 | GLboolean firstCallCreateContext;
|
---|
362 | GLboolean firstCallMakeCurrent;
|
---|
363 | GLboolean bIsInLoadingState; /* Indicates if we're in process of loading VM snapshot */
|
---|
364 | GLboolean bIsInSavingState; /* Indicates if we're in process of saving VM snapshot */
|
---|
365 | GLboolean bForceMakeCurrentOnClientSwitch;
|
---|
366 | CRContextInfo *currentCtxInfo;
|
---|
367 | GLint currentWindow;
|
---|
368 | GLint currentNativeWindow;
|
---|
369 | CRMuralInfo *currentMural;
|
---|
370 |
|
---|
371 | CRHashTable *muralTable; /**< hash table where all murals are stored */
|
---|
372 |
|
---|
373 | int client_spu_id;
|
---|
374 |
|
---|
375 | int mtu;
|
---|
376 | int buffer_size;
|
---|
377 | char protocol[1024];
|
---|
378 |
|
---|
379 | SPU *head_spu;
|
---|
380 | SPUDispatchTable dispatch;
|
---|
381 |
|
---|
382 | CRNetworkPointer return_ptr;
|
---|
383 | CRNetworkPointer writeback_ptr;
|
---|
384 |
|
---|
385 | CRLimitsState limits; /**< GL limits for any contexts we create */
|
---|
386 |
|
---|
387 | CRContextInfo MainContextInfo;
|
---|
388 |
|
---|
389 | CRHashTable *contextTable; /**< hash table for rendering contexts */
|
---|
390 |
|
---|
391 | CRHashTable *programTable; /**< for vertex programs */
|
---|
392 | GLuint currentProgram;
|
---|
393 |
|
---|
394 | /* visBits -> dummy mural association */
|
---|
395 | CRHashTable *dummyMuralTable;
|
---|
396 |
|
---|
397 | GLboolean fRootVrOn;
|
---|
398 | VBOXVR_LIST RootVr;
|
---|
399 | /* we need to translate Root Vr to each window coords, this one cpecifies the current translation point
|
---|
400 | * note that since window attributes modifications is performed in HGCM thread only and thus is serialized,
|
---|
401 | * we deal with the global RootVr data directly */
|
---|
402 | RTPOINT RootVrCurPoint;
|
---|
403 |
|
---|
404 | /* blitter so far used for working around host drivers BlitFramebuffer bugs
|
---|
405 | * by implementing */
|
---|
406 | uint32_t fBlitterMode;
|
---|
407 | CR_BLITTER Blitter;
|
---|
408 |
|
---|
409 | VBOXCRCMD_CLTINFO CltInfo;
|
---|
410 |
|
---|
411 | CR_SERVER_RPW RpwWorker;
|
---|
412 |
|
---|
413 | /** configuration options */
|
---|
414 | /*@{*/
|
---|
415 | int useL2;
|
---|
416 | int ignore_papi;
|
---|
417 | unsigned int maxBarrierCount;
|
---|
418 | unsigned int clearCount;
|
---|
419 | int optimizeBucket;
|
---|
420 | int only_swap_once;
|
---|
421 | int debug_barriers;
|
---|
422 | int sharedDisplayLists;
|
---|
423 | int sharedTextureObjects;
|
---|
424 | int sharedPrograms;
|
---|
425 | int sharedWindows;
|
---|
426 | int uniqueWindows;
|
---|
427 | int localTileSpec;
|
---|
428 | int useDMX;
|
---|
429 | int overlapBlending;
|
---|
430 | int vpProjectionMatrixParameter;
|
---|
431 | const char *vpProjectionMatrixVariable;
|
---|
432 | int stereoView;
|
---|
433 | int vncMode; /* cmd line option */
|
---|
434 | /*@}*/
|
---|
435 | /** view_matrix config */
|
---|
436 | /*@{*/
|
---|
437 | GLboolean viewOverride;
|
---|
438 | CRmatrix viewMatrix[2]; /**< left and right eye */
|
---|
439 | /*@}*/
|
---|
440 | /** projection_matrix config */
|
---|
441 | /*@{*/
|
---|
442 | GLboolean projectionOverride;
|
---|
443 | CRmatrix projectionMatrix[2]; /**< left and right eye */
|
---|
444 | int currentEye;
|
---|
445 | /*@}*/
|
---|
446 |
|
---|
447 | /** for warped tiles */
|
---|
448 | /*@{*/
|
---|
449 | GLfloat alignment_matrix[16], unnormalized_alignment_matrix[16];
|
---|
450 | /*@}*/
|
---|
451 |
|
---|
452 | /** tile overlap/blending info - this should probably be per-mural */
|
---|
453 | /*@{*/
|
---|
454 | CRPoly **overlap_geom;
|
---|
455 | CRPoly *overlap_knockout;
|
---|
456 | float *overlap_intens;
|
---|
457 | int num_overlap_intens;
|
---|
458 | int num_overlap_levels;
|
---|
459 | /*@}*/
|
---|
460 |
|
---|
461 | CRHashTable *barriers, *semaphores;
|
---|
462 |
|
---|
463 | RunQueue *run_queue;
|
---|
464 |
|
---|
465 | GLuint currentSerialNo;
|
---|
466 |
|
---|
467 | PFNCRSERVERPRESENTFBO pfnPresentFBO;
|
---|
468 |
|
---|
469 | GLuint fVisualBitsDefault;
|
---|
470 | GLboolean bUsePBOForReadback; /*Use PBO's for data readback*/
|
---|
471 |
|
---|
472 | CROutputRedirect outputRedirect;
|
---|
473 |
|
---|
474 | GLboolean bUseMultipleContexts;
|
---|
475 |
|
---|
476 | GLboolean bWindowsInitiallyHidden;
|
---|
477 |
|
---|
478 | /* OR-ed CR_VBOX_CAP_XXX cap values
|
---|
479 | * describing VBox Chromium functionality caps visible to guest
|
---|
480 | * Currently can have only CR_VBOX_CAP_TEX_PRESENT cap to notify
|
---|
481 | * that the TexPresent mechanism is available and enabled */
|
---|
482 | uint32_t u32Caps;
|
---|
483 |
|
---|
484 | PFNCRSERVERNOTIFYEVENT pfnNotifyEventCB;
|
---|
485 |
|
---|
486 | SPUDispatchTable TmpCtxDispatch;
|
---|
487 |
|
---|
488 | #ifdef VBOX_WITH_CRSERVER_DUMPER
|
---|
489 | CR_RECORDER Recorder;
|
---|
490 | CR_BLITTER RecorderBlitter;
|
---|
491 | CR_DBGPRINT_DUMPER DbgPrintDumper;
|
---|
492 | CR_HTML_DUMPER HtmlDumper;
|
---|
493 | CR_DUMPER *pDumper;
|
---|
494 | #endif
|
---|
495 |
|
---|
496 | int RcToGuest;
|
---|
497 | int RcToGuestOnce;
|
---|
498 | } CRServer;
|
---|
499 |
|
---|
500 |
|
---|
501 | extern DECLEXPORT(void) crServerInit( int argc, char *argv[] );
|
---|
502 | extern DECLEXPORT(int) CRServerMain( int argc, char *argv[] );
|
---|
503 | extern DECLEXPORT(void) crServerServiceClients(void);
|
---|
504 | extern DECLEXPORT(void) crServerAddNewClient(void);
|
---|
505 | extern DECLEXPORT(SPU*) crServerHeadSPU(void);
|
---|
506 | extern DECLEXPORT(void) crServerSetPort(int port);
|
---|
507 |
|
---|
508 | extern DECLEXPORT(GLboolean) crVBoxServerInit(void);
|
---|
509 | extern DECLEXPORT(void) crVBoxServerTearDown(void);
|
---|
510 | extern DECLEXPORT(int32_t) crVBoxServerAddClient(uint32_t u32ClientID);
|
---|
511 | extern DECLEXPORT(void) crVBoxServerRemoveClient(uint32_t u32ClientID);
|
---|
512 | extern DECLEXPORT(int32_t) crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer);
|
---|
513 | extern DECLEXPORT(int32_t) crVBoxServerClientRead(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t *pcbBuffer);
|
---|
514 | extern DECLEXPORT(int32_t) crVBoxServerClientSetVersion(uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor);
|
---|
515 | extern DECLEXPORT(int32_t) crVBoxServerClientGetCaps(uint32_t u32ClientID, uint32_t *pu32Caps);
|
---|
516 | extern DECLEXPORT(int32_t) crVBoxServerClientSetPID(uint32_t u32ClientID, uint64_t pid);
|
---|
517 |
|
---|
518 | extern DECLEXPORT(int32_t) crVBoxServerSaveState(PSSMHANDLE pSSM);
|
---|
519 | extern DECLEXPORT(int32_t) crVBoxServerLoadState(PSSMHANDLE pSSM, uint32_t version);
|
---|
520 |
|
---|
521 | typedef struct
|
---|
522 | {
|
---|
523 | CR_BLITTER_IMG Img;
|
---|
524 | uint32_t u32Screen;
|
---|
525 | uint32_t fDataAllocated;
|
---|
526 | } CR_SCREENSHOT;
|
---|
527 |
|
---|
528 | extern DECLEXPORT(int) crServerVBoxWindowsShow(bool fShow);
|
---|
529 | extern DECLEXPORT(int) crServerVBoxScreenshotGet(uint32_t u32Screen, uint32_t width, uint32_t height, uint32_t pitch, void *pvBuffer, CR_SCREENSHOT *pScreenshot);
|
---|
530 | extern DECLEXPORT(void) crServerVBoxScreenshotRelease(CR_SCREENSHOT *pScreenshot);
|
---|
531 |
|
---|
532 | extern DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable);
|
---|
533 | extern DECLEXPORT(int32_t) crVBoxServerSetScreenCount(int sCount);
|
---|
534 | extern DECLEXPORT(int32_t) crVBoxServerUnmapScreen(int sIndex);
|
---|
535 | extern DECLEXPORT(int32_t) crVBoxServerMapScreen(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h, uint64_t winID);
|
---|
536 | extern DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable);
|
---|
537 | struct VBVAINFOSCREEN;
|
---|
538 | extern DECLEXPORT(int) crVBoxServerNotifyResize(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM);
|
---|
539 | extern DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, const RTRECT *pRects);
|
---|
540 |
|
---|
541 | extern DECLEXPORT(void) crVBoxServerSetPresentFBOCB(PFNCRSERVERPRESENTFBO pfnPresentFBO);
|
---|
542 |
|
---|
543 | extern DECLEXPORT(int32_t) crVBoxServerSetOffscreenRendering(GLboolean value);
|
---|
544 |
|
---|
545 | extern DECLEXPORT(int32_t) crVBoxServerOutputRedirectSet(const CROutputRedirect *pCallbacks);
|
---|
546 |
|
---|
547 | extern DECLEXPORT(int32_t) crVBoxServerSetScreenViewport(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h);
|
---|
548 |
|
---|
549 | extern DECLEXPORT(void) crServerVBoxSetNotifyEventCB(PFNCRSERVERNOTIFYEVENT pfnCb);
|
---|
550 |
|
---|
551 | #ifdef VBOX_WITH_CRHGSMI
|
---|
552 | /* We moved all CrHgsmi command processing to crserverlib to keep the logic of dealing with CrHgsmi commands in one place.
|
---|
553 | *
|
---|
554 | * For now we need the notion of CrHgdmi commands in the crserver_lib to be able to complete it asynchronously once it is really processed.
|
---|
555 | * This help avoiding the "blocked-client" issues. The client is blocked if another client is doing begin-end stuff.
|
---|
556 | * For now we eliminated polling that could occur on block, which caused a higher-priority thread (in guest) polling for the blocked command complition
|
---|
557 | * to block the lower-priority thread trying to complete the blocking command.
|
---|
558 | * And removed extra memcpy done on blocked command arrival.
|
---|
559 | *
|
---|
560 | * In the future we will extend CrHgsmi functionality to maintain texture data directly in CrHgsmi allocation to avoid extra memcpy-ing with PBO,
|
---|
561 | * implement command completion and stuff necessary for GPU scheduling to work properly for WDDM Windows guests, etc.
|
---|
562 | *
|
---|
563 | * NOTE: it is ALWAYS responsibility of the crVBoxServerCrHgsmiCmd to complete the command!
|
---|
564 | * */
|
---|
565 | extern DECLEXPORT(int32_t) crVBoxServerCrHgsmiCmd(struct VBOXVDMACMD_CHROMIUM_CMD *pCmd, uint32_t cbCmd);
|
---|
566 | extern DECLEXPORT(int32_t) crVBoxServerCrHgsmiCtl(struct VBOXVDMACMD_CHROMIUM_CTL *pCtl, uint32_t cbCtl);
|
---|
567 |
|
---|
568 | extern DECLEXPORT(int32_t) crVBoxServerCrCmdNotifyCmds();
|
---|
569 | #endif
|
---|
570 |
|
---|
571 | #ifdef __cplusplus
|
---|
572 | }
|
---|
573 | #endif
|
---|
574 |
|
---|
575 | #endif
|
---|
576 |
|
---|