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