VirtualBox

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

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

crOpenGL: more code for multiscreen support

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