VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h@ 45248

Last change on this file since 45248 was 45248, checked in by vboxsync, 12 years ago

crOpenGL/VRDP: always show 3D window unles in Headles mode

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.9 KB
Line 
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
23RT_C_DECLS_BEGIN
24
25extern uint8_t* g_pvVRamBase;
26extern uint32_t g_cbVRam;
27extern HCRHGSMICMDCOMPLETION g_hCrHgsmiCompletion;
28extern 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
33DECLINLINE(void*) crServerCrHgsmiPtrGet(VBOXVIDEOOFFSET offBuffer, uint32_t cbBuffer)
34{
35 return ((offBuffer) + (cbBuffer) <= g_cbVRam ? VBOXCRHGSMI_PTR(offBuffer, void) : NULL);
36}
37
38DECLINLINE(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 CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData); \
45 CRVBOXHGSMI_CMDDATA_RC(_pData, _rc); \
46 crServerCrHgsmiCmdComplete((_pData)->pCmd, VINF_SUCCESS); \
47 } while (0)
48
49#define VBOXCRHGSMI_CMD_CHECK_COMPLETE(_pData, _rc) do { \
50 if (CRVBOXHGSMI_CMDDATA_IS_SET(_pData)) { \
51 VBOXCRHGSMI_CMD_COMPLETE(_pData, _rc); \
52 } \
53 } while (0)
54
55#endif
56
57/*
58 * This is the base number for window and context IDs
59 */
60#define MAGIC_OFFSET 5000
61
62extern CRServer cr_server;
63
64/* Semaphore wait queue node */
65typedef struct _wqnode {
66 RunQueue *q;
67 struct _wqnode *next;
68} wqnode;
69
70typedef struct {
71 GLuint count;
72 GLuint num_waiting;
73 RunQueue **waiting;
74} CRServerBarrier;
75
76typedef struct {
77 GLuint count;
78 wqnode *waiting, *tail;
79} CRServerSemaphore;
80
81typedef struct {
82 GLuint id;
83 GLint projParamStart;
84 GLfloat projMat[16]; /* projection matrix, accumulated via calls to */
85 /* glProgramLocalParameterARB, glProgramParameterNV */
86} CRServerProgram;
87
88void crServerSetVBoxConfiguration();
89void crServerSetVBoxConfigurationHGCM();
90void crServerInitDispatch(void);
91void crServerReturnValue( const void *payload, unsigned int payload_len );
92void crServerWriteback(void);
93int crServerRecv( CRConnection *conn, CRMessage *msg, unsigned int len );
94void crServerSerializeRemoteStreams(void);
95void crServerAddToRunQueue( CRClient *client );
96void crServerDeleteClient( CRClient *client );
97
98
99void crServerApplyBaseProjection( const CRmatrix *baseProj );
100void crServerApplyViewMatrix( const CRmatrix *view );
101void crServerSetOutputBounds( const CRMuralInfo *mural, int extNum );
102void crServerComputeViewportBounds( const CRViewportState *v, CRMuralInfo *mural );
103
104GLboolean crServerInitializeBucketing(CRMuralInfo *mural);
105
106void crComputeOverlapGeom(double *quads, int nquad, CRPoly ***res);
107void crComputeKnockoutGeom(double *quads, int nquad, int my_quad_idx, CRPoly **res);
108
109int crServerGetCurrentEye(void);
110
111GLboolean crServerClientInBeginEnd(const CRClient *client);
112
113GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID);
114GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID);
115GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID);
116void crServerMuralTerm(CRMuralInfo *mural);
117void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height);
118int crServerMuralSynchRootVr(CRMuralInfo *mural, uint32_t *pcRects, const RTRECT **ppRects);
119
120GLint crServerGenerateID(GLint *pCounter);
121
122GLint crServerSPUWindowID(GLint serverWindow);
123
124GLuint crServerTranslateProgramID(GLuint id);
125
126CRMuralInfo * crServerGetDummyMural(GLint visualBits);
127
128void crServerSetupOutputRedirect(CRMuralInfo *mural);
129void crServerCheckMuralGeometry(CRMuralInfo *mural);
130GLboolean crServerSupportRedirMuralFBO(void);
131
132#define CR_SERVER_REDIR_F_NONE 0x00
133/* the data should be displayed on host (unset when is on or when CR_SERVER_REDIR_F_FBO_RAM_VMFB is set) */
134#define CR_SERVER_REDIR_F_DISPLAY 0x01
135/* guest window data get redirected to FBO on host */
136#define CR_SERVER_REDIR_F_FBO 0x02
137/* used with CR_SERVER_REDIR_F_FBO only
138 * makes a separate texture to be used for maintaining the window framebuffer presented data */
139#define CR_SERVER_REDIR_F_FBO_VMFB_TEX 0x04
140/* used with CR_SERVER_REDIR_F_FBO only
141 * indicates that FBO data should be copied to RAM for further processing */
142#define CR_SERVER_REDIR_F_FBO_RAM 0x08
143/* used with CR_SERVER_REDIR_F_FBO_RAM only
144 * indicates that FBO data should be passed to VRDP backend */
145#define CR_SERVER_REDIR_F_FBO_RAM_VRDP 0x10
146/* used with CR_SERVER_REDIR_F_FBO_RAM only
147 * indicates that FBO data should be passed to VM Framebuffer */
148#define CR_SERVER_REDIR_F_FBO_RAM_VMFB 0x20
149
150#define CR_SERVER_REDIR_F_ALL 0x3f
151
152#define CR_SERVER_REDIR_FGROUP_REQUIRE_FBO (CR_SERVER_REDIR_F_ALL & ~CR_SERVER_REDIR_F_DISPLAY)
153#define CR_SERVER_REDIR_FGROUP_REQUIRE_FBO_RAM (CR_SERVER_REDIR_F_FBO_RAM_VRDP | CR_SERVER_REDIR_F_FBO_RAM_VMFB)
154
155DECLINLINE(GLuint) crServerRedirModeAdjust(GLuint value)
156{
157 /* sanitize values */
158 value &= CR_SERVER_REDIR_F_ALL;
159
160 if (value & CR_SERVER_REDIR_FGROUP_REQUIRE_FBO)
161 value |= CR_SERVER_REDIR_F_FBO;
162 if (value & CR_SERVER_REDIR_FGROUP_REQUIRE_FBO_RAM)
163 value |= CR_SERVER_REDIR_F_FBO_RAM;
164
165 return value;
166}
167
168int32_t crServerSetOffscreenRenderingMode(GLuint value);
169void crServerRedirMuralFBO(CRMuralInfo *mural, GLuint redir);
170void crServerEnableDisplayMuralFBO(CRMuralInfo *mural, GLboolean fEnable);
171void crServerDeleteMuralFBO(CRMuralInfo *mural);
172void crServerPresentFBO(CRMuralInfo *mural);
173GLboolean crServerIsRedirectedToFBO();
174GLuint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer);
175void crServerMuralFBOSwapBuffers(CRMuralInfo *mural);
176
177void crServerVBoxCompositionDisableEnter(CRMuralInfo *mural);
178void crServerVBoxCompositionDisableLeave(CRMuralInfo *mural, GLboolean fForcePresentOnEnabled);
179void crServerVBoxCompositionPresent(CRMuralInfo *mural);
180DECLINLINE(GLboolean) crServerVBoxCompositionPresentNeeded(CRMuralInfo *mural)
181{
182 return mural->bVisible
183 && mural->width
184 && mural->height
185 && !mural->fRootVrOn ? CrVrScrCompositorEntryIsInList(&mural->CEntry) : CrVrScrCompositorEntryIsInList(&mural->RootVrCEntry);
186}
187
188#define CR_SERVER_FBO_BB_IDX(_mural) ((_mural)->iBbBuffer)
189#define CR_SERVER_FBO_FB_IDX(_mural) (((_mural)->iBbBuffer + 1) % ((_mural)->cBuffers))
190
191int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer);
192
193PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen);
194
195void crServerPerformMakeCurrent( CRMuralInfo *mural, CRContextInfo *ctxInfo );
196
197RT_C_DECLS_END
198
199#endif /* CR_SERVER_H */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette