VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h@ 36231

Last change on this file since 36231 was 36052, checked in by vboxsync, 14 years ago

crOpenGL: use PBO to get texture data in offscreen rendering mode

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.3 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 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 "spu_dispatch_table.h"
16
17#include "state/cr_currentpointers.h"
18
19#include <iprt/types.h>
20#include <iprt/err.h>
21
22#include <VBox/vmm/ssm.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#define SHCROGL_SSM_VERSION 26
29
30#define CR_MAX_WINDOWS 100
31#define CR_MAX_CLIENTS 64
32
33/*@todo must match MaxGuestMonitors from SchemaDefs.h*/
34#define CR_MAX_GUEST_MONITORS 8
35
36typedef DECLCALLBACKPTR(void, PFNCRSERVERPRESENTFBO) (void *data, int32_t screenId, int32_t x, int32_t y, uint32_t w, uint32_t h);
37
38typedef struct {
39 CRrecti imagewindow; /**< coordinates in mural space */
40 CRrectf bounds; /**< normalized coordinates in [-1,-1] x [1,1] */
41 CRrecti outputwindow; /**< coordinates in server's rendering window */
42 CRrecti clippedImagewindow; /**< imagewindow clipped to current viewport */
43 CRmatrix baseProjection; /**< pre-multiplied onto projection matrix */
44 CRrecti scissorBox; /**< passed to back-end OpenGL */
45 CRrecti viewport; /**< passed to back-end OpenGL */
46 GLuint serialNo; /**< an optimization */
47} CRExtent;
48
49struct BucketingInfo;
50
51/**
52 * Mural info
53 */
54typedef struct {
55 GLuint width, height;
56 GLint gX, gY; /*guest coordinates*/
57 GLint hX, hY; /*host coordinates, screenID related*/
58
59 int spuWindow; /*the SPU's corresponding window ID */
60
61 int screenId;
62
63 GLboolean bVisible; /*guest window is visible*/
64 GLboolean bUseFBO; /*redirect to FBO instead of real host window*/
65
66 GLint cVisibleRects; /*count of visible rects*/
67 GLint *pVisibleRects; /*visible rects left, top, right, bottom*/
68 GLboolean bReceivedRects; /*indicates if guest did any updates for visible regions*/
69
70 GLuint idFBO, idColorTex, idDepthStencilRB;
71 GLuint fboWidth, fboHeight;
72 GLuint idPBO;
73} CRMuralInfo;
74
75/**
76 * A client is basically an upstream Cr Node (connected via mothership)
77 */
78typedef struct _crclient {
79 int spu_id; /**< id of the last SPU in the client's SPU chain */
80 CRConnection *conn; /**< network connection from the client */
81 int number; /**< a unique number for each client */
82 uint64_t pid; /*guest pid*/
83 GLint currentContextNumber;
84 CRContext *currentCtx;
85 GLint currentWindow;
86 CRMuralInfo *currentMural;
87 GLint windowList[CR_MAX_WINDOWS];
88 GLint contextList[CR_MAX_CONTEXTS];
89#ifdef VBOXCR_LOGFPS
90 uint64_t timeUsed;
91#endif
92} CRClient;
93
94typedef struct _crclientnode {
95 CRClient *pClient;
96 struct _crclientnode *prev, *next;
97} CRClientNode;
98
99typedef struct CRPoly_t {
100 int npoints;
101 double *points;
102 struct CRPoly_t *next;
103} CRPoly;
104
105/**
106 * There's one of these run queue entries per client
107 * The run queue is a circular, doubly-linked list of these objects.
108 */
109typedef struct RunQueue_t {
110 CRClient *client;
111 int blocked;
112 struct RunQueue_t *next;
113 struct RunQueue_t *prev;
114} RunQueue;
115
116typedef struct {
117 GLint freeWindowID;
118 GLint freeContextID;
119 GLint freeClientID;
120} CRServerFreeIDsPool_t;
121
122typedef struct {
123 int32_t x, y;
124 uint32_t w, h;
125 uint64_t winID;
126} CRScreenInfo;
127
128typedef struct {
129 unsigned short tcpip_port;
130
131 CRScreenInfo screen[CR_MAX_GUEST_MONITORS];
132 int screenCount;
133
134 int numClients;
135 CRClient *clients[CR_MAX_CLIENTS]; /**< array [numClients] */
136 CRClient *curClient;
137 CRClientNode *pCleanupClient; /*list of clients with pending clean up*/
138 CRCurrentStatePointers current;
139
140 GLboolean firstCallCreateContext;
141 GLboolean firstCallMakeCurrent;
142 GLboolean bIsInLoadingState; /* Indicates if we're in process of loading VM snapshot */
143 GLboolean bIsInSavingState; /* Indicates if we're in process of saving VM snapshot */
144 GLint currentWindow;
145 GLint currentNativeWindow;
146
147 CRHashTable *muralTable; /**< hash table where all murals are stored */
148 CRHashTable *pWindowCreateInfoTable; /**< hash table with windows creation info */
149
150 int client_spu_id;
151
152 CRServerFreeIDsPool_t idsPool;
153
154 int mtu;
155 int buffer_size;
156 char protocol[1024];
157
158 SPU *head_spu;
159 SPUDispatchTable dispatch;
160
161 CRNetworkPointer return_ptr;
162 CRNetworkPointer writeback_ptr;
163
164 CRLimitsState limits; /**< GL limits for any contexts we create */
165
166 int SpuContext; /**< Rendering context for the head SPU */
167 int SpuContextVisBits; /**< Context's visual attributes */
168 char *SpuContextDpyName; /**< Context's dpyName */
169
170 CRHashTable *contextTable; /**< hash table for rendering contexts */
171 CRHashTable *pContextCreateInfoTable; /**< hash table with contexts creation info */
172 CRContext *DummyContext; /**< used when no other bound context */
173
174 CRHashTable *programTable; /**< for vertex programs */
175 GLuint currentProgram;
176
177 /** configuration options */
178 /*@{*/
179 int useL2;
180 int ignore_papi;
181 unsigned int maxBarrierCount;
182 unsigned int clearCount;
183 int optimizeBucket;
184 int only_swap_once;
185 int debug_barriers;
186 int sharedDisplayLists;
187 int sharedTextureObjects;
188 int sharedPrograms;
189 int sharedWindows;
190 int uniqueWindows;
191 int localTileSpec;
192 int useDMX;
193 int overlapBlending;
194 int vpProjectionMatrixParameter;
195 const char *vpProjectionMatrixVariable;
196 int stereoView;
197 int vncMode; /* cmd line option */
198 /*@}*/
199 /** view_matrix config */
200 /*@{*/
201 GLboolean viewOverride;
202 CRmatrix viewMatrix[2]; /**< left and right eye */
203 /*@}*/
204 /** projection_matrix config */
205 /*@{*/
206 GLboolean projectionOverride;
207 CRmatrix projectionMatrix[2]; /**< left and right eye */
208 int currentEye;
209 /*@}*/
210
211 /** for warped tiles */
212 /*@{*/
213 GLfloat alignment_matrix[16], unnormalized_alignment_matrix[16];
214 /*@}*/
215
216 /** tile overlap/blending info - this should probably be per-mural */
217 /*@{*/
218 CRPoly **overlap_geom;
219 CRPoly *overlap_knockout;
220 float *overlap_intens;
221 int num_overlap_intens;
222 int num_overlap_levels;
223 /*@}*/
224
225 CRHashTable *barriers, *semaphores;
226
227 RunQueue *run_queue;
228
229 GLuint currentSerialNo;
230
231 PFNCRSERVERPRESENTFBO pfnPresentFBO;
232 GLboolean bForceOffscreenRendering; /*Force server to render 3d data offscreen
233 *using callback above to update vbox framebuffers*/
234 GLboolean bUsePBOForReadback; /*Use PBO's for data readback*/
235} CRServer;
236
237
238extern DECLEXPORT(void) crServerInit( int argc, char *argv[] );
239extern DECLEXPORT(int) CRServerMain( int argc, char *argv[] );
240extern DECLEXPORT(void) crServerServiceClients(void);
241extern DECLEXPORT(void) crServerAddNewClient(void);
242extern DECLEXPORT(SPU*) crServerHeadSPU(void);
243extern DECLEXPORT(void) crServerSetPort(int port);
244
245extern DECLEXPORT(GLboolean) crVBoxServerInit(void);
246extern DECLEXPORT(void) crVBoxServerTearDown(void);
247extern DECLEXPORT(int32_t) crVBoxServerAddClient(uint32_t u32ClientID);
248extern DECLEXPORT(void) crVBoxServerRemoveClient(uint32_t u32ClientID);
249extern DECLEXPORT(int32_t) crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer);
250extern DECLEXPORT(int32_t) crVBoxServerClientRead(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t *pcbBuffer);
251extern DECLEXPORT(int32_t) crVBoxServerClientSetVersion(uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor);
252extern DECLEXPORT(int32_t) crVBoxServerClientSetPID(uint32_t u32ClientID, uint64_t pid);
253
254extern DECLEXPORT(int32_t) crVBoxServerSaveState(PSSMHANDLE pSSM);
255extern DECLEXPORT(int32_t) crVBoxServerLoadState(PSSMHANDLE pSSM, uint32_t version);
256
257extern DECLEXPORT(int32_t) crVBoxServerSetScreenCount(int sCount);
258extern DECLEXPORT(int32_t) crVBoxServerUnmapScreen(int sIndex);
259extern DECLEXPORT(int32_t) crVBoxServerMapScreen(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h, uint64_t winID);
260
261extern DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, GLint *pRects);
262
263extern DECLEXPORT(void) crVBoxServerSetPresentFBOCB(PFNCRSERVERPRESENTFBO pfnPresentFBO);
264
265extern DECLEXPORT(int32_t) crVBoxServerSetOffscreenRendering(GLboolean value);
266
267#ifdef __cplusplus
268}
269#endif
270
271#endif
272
Note: See TracBrowser for help on using the repository browser.

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