VirtualBox

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

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

crOpenGL: some initial support for new multimonitor code

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