VirtualBox

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

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

crOpenGL: fix compiz for high resolution guests

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