VirtualBox

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

Last change on this file since 24107 was 21990, checked in by vboxsync, 15 years ago

crOpenGL: fix 3d failure after snapshot loading

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.6 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 CR_MAX_WINDOWS 100
29#define CR_MAX_CLIENTS 20
30
31typedef struct {
32 CRrecti imagewindow; /**< coordinates in mural space */
33 CRrectf bounds; /**< normalized coordinates in [-1,-1] x [1,1] */
34 CRrecti outputwindow; /**< coordinates in server's rendering window */
35 CRrecti clippedImagewindow; /**< imagewindow clipped to current viewport */
36 CRmatrix baseProjection; /**< pre-multiplied onto projection matrix */
37 CRrecti scissorBox; /**< passed to back-end OpenGL */
38 CRrecti viewport; /**< passed to back-end OpenGL */
39 GLuint serialNo; /**< an optimization */
40} CRExtent;
41
42struct BucketingInfo;
43
44/**
45 * Mural info
46 */
47typedef struct {
48 int width, height;
49 CRrecti imagespace; /**< the whole mural rectangle */
50 int curExtent;
51 int numExtents; /**< number of tiles */
52 CRExtent extents[CR_MAX_EXTENTS]; /**< per-tile info */
53 int maxTileHeight; /**< the tallest tile's height */
54
55 /** optimized, hash-based tile bucketing */
56 int optimizeBucket;
57 struct BucketingInfo *bucketInfo;
58
59 unsigned int underlyingDisplay[4]; /**< needed for laying out the extents */
60
61 GLboolean viewportValidated;
62
63 int spuWindow; /**< the SPU's corresponding window ID */
64} CRMuralInfo;
65
66/**
67 * A client is basically an upstream Cr Node (connected via mothership)
68 */
69typedef struct _crclient {
70 int spu_id; /**< id of the last SPU in the client's SPU chain */
71 CRConnection *conn; /**< network connection from the client */
72 int number; /**< a unique number for each client */
73 GLint currentContextNumber;
74 CRContext *currentCtx;
75 GLint currentWindow;
76 CRMuralInfo *currentMural;
77 GLint windowList[CR_MAX_WINDOWS];
78 GLint contextList[CR_MAX_CONTEXTS];
79} CRClient;
80
81
82typedef struct CRPoly_t {
83 int npoints;
84 double *points;
85 struct CRPoly_t *next;
86} CRPoly;
87
88/**
89 * There's one of these run queue entries per client
90 * The run queue is a circular, doubly-linked list of these objects.
91 */
92typedef struct RunQueue_t {
93 CRClient *client;
94 int blocked;
95 struct RunQueue_t *next;
96 struct RunQueue_t *prev;
97} RunQueue;
98
99typedef struct {
100 GLint freeWindowID;
101 GLint freeContextID;
102 GLint freeClientID;
103} CRServerFreeIDsPool_t;
104
105typedef struct {
106 unsigned short tcpip_port;
107
108 int numClients;
109 CRClient *clients[CR_MAX_CLIENTS]; /**< array [numClients] */
110 CRClient *curClient;
111 CRCurrentStatePointers current;
112
113 GLboolean firstCallCreateContext;
114 GLboolean firstCallMakeCurrent;
115 GLboolean bIsInLoadingState; /* Indicates if we're in process of loading VM snapshot */
116 GLboolean bIsInSavingState; /* Indicates if we're in process of saving VM snapshot */
117 GLint currentWindow;
118 GLint currentNativeWindow;
119
120 CRHashTable *muralTable; /**< hash table where all murals are stored */
121 CRHashTable *pWindowCreateInfoTable; /**< hash table with windows creation info */
122
123 int client_spu_id;
124
125 CRServerFreeIDsPool_t idsPool;
126
127 int mtu;
128 int buffer_size;
129 char protocol[1024];
130
131 SPU *head_spu;
132 SPUDispatchTable dispatch;
133
134 CRNetworkPointer return_ptr;
135 CRNetworkPointer writeback_ptr;
136
137 CRLimitsState limits; /**< GL limits for any contexts we create */
138
139 int SpuContext; /**< Rendering context for the head SPU */
140 int SpuContextVisBits; /**< Context's visual attributes */
141 char *SpuContextDpyName; /**< Context's dpyName */
142
143 CRHashTable *contextTable; /**< hash table for rendering contexts */
144 CRHashTable *pContextCreateInfoTable; /**< hash table with contexts creation info */
145 CRContext *DummyContext; /**< used when no other bound context */
146
147 CRHashTable *programTable; /**< for vertex programs */
148 GLuint currentProgram;
149
150 /** configuration options */
151 /*@{*/
152 int useL2;
153 int ignore_papi;
154 unsigned int maxBarrierCount;
155 unsigned int clearCount;
156 int optimizeBucket;
157 int only_swap_once;
158 int debug_barriers;
159 int sharedDisplayLists;
160 int sharedTextureObjects;
161 int sharedPrograms;
162 int sharedWindows;
163 int uniqueWindows;
164 int localTileSpec;
165 int useDMX;
166 int overlapBlending;
167 int vpProjectionMatrixParameter;
168 const char *vpProjectionMatrixVariable;
169 int stereoView;
170 int vncMode; /* cmd line option */
171 /*@}*/
172 /** view_matrix config */
173 /*@{*/
174 GLboolean viewOverride;
175 CRmatrix viewMatrix[2]; /**< left and right eye */
176 /*@}*/
177 /** projection_matrix config */
178 /*@{*/
179 GLboolean projectionOverride;
180 CRmatrix projectionMatrix[2]; /**< left and right eye */
181 int currentEye;
182 /*@}*/
183
184 /** for warped tiles */
185 /*@{*/
186 GLfloat alignment_matrix[16], unnormalized_alignment_matrix[16];
187 /*@}*/
188
189 /** tile overlap/blending info - this should probably be per-mural */
190 /*@{*/
191 CRPoly **overlap_geom;
192 CRPoly *overlap_knockout;
193 float *overlap_intens;
194 int num_overlap_intens;
195 int num_overlap_levels;
196 /*@}*/
197
198 CRHashTable *barriers, *semaphores;
199
200 RunQueue *run_queue;
201
202 GLuint currentSerialNo;
203} CRServer;
204
205
206extern DECLEXPORT(void) crServerInit( int argc, char *argv[] );
207extern DECLEXPORT(int) CRServerMain( int argc, char *argv[] );
208extern DECLEXPORT(void) crServerServiceClients(void);
209extern DECLEXPORT(void) crServerAddNewClient(void);
210extern DECLEXPORT(SPU*) crServerHeadSPU(void);
211extern DECLEXPORT(void) crServerSetPort(int port);
212
213extern DECLEXPORT(GLboolean) crVBoxServerInit(void);
214extern DECLEXPORT(void) crVBoxServerTearDown(void);
215extern DECLEXPORT(int32_t) crVBoxServerAddClient(uint32_t u32ClientID);
216extern DECLEXPORT(void) crVBoxServerRemoveClient(uint32_t u32ClientID);
217extern DECLEXPORT(int32_t) crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t cbBuffer);
218extern DECLEXPORT(int32_t) crVBoxServerClientRead(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t *pcbBuffer);
219extern DECLEXPORT(int32_t) crVBoxServerClientSetVersion(uint32_t u32ClientID, uint32_t vMajor, uint32_t vMinor);
220
221extern DECLEXPORT(int32_t) crVBoxServerSaveState(PSSMHANDLE pSSM);
222extern DECLEXPORT(int32_t) crVBoxServerLoadState(PSSMHANDLE pSSM, uint32_t version);
223#ifdef __cplusplus
224}
225#endif
226
227#endif
228
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