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 | extern uint8_t* g_pvVRamBase;
|
---|
22 | extern HCRHGSMICMDCOMPLETION g_hCrHgsmiCompletion;
|
---|
23 | extern PFNCRHGSMICMDCOMPLETION g_pfnCrHgsmiCompletion;
|
---|
24 |
|
---|
25 | #define VBOXCRHGSMI_PTR(_off, _t) ((_t*)(g_pvVRamBase + (_off)))
|
---|
26 |
|
---|
27 | DECLINLINE(void) crServerCrHgsmiCmdComplete(struct VBOXVDMACMD_CHROMIUM_CMD *pCmd, int cmdProcessingRc)
|
---|
28 | {
|
---|
29 | g_pfnCrHgsmiCompletion(g_hCrHgsmiCompletion, pCmd, cmdProcessingRc);
|
---|
30 | }
|
---|
31 |
|
---|
32 | #define VBOXCRHGSMI_CMD_COMPLETE(_pData, _rc) do { \
|
---|
33 | CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData); \
|
---|
34 | CRVBOXHGSMI_CMDDATA_RC(_pData, _rc); \
|
---|
35 | crServerCrHgsmiCmdComplete((_pData)->pCmd, VINF_SUCCESS); \
|
---|
36 | } while (0)
|
---|
37 |
|
---|
38 | #define VBOXCRHGSMI_CMD_CHECK_COMPLETE(_pData, _rc) do { \
|
---|
39 | if (CRVBOXHGSMI_CMDDATA_IS_SET(_pData)) { \
|
---|
40 | VBOXCRHGSMI_CMD_COMPLETE(_pData, _rc); \
|
---|
41 | } \
|
---|
42 | } while (0)
|
---|
43 |
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * This is the base number for window and context IDs
|
---|
48 | */
|
---|
49 | #define MAGIC_OFFSET 5000
|
---|
50 |
|
---|
51 | extern CRServer cr_server;
|
---|
52 |
|
---|
53 | /* Semaphore wait queue node */
|
---|
54 | typedef struct _wqnode {
|
---|
55 | RunQueue *q;
|
---|
56 | struct _wqnode *next;
|
---|
57 | } wqnode;
|
---|
58 |
|
---|
59 | typedef struct {
|
---|
60 | GLuint count;
|
---|
61 | GLuint num_waiting;
|
---|
62 | RunQueue **waiting;
|
---|
63 | } CRServerBarrier;
|
---|
64 |
|
---|
65 | typedef struct {
|
---|
66 | GLuint count;
|
---|
67 | wqnode *waiting, *tail;
|
---|
68 | } CRServerSemaphore;
|
---|
69 |
|
---|
70 | typedef struct {
|
---|
71 | GLuint id;
|
---|
72 | GLint projParamStart;
|
---|
73 | GLfloat projMat[16]; /* projection matrix, accumulated via calls to */
|
---|
74 | /* glProgramLocalParameterARB, glProgramParameterNV */
|
---|
75 | } CRServerProgram;
|
---|
76 |
|
---|
77 | typedef struct {
|
---|
78 | char *pszDpyName;
|
---|
79 | GLint visualBits;
|
---|
80 | int32_t internalID;
|
---|
81 | } CRCreateInfo_t;
|
---|
82 |
|
---|
83 | void crServerSetVBoxConfiguration();
|
---|
84 | void crServerSetVBoxConfigurationHGCM();
|
---|
85 | void crServerInitDispatch(void);
|
---|
86 | void crServerReturnValue( const void *payload, unsigned int payload_len );
|
---|
87 | void crServerWriteback(void);
|
---|
88 | int crServerRecv( CRConnection *conn, CRMessage *msg, unsigned int len );
|
---|
89 | void crServerSerializeRemoteStreams(void);
|
---|
90 | void crServerAddToRunQueue( CRClient *client );
|
---|
91 | void crServerDeleteClient( CRClient *client );
|
---|
92 |
|
---|
93 |
|
---|
94 | void crServerApplyBaseProjection( const CRmatrix *baseProj );
|
---|
95 | void crServerApplyViewMatrix( const CRmatrix *view );
|
---|
96 | void crServerSetOutputBounds( const CRMuralInfo *mural, int extNum );
|
---|
97 | void crServerComputeViewportBounds( const CRViewportState *v, CRMuralInfo *mural );
|
---|
98 |
|
---|
99 | GLboolean crServerInitializeBucketing(CRMuralInfo *mural);
|
---|
100 |
|
---|
101 | void crComputeOverlapGeom(double *quads, int nquad, CRPoly ***res);
|
---|
102 | void crComputeKnockoutGeom(double *quads, int nquad, int my_quad_idx, CRPoly **res);
|
---|
103 |
|
---|
104 | int crServerGetCurrentEye(void);
|
---|
105 |
|
---|
106 | GLboolean crServerClientInBeginEnd(const CRClient *client);
|
---|
107 |
|
---|
108 | GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID);
|
---|
109 | GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID);
|
---|
110 |
|
---|
111 | void crServerCreateInfoDeleteCB(void *data);
|
---|
112 |
|
---|
113 | GLint crServerGenerateID(GLint *pCounter);
|
---|
114 |
|
---|
115 | GLint crServerSPUWindowID(GLint serverWindow);
|
---|
116 |
|
---|
117 | GLuint crServerTranslateProgramID(GLuint id);
|
---|
118 |
|
---|
119 | void crServerSetupOutputRedirect(CRMuralInfo *mural);
|
---|
120 | void crServerCheckMuralGeometry(CRMuralInfo *mural);
|
---|
121 | GLboolean crServerSupportRedirMuralFBO(void);
|
---|
122 | void crServerRedirMuralFBO(CRMuralInfo *mural, GLboolean redir);
|
---|
123 | void crServerCreateMuralFBO(CRMuralInfo *mural);
|
---|
124 | void crServerDeleteMuralFBO(CRMuralInfo *mural);
|
---|
125 | void crServerPresentFBO(CRMuralInfo *mural);
|
---|
126 | GLboolean crServerIsRedirectedToFBO();
|
---|
127 |
|
---|
128 | int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer);
|
---|
129 |
|
---|
130 | #endif /* CR_SERVER_H */
|
---|