VirtualBox

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

Last change on this file since 33426 was 33319, checked in by vboxsync, 14 years ago

crOpenGL: workaround failure to load vm snapshot with changed opengl data version (#5316)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.5 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/ssm.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#define SHCROGL_SSM_VERSION 21
29
30#define CR_MAX_WINDOWS 100
31#define CR_MAX_CLIENTS 20
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
69 GLuint idFBO, idColorTex, idDepthStencilRB;
70 GLuint fboWidth, fboHeight;
71} CRMuralInfo;
72
73/**
74 * A client is basically an upstream Cr Node (connected via mothership)
75 */
76typedef struct _crclient {
77 int spu_id; /**< id of the last SPU in the client's SPU chain */
78 CRConnection *conn; /**< network connection from the client */
79 int number; /**< a unique number for each client */
80 GLint currentContextNumber;
81 CRContext *currentCtx;
82 GLint currentWindow;
83 CRMuralInfo *currentMural;
84 GLint windowList[CR_MAX_WINDOWS];
85 GLint contextList[CR_MAX_CONTEXTS];
86#ifdef VBOXCR_LOGFPS
87 uint64_t timeUsed;
88#endif
89} CRClient;
90
91typedef struct CRPoly_t {
92 int npoints;
93 double *points;
94 struct CRPoly_t *next;
95} CRPoly;
96
97/**
98 * There's one of these run queue entries per client
99 * The run queue is a circular, doubly-linked list of these objects.
100 */
101typedef struct RunQueue_t {
102 CRClient *client;
103 int blocked;
104 struct RunQueue_t *next;
105 struct RunQueue_t *prev;
106} RunQueue;
107
108typedef struct {
109 GLint freeWindowID;
110 GLint freeContextID;
111 GLint freeClientID;
112} CRServerFreeIDsPool_t;
113
114typedef struct {
115 int32_t x, y;
116 uint32_t w, h;
117 uint64_t winID;
118} CRScreenInfo;
119
120typedef struct {
121 unsigned short tcpip_port;
122
123 CRScreenInfo screen[CR_MAX_GUEST_MONITORS];
124 int screenCount;
125
126 int numClients;
127 CRClient *clients[CR_MAX_CLIENTS]; /**< array [numClients] */
128 CRClient *curClient;
129 CRCurrentStatePointers current;
130
131 GLboolean firstCallCreateContext;
132 GLboolean firstCallMakeCurrent;
133 GLboolean bIsInLoadingState; /* Indicates if we're in process of loading VM snapshot */
134 GLboolean bIsInSavingState; /* Indicates if we're in process of saving VM snapshot */
135 GLint currentWindow;
136 GLint currentNativeWindow;
137
138 CRHashTable *muralTable; /**< hash table where all murals are stored */
139 CRHashTable *pWindowCreateInfoTable; /**< hash table with windows creation info */
140
141 int client_spu_id;
142
143 CRServerFreeIDsPool_t idsPool;
144
145 int mtu;
146 int buffer_size;
147 char protocol[1024];
148
149 SPU *head_spu;
150 SPUDispatchTable dispatch;
151
152 CRNetworkPointer return_ptr;
153 CRNetworkPointer writeback_ptr;
154
155 CRLimitsState limits; /**< GL limits for any contexts we create */
156
157 int SpuContext; /**< Rendering context for the head SPU */
158 int SpuContextVisBits; /**< Context's visual attributes */
159 char *SpuContextDpyName; /**< Context's dpyName */
160
161 CRHashTable *contextTable; /**< hash table for rendering contexts */
162 CRHashTable *pContextCreateInfoTable; /**< hash table with contexts creation info */
163 CRContext *DummyContext; /**< used when no other bound context */
164
165 CRHashTable *programTable; /**< for vertex programs */
166 GLuint currentProgram;
167
168 /** configuration options */
169 /*@{*/
170 int useL2;
171 int ignore_papi;
172 unsigned int maxBarrierCount;
173 unsigned int clearCount;
174 int optimizeBucket;
175 int only_swap_once;
176 int debug_barriers;
177 int sharedDisplayLists;
178 int sharedTextureObjects;
179 int sharedPrograms;
180 int sharedWindows;
181 int uniqueWindows;
182 int localTileSpec;
183 int useDMX;
184 int overlapBlending;
185 int vpProjectionMatrixParameter;
186 const char *vpProjectionMatrixVariable;
187 int stereoView;
188 int vncMode; /* cmd line option */
189 /*@}*/
190 /** view_matrix config */
191 /*@{*/
192 GLboolean viewOverride;
193 CRmatrix viewMatrix[2]; /**< left and right eye */
194 /*@}*/
195 /** projection_matrix config */
196 /*@{*/
197 GLboolean projectionOverride;
198 CRmatrix projectionMatrix[2]; /**< left and right eye */
199 int currentEye;
200 /*@}*/
201
202 /** for warped tiles */
203 /*@{*/
204 GLfloat alignment_matrix[16], unnormalized_alignment_matrix[16];
205 /*@}*/
206
207 /** tile overlap/blending info - this should probably be per-mural */
208 /*@{*/
209 CRPoly **overlap_geom;
210 CRPoly *overlap_knockout;
211 float *overlap_intens;
212 int num_overlap_intens;
213 int num_overlap_levels;
214 /*@}*/
215
216 CRHashTable *barriers, *semaphores;
217
218 RunQueue *run_queue;
219
220 GLuint currentSerialNo;
221
222 PFNCRSERVERPRESENTFBO pfnPresentFBO;
223} CRServer;
224
225
226extern DECLEXPORT(void) crServerInit( int argc, char *argv[] );
227extern DECLEXPORT(int) CRServerMain( int argc, char *argv[] );
228extern DECLEXPORT(void) crServerServiceClients(void);
229extern DECLEXPORT(void) crServerAddNewClient(void);
230extern DECLEXPORT(SPU*) crServerHeadSPU(void);
231extern DECLEXPORT(void) crServerSetPort(int port);
232
233extern DECLEXPORT(GLboolean) crVBoxServerInit(void);
234extern DECLEXPORT(void) crVBoxServerTearDown(void);
235extern DECLEXPORT(int32_t) crVBoxServerAddClient(uint32_t u32ClientID);
236extern DECLEXPORT(void) crVBoxServerRemoveClient(uint32_t u32ClientID);
237extern DECLEXPORT(int32_t) crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer);
238extern DECLEXPORT(int32_t) crVBoxServerClientRead(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t *pcbBuffer);
239extern DECLEXPORT(int32_t) crVBoxServerClientSetVersion(uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor);
240
241extern DECLEXPORT(int32_t) crVBoxServerSaveState(PSSMHANDLE pSSM);
242extern DECLEXPORT(int32_t) crVBoxServerLoadState(PSSMHANDLE pSSM, uint32_t version);
243
244extern DECLEXPORT(int32_t) crVBoxServerSetScreenCount(int sCount);
245extern DECLEXPORT(int32_t) crVBoxServerUnmapScreen(int sIndex);
246extern DECLEXPORT(int32_t) crVBoxServerMapScreen(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h, uint64_t winID);
247
248extern DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, GLint *pRects);
249
250extern DECLEXPORT(void) crVBoxServerSetPresentFBOCB(PFNCRSERVERPRESENTFBO pfnPresentFBO);
251
252#ifdef __cplusplus
253}
254#endif
255
256#endif
257
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