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 CR_RENDERSPU_H
|
---|
8 | #define CR_RENDERSPU_H
|
---|
9 |
|
---|
10 | #ifdef WINDOWS
|
---|
11 | #define WIN32_LEAN_AND_MEAN
|
---|
12 | #include <windows.h>
|
---|
13 | #define RENDER_APIENTRY __stdcall
|
---|
14 | #define snprintf _snprintf
|
---|
15 | #elif defined(DARWIN)
|
---|
16 | # ifndef VBOX_WITH_COCOA_QT
|
---|
17 | # include <AGL/AGL.h>
|
---|
18 | # else
|
---|
19 | # include "renderspu_cocoa_helper.h"
|
---|
20 | # endif
|
---|
21 | #define RENDER_APIENTRY
|
---|
22 | #else
|
---|
23 | #include <GL/glx.h>
|
---|
24 | #define RENDER_APIENTRY
|
---|
25 | #endif
|
---|
26 | #include "cr_threads.h"
|
---|
27 | #include "cr_spu.h"
|
---|
28 | #include "cr_hash.h"
|
---|
29 | #include "cr_server.h"
|
---|
30 | #include "cr_blitter.h"
|
---|
31 | #include "cr_compositor.h"
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/critsect.h>
|
---|
35 | #if defined(GLX) /* @todo: unify windows and glx thread creation code */
|
---|
36 | #include <iprt/thread.h>
|
---|
37 | #include <iprt/semaphore.h>
|
---|
38 |
|
---|
39 | /* special window id used for representing the command window CRWindowInfo */
|
---|
40 | #define CR_RENDER_WINCMD_ID (INT32_MAX-2)
|
---|
41 | AssertCompile(CR_RENDER_WINCMD_ID != CR_RENDER_DEFAULT_WINDOW_ID);
|
---|
42 | /* CRHashTable is using unsigned long keys, we use it to trore X Window -> CRWindowInfo association */
|
---|
43 | AssertCompile(sizeof (Window) == sizeof (unsigned long));
|
---|
44 | #endif
|
---|
45 |
|
---|
46 |
|
---|
47 | #define MAX_VISUALS 32
|
---|
48 |
|
---|
49 | #ifdef RT_OS_DARWIN
|
---|
50 | # ifndef VBOX_WITH_COCOA_QT
|
---|
51 | enum
|
---|
52 | {
|
---|
53 | /* Event classes */
|
---|
54 | kEventClassVBox = 'vbox',
|
---|
55 | /* Event kinds */
|
---|
56 | kEventVBoxShowWindow = 'swin',
|
---|
57 | kEventVBoxHideWindow = 'hwin',
|
---|
58 | kEventVBoxMoveWindow = 'mwin',
|
---|
59 | kEventVBoxResizeWindow = 'rwin',
|
---|
60 | kEventVBoxDisposeWindow = 'dwin',
|
---|
61 | kEventVBoxUpdateDock = 'udck',
|
---|
62 | kEventVBoxUpdateContext = 'uctx',
|
---|
63 | kEventVBoxBoundsChanged = 'bchg'
|
---|
64 | };
|
---|
65 | pascal OSStatus windowEvtHndlr(EventHandlerCallRef myHandler, EventRef event, void* userData);
|
---|
66 | # endif
|
---|
67 | #endif /* RT_OS_DARWIN */
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Visual info
|
---|
71 | */
|
---|
72 | typedef struct {
|
---|
73 | GLbitfield visAttribs;
|
---|
74 | const char *displayName;
|
---|
75 | #if defined(WINDOWS)
|
---|
76 | // HDC device_context;
|
---|
77 | #elif defined(DARWIN)
|
---|
78 | # ifndef VBOX_WITH_COCOA_QT
|
---|
79 | WindowRef window;
|
---|
80 | # endif
|
---|
81 | #elif defined(GLX)
|
---|
82 | Display *dpy;
|
---|
83 | XVisualInfo *visual;
|
---|
84 | #ifdef GLX_VERSION_1_3
|
---|
85 | GLXFBConfig fbconfig;
|
---|
86 | #endif /* GLX_VERSION_1_3 */
|
---|
87 | #endif
|
---|
88 | } VisualInfo;
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Window info
|
---|
92 | */
|
---|
93 | typedef struct WindowInfo {
|
---|
94 | int x, y;
|
---|
95 | // int width, height;
|
---|
96 | // int id; /**< integer window ID */
|
---|
97 | CR_BLITTER_WINDOW BltInfo;
|
---|
98 |
|
---|
99 | VisualInfo *visual;
|
---|
100 |
|
---|
101 | volatile uint32_t cRefs;
|
---|
102 |
|
---|
103 | GLboolean mapPending;
|
---|
104 | GLboolean visible;
|
---|
105 | GLboolean everCurrent; /**< has this window ever been bound? */
|
---|
106 | char *title;
|
---|
107 |
|
---|
108 | const VBOXVR_SCR_COMPOSITOR *pCompositor;
|
---|
109 | /* the composotor lock is used to synchronize the current compositor access,
|
---|
110 | * i.e. the compositor can be accessed by a gui refraw thread,
|
---|
111 | * while chromium thread might try to set a new compositor
|
---|
112 | * note that the compositor internally has its own lock to be used for accessing its data
|
---|
113 | * see CrVrScrCompositorLock/Unlock; renderspu and crserverlib would use it for compositor data access */
|
---|
114 | RTCRITSECT CompositorLock;
|
---|
115 | PCR_BLITTER pBlitter;
|
---|
116 | #if defined(WINDOWS)
|
---|
117 | HDC nativeWindow; /**< for render_to_app_window */
|
---|
118 | HWND hWnd;
|
---|
119 | HDC device_context;
|
---|
120 | HDC redraw_device_context;
|
---|
121 | HRGN hRgn;
|
---|
122 | #elif defined(DARWIN)
|
---|
123 | # ifndef VBOX_WITH_COCOA_QT
|
---|
124 | WindowRef window;
|
---|
125 | WindowRef nativeWindow; /**< for render_to_app_window */
|
---|
126 | WindowRef appWindow;
|
---|
127 | EventHandlerUPP event_handler;
|
---|
128 | GLint bufferName;
|
---|
129 | AGLContext dummyContext;
|
---|
130 | RgnHandle hVisibleRegion;
|
---|
131 | /* unsigned long context_ptr; */
|
---|
132 | # else
|
---|
133 | NativeNSViewRef window;
|
---|
134 | NativeNSViewRef nativeWindow; /**< for render_to_app_window */
|
---|
135 | NativeNSOpenGLContextRef *currentCtx;
|
---|
136 | # endif
|
---|
137 | #elif defined(GLX)
|
---|
138 | Window window;
|
---|
139 | Window nativeWindow; /**< for render_to_app_window */
|
---|
140 | Window appWindow; /**< Same as nativeWindow but for garbage collections purposes */
|
---|
141 | #endif
|
---|
142 | int nvSwapGroup;
|
---|
143 |
|
---|
144 | #ifdef USE_OSMESA
|
---|
145 | GLubyte *buffer; /**< for rendering to off screen buffer. */
|
---|
146 | int in_buffer_width;
|
---|
147 | int in_buffer_height;
|
---|
148 | #endif
|
---|
149 |
|
---|
150 | } WindowInfo;
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * Context Info
|
---|
154 | */
|
---|
155 | typedef struct _ContextInfo {
|
---|
156 | // int id; /**< integer context ID */
|
---|
157 | CR_BLITTER_CONTEXT BltInfo;
|
---|
158 | VisualInfo *visual;
|
---|
159 | GLboolean everCurrent;
|
---|
160 | GLboolean haveWindowPosARB;
|
---|
161 | WindowInfo *currentWindow;
|
---|
162 | #if defined(WINDOWS)
|
---|
163 | HGLRC hRC;
|
---|
164 | #elif defined(DARWIN)
|
---|
165 | # ifndef VBOX_WITH_COCOA_QT
|
---|
166 | AGLContext context;
|
---|
167 | # else
|
---|
168 | NativeNSOpenGLContextRef context;
|
---|
169 | # endif
|
---|
170 | #elif defined(GLX)
|
---|
171 | GLXContext context;
|
---|
172 | #endif
|
---|
173 | struct _ContextInfo *shared;
|
---|
174 | char *extensionString;
|
---|
175 | volatile uint32_t cRefs;
|
---|
176 | } ContextInfo;
|
---|
177 |
|
---|
178 | /**
|
---|
179 | * Barrier info
|
---|
180 | */
|
---|
181 | typedef struct {
|
---|
182 | CRbarrier barrier;
|
---|
183 | GLuint count;
|
---|
184 | } Barrier;
|
---|
185 |
|
---|
186 | #ifdef GLX
|
---|
187 | typedef enum
|
---|
188 | {
|
---|
189 | CR_RENDER_WINCMD_TYPE_UNDEFINED = 0,
|
---|
190 | /* create the window (not used for now) */
|
---|
191 | CR_RENDER_WINCMD_TYPE_WIN_CREATE,
|
---|
192 | /* destroy the window (not used for now) */
|
---|
193 | CR_RENDER_WINCMD_TYPE_WIN_DESTROY,
|
---|
194 | /* notify the WinCmd thread about window creation */
|
---|
195 | CR_RENDER_WINCMD_TYPE_WIN_ON_CREATE,
|
---|
196 | /* notify the WinCmd thread about window destroy */
|
---|
197 | CR_RENDER_WINCMD_TYPE_WIN_ON_DESTROY,
|
---|
198 | /* nop used to synchronize with the WinCmd thread */
|
---|
199 | CR_RENDER_WINCMD_TYPE_NOP,
|
---|
200 | /* exit Win Cmd thread */
|
---|
201 | CR_RENDER_WINCMD_TYPE_EXIT,
|
---|
202 | } CR_RENDER_WINCMD_TYPE;
|
---|
203 |
|
---|
204 | typedef struct CR_RENDER_WINCMD
|
---|
205 | {
|
---|
206 | /* command type */
|
---|
207 | CR_RENDER_WINCMD_TYPE enmCmd;
|
---|
208 | /* command result */
|
---|
209 | int rc;
|
---|
210 | /* valid for WIN_CREATE & WIN_DESTROY only */
|
---|
211 | WindowInfo *pWindow;
|
---|
212 | } CR_RENDER_WINCMD, *PCR_RENDER_WINCMD;
|
---|
213 | #endif
|
---|
214 |
|
---|
215 | #ifdef RT_OS_DARWIN
|
---|
216 | typedef void (*PFNDELETE_OBJECT)(GLhandleARB obj);
|
---|
217 | typedef void (*PFNGET_ATTACHED_OBJECTS)( GLhandleARB containerObj, GLsizei maxCount, GLsizei * count, GLhandleARB * obj );
|
---|
218 | typedef GLhandleARB (*PFNGET_HANDLE)(GLenum pname);
|
---|
219 | typedef void (*PFNGET_INFO_LOG)( GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog );
|
---|
220 | typedef void (*PFNGET_OBJECT_PARAMETERFV)( GLhandleARB obj, GLenum pname, GLfloat * params );
|
---|
221 | typedef void (*PFNGET_OBJECT_PARAMETERIV)( GLhandleARB obj, GLenum pname, GLint * params );
|
---|
222 | #endif
|
---|
223 |
|
---|
224 | typedef DECLCALLBACKPTR(void, PFNVCRSERVER_CLIENT_CALLOUT_CB)(void *pvCb);
|
---|
225 | typedef DECLCALLBACKPTR(void, PFNVCRSERVER_CLIENT_CALLOUT)(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void*pvCb);
|
---|
226 |
|
---|
227 |
|
---|
228 | /**
|
---|
229 | * Renderspu state info
|
---|
230 | */
|
---|
231 | typedef struct {
|
---|
232 | SPUDispatchTable self;
|
---|
233 | int id;
|
---|
234 |
|
---|
235 | /** config options */
|
---|
236 | /*@{*/
|
---|
237 | char *window_title;
|
---|
238 | int defaultX, defaultY;
|
---|
239 | unsigned int defaultWidth, defaultHeight;
|
---|
240 | int default_visual;
|
---|
241 | int use_L2;
|
---|
242 | int fullscreen, ontop;
|
---|
243 | char display_string[100];
|
---|
244 | #if defined(GLX)
|
---|
245 | int try_direct;
|
---|
246 | int force_direct;
|
---|
247 | int sync;
|
---|
248 | #endif
|
---|
249 | int render_to_app_window;
|
---|
250 | int render_to_crut_window;
|
---|
251 | int crut_drawable;
|
---|
252 | int resizable;
|
---|
253 | int use_lut8, lut8[3][256];
|
---|
254 | int borderless;
|
---|
255 | int nvSwapGroup;
|
---|
256 | int ignore_papi;
|
---|
257 | int ignore_window_moves;
|
---|
258 | int pbufferWidth, pbufferHeight;
|
---|
259 | int use_glxchoosevisual;
|
---|
260 | int draw_bbox;
|
---|
261 | /*@}*/
|
---|
262 |
|
---|
263 | CRServer *server;
|
---|
264 | int gather_port;
|
---|
265 | int gather_userbuf_size;
|
---|
266 | CRConnection **gather_conns;
|
---|
267 |
|
---|
268 | GLint drawCursor;
|
---|
269 | GLint cursorX, cursorY;
|
---|
270 |
|
---|
271 | int numVisuals;
|
---|
272 | VisualInfo visuals[MAX_VISUALS];
|
---|
273 |
|
---|
274 | CRHashTable *windowTable;
|
---|
275 | CRHashTable *contextTable;
|
---|
276 |
|
---|
277 | CRHashTable *dummyWindowTable;
|
---|
278 |
|
---|
279 | ContextInfo *defaultSharedContext;
|
---|
280 |
|
---|
281 | #ifndef CHROMIUM_THREADSAFE
|
---|
282 | ContextInfo *currentContext;
|
---|
283 | #endif
|
---|
284 |
|
---|
285 | crOpenGLInterface ws; /**< Window System interface */
|
---|
286 |
|
---|
287 | CRHashTable *barrierHash;
|
---|
288 |
|
---|
289 | int is_swap_master, num_swap_clients;
|
---|
290 | int swap_mtu;
|
---|
291 | char *swap_master_url;
|
---|
292 | CRConnection **swap_conns;
|
---|
293 |
|
---|
294 | SPUDispatchTable blitterDispatch;
|
---|
295 | CRHashTable *blitterTable;
|
---|
296 |
|
---|
297 | PFNVCRSERVER_CLIENT_CALLOUT pfnClientCallout;
|
---|
298 |
|
---|
299 | #ifdef USE_OSMESA
|
---|
300 | /** Off screen rendering hooks. */
|
---|
301 | int use_osmesa;
|
---|
302 |
|
---|
303 | OSMesaContext (*OSMesaCreateContext)( GLenum format, OSMesaContext sharelist );
|
---|
304 | GLboolean (* OSMesaMakeCurrent)( OSMesaContext ctx,
|
---|
305 | GLubyte *buffer,
|
---|
306 | GLenum type,
|
---|
307 | GLsizei width,
|
---|
308 | GLsizei height );
|
---|
309 | void (*OSMesaDestroyContext)( OSMesaContext ctx );
|
---|
310 | #endif
|
---|
311 |
|
---|
312 | #if defined(GLX)
|
---|
313 | RTTHREAD hWinCmdThread;
|
---|
314 | VisualInfo WinCmdVisual;
|
---|
315 | WindowInfo WinCmdWindow;
|
---|
316 | RTSEMEVENT hWinCmdCompleteEvent;
|
---|
317 | /* display connection used to send data to the WinCmd thread */
|
---|
318 | Display *pCommunicationDisplay;
|
---|
319 | Atom WinCmdAtom;
|
---|
320 | /* X Window -> CRWindowInfo table */
|
---|
321 | CRHashTable *pWinToInfoTable;
|
---|
322 | #endif
|
---|
323 |
|
---|
324 | #ifdef RT_OS_WINDOWS
|
---|
325 | DWORD dwWinThreadId;
|
---|
326 | HANDLE hWinThreadReadyEvent;
|
---|
327 | #endif
|
---|
328 |
|
---|
329 | #ifdef RT_OS_DARWIN
|
---|
330 | # ifdef VBOX_WITH_COCOA_QT
|
---|
331 | PFNDELETE_OBJECT pfnDeleteObject;
|
---|
332 | PFNGET_ATTACHED_OBJECTS pfnGetAttachedObjects;
|
---|
333 | PFNGET_HANDLE pfnGetHandle;
|
---|
334 | PFNGET_INFO_LOG pfnGetInfoLog;
|
---|
335 | PFNGET_OBJECT_PARAMETERFV pfnGetObjectParameterfv;
|
---|
336 | PFNGET_OBJECT_PARAMETERIV pfnGetObjectParameteriv;
|
---|
337 |
|
---|
338 | CR_GLSL_CACHE GlobalShaders;
|
---|
339 | # else
|
---|
340 | RgnHandle hRootVisibleRegion;
|
---|
341 | RTSEMFASTMUTEX syncMutex;
|
---|
342 | EventHandlerUPP hParentEventHandler;
|
---|
343 | WindowGroupRef pParentGroup;
|
---|
344 | WindowGroupRef pMasterGroup;
|
---|
345 | GLint currentBufferName;
|
---|
346 | uint64_t uiDockUpdateTS;
|
---|
347 | bool fInit;
|
---|
348 | # endif
|
---|
349 | #endif /* RT_OS_DARWIN */
|
---|
350 | } RenderSPU;
|
---|
351 |
|
---|
352 | #ifdef RT_OS_WINDOWS
|
---|
353 |
|
---|
354 | /* Asks window thread to create new window.
|
---|
355 | msg.lParam - holds pointer to CREATESTRUCT structure
|
---|
356 | note that lpCreateParams is used to specify address to store handle of created window
|
---|
357 | msg.wParam - unused, should be NULL
|
---|
358 | */
|
---|
359 | #define WM_VBOX_RENDERSPU_CREATE_WINDOW (WM_APP+1)
|
---|
360 |
|
---|
361 | typedef struct _VBOX_RENDERSPU_DESTROY_WINDOW {
|
---|
362 | HWND hWnd; /* handle to window to destroy */
|
---|
363 | } VBOX_RENDERSPU_DESTROY_WINDOW;
|
---|
364 |
|
---|
365 | /* Asks window thread to destroy previously created window.
|
---|
366 | msg.lParam - holds pointer to RENDERSPU_VBOX_WINDOW_DESTROY structure
|
---|
367 | msg.wParam - unused, should be NULL
|
---|
368 | */
|
---|
369 | #define WM_VBOX_RENDERSPU_DESTROY_WINDOW (WM_APP+2)
|
---|
370 |
|
---|
371 | #endif
|
---|
372 |
|
---|
373 | extern RenderSPU render_spu;
|
---|
374 |
|
---|
375 | /* @todo remove this hack */
|
---|
376 | extern uint64_t render_spu_parent_window_id;
|
---|
377 |
|
---|
378 | #ifdef CHROMIUM_THREADSAFE
|
---|
379 | extern CRtsd _RenderTSD;
|
---|
380 | #define GET_CONTEXT_VAL() ((ContextInfo *) crGetTSD(&_RenderTSD))
|
---|
381 | #define SET_CONTEXT_VAL(_v) do { \
|
---|
382 | crSetTSD(&_RenderTSD, (_v)); \
|
---|
383 | } while (0)
|
---|
384 | #else
|
---|
385 | #define GET_CONTEXT_VAL() (render_spu.currentContext)
|
---|
386 | #define SET_CONTEXT_VAL(_v) do { \
|
---|
387 | render_spu.currentContext = (_v); \
|
---|
388 | } while (0)
|
---|
389 |
|
---|
390 | #endif
|
---|
391 |
|
---|
392 | #define GET_CONTEXT(T) ContextInfo *T = GET_CONTEXT_VAL()
|
---|
393 |
|
---|
394 |
|
---|
395 | extern void renderspuSetDefaultSharedContext(ContextInfo *pCtx);
|
---|
396 | extern void renderspuSetVBoxConfiguration( RenderSPU *spu );
|
---|
397 | extern void renderspuMakeVisString( GLbitfield visAttribs, char *s );
|
---|
398 | extern VisualInfo *renderspuFindVisual(const char *displayName, GLbitfield visAttribs );
|
---|
399 | extern GLboolean renderspu_SystemInitVisual( VisualInfo *visual );
|
---|
400 | extern GLboolean renderspu_SystemCreateContext( VisualInfo *visual, ContextInfo *context, ContextInfo *sharedContext );
|
---|
401 | extern void renderspu_SystemDestroyContext( ContextInfo *context );
|
---|
402 | extern GLboolean renderspu_SystemCreateWindow( VisualInfo *visual, GLboolean showIt, WindowInfo *window );
|
---|
403 | extern GLboolean renderspu_SystemVBoxCreateWindow( VisualInfo *visual, GLboolean showIt, WindowInfo *window );
|
---|
404 | extern void renderspu_SystemDestroyWindow( WindowInfo *window );
|
---|
405 | extern void renderspu_SystemWindowSize( WindowInfo *window, GLint w, GLint h );
|
---|
406 | extern void renderspu_SystemGetWindowGeometry( WindowInfo *window, GLint *x, GLint *y, GLint *w, GLint *h );
|
---|
407 | extern void renderspu_SystemGetMaxWindowSize( WindowInfo *window, GLint *w, GLint *h );
|
---|
408 | extern void renderspu_SystemWindowPosition( WindowInfo *window, GLint x, GLint y );
|
---|
409 | extern void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects);
|
---|
410 | extern GLboolean renderspu_SystemWindowNeedEmptyPresent(WindowInfo *window);
|
---|
411 | extern int renderspu_SystemInit();
|
---|
412 | extern int renderspu_SystemTerm();
|
---|
413 | extern void renderspu_SystemDefaultSharedContextChanged(ContextInfo *fromContext, ContextInfo *toContext);
|
---|
414 | extern void renderspu_SystemShowWindow( WindowInfo *window, GLboolean showIt );
|
---|
415 | extern void renderspu_SystemMakeCurrent( WindowInfo *window, GLint windowInfor, ContextInfo *context );
|
---|
416 | extern void renderspu_SystemSwapBuffers( WindowInfo *window, GLint flags );
|
---|
417 | extern void renderspu_SystemReparentWindow(WindowInfo *window);
|
---|
418 | extern void renderspu_SystemVBoxPresentComposition( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry );
|
---|
419 | uint32_t renderspu_SystemPostprocessFunctions(SPUNamedFunctionTable *aFunctions, uint32_t cFunctions, uint32_t cTable);
|
---|
420 | extern void renderspu_GCWindow(void);
|
---|
421 | extern int renderspuCreateFunctions( SPUNamedFunctionTable table[] );
|
---|
422 | extern GLboolean renderspuVBoxCompositorSet( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor);
|
---|
423 | extern void renderspuVBoxCompositorClearAll();
|
---|
424 | extern int renderspuVBoxCompositorLock(WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR **ppCompositor);
|
---|
425 | extern int renderspuVBoxCompositorUnlock(WindowInfo *window);
|
---|
426 | extern const struct VBOXVR_SCR_COMPOSITOR * renderspuVBoxCompositorAcquire( WindowInfo *window);
|
---|
427 | extern int renderspuVBoxCompositorTryAcquire(WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR **ppCompositor);
|
---|
428 | extern void renderspuVBoxCompositorRelease( WindowInfo *window);
|
---|
429 | extern void renderspuVBoxPresentCompositionGeneric( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor,
|
---|
430 | const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry, int32_t i32MakeCurrentUserData,
|
---|
431 | bool fRedraw);
|
---|
432 | extern PCR_BLITTER renderspuVBoxPresentBlitterGet( WindowInfo *window );
|
---|
433 | void renderspuVBoxPresentBlitterCleanup( WindowInfo *window );
|
---|
434 | extern int renderspuVBoxPresentBlitterEnter( PCR_BLITTER pBlitter, int32_t i32MakeCurrentUserData );
|
---|
435 | extern PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData, bool fRedraw );
|
---|
436 | extern PCR_BLITTER renderspuVBoxPresentBlitterEnsureCreated( WindowInfo *window, int32_t i32MakeCurrentUserData );
|
---|
437 | WindowInfo* renderspuWinCreate(GLint visBits, GLint id);
|
---|
438 | void renderspuWinTermOnShutdown(WindowInfo *window);
|
---|
439 | void renderspuWinTerm( WindowInfo *window );
|
---|
440 | void renderspuWinCleanup(WindowInfo *window);
|
---|
441 | void renderspuWinDestroy(WindowInfo *window);
|
---|
442 | GLboolean renderspuWinInitWithVisual( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id );
|
---|
443 | GLboolean renderspuWinInit(WindowInfo *pWindow, const char *dpyName, GLint visBits, GLint id);
|
---|
444 |
|
---|
445 | DECLINLINE(void) renderspuWinRetain(WindowInfo *window)
|
---|
446 | {
|
---|
447 | ASMAtomicIncU32(&window->cRefs);
|
---|
448 | }
|
---|
449 |
|
---|
450 | DECLINLINE(bool) renderspuWinIsTermed(WindowInfo *window)
|
---|
451 | {
|
---|
452 | return window->BltInfo.Base.id < 0;
|
---|
453 | }
|
---|
454 |
|
---|
455 | DECLINLINE(void) renderspuWinRelease(WindowInfo *window)
|
---|
456 | {
|
---|
457 | uint32_t cRefs = ASMAtomicDecU32(&window->cRefs);
|
---|
458 | if (!cRefs)
|
---|
459 | {
|
---|
460 | renderspuWinDestroy(window);
|
---|
461 | }
|
---|
462 | }
|
---|
463 |
|
---|
464 | extern WindowInfo* renderspuGetDummyWindow(GLint visBits);
|
---|
465 | extern void renderspuPerformMakeCurrent(WindowInfo *window, GLint nativeWindow, ContextInfo *context);
|
---|
466 | extern GLboolean renderspuInitVisual(VisualInfo *pVisInfo, const char *displayName, GLbitfield visAttribs);
|
---|
467 | extern void renderspuVBoxCompositorBlit ( const struct VBOXVR_SCR_COMPOSITOR * pCompositor, PCR_BLITTER pBlitter);
|
---|
468 | extern void renderspuVBoxCompositorBlitStretched ( const struct VBOXVR_SCR_COMPOSITOR * pCompositor, PCR_BLITTER pBlitter, GLfloat scaleX, GLfloat scaleY);
|
---|
469 | extern GLint renderspuCreateContextEx(const char *dpyName, GLint visBits, GLint id, GLint shareCtx);
|
---|
470 | extern GLint renderspuWindowCreateEx( const char *dpyName, GLint visBits, GLint id );
|
---|
471 |
|
---|
472 | extern GLint RENDER_APIENTRY renderspuWindowCreate( const char *dpyName, GLint visBits );
|
---|
473 | void RENDER_APIENTRY renderspuWindowDestroy( GLint win );
|
---|
474 | extern GLint RENDER_APIENTRY renderspuCreateContext( const char *dpyname, GLint visBits, GLint shareCtx );
|
---|
475 | extern void RENDER_APIENTRY renderspuMakeCurrent(GLint crWindow, GLint nativeWindow, GLint ctx);
|
---|
476 | extern void RENDER_APIENTRY renderspuSwapBuffers( GLint window, GLint flags );
|
---|
477 |
|
---|
478 | extern uint32_t renderspuContextMarkDeletedAndRelease( ContextInfo *context );
|
---|
479 |
|
---|
480 | int renderspuDefaultCtxInit();
|
---|
481 | void renderspuCleanupBase(bool fDeleteTables);
|
---|
482 |
|
---|
483 | ContextInfo * renderspuDefaultSharedContextAcquire();
|
---|
484 | void renderspuDefaultSharedContextRelease(ContextInfo * pCtx);
|
---|
485 | uint32_t renderspuContextRelease(ContextInfo *context);
|
---|
486 | uint32_t renderspuContextRetain(ContextInfo *context);
|
---|
487 |
|
---|
488 | bool renderspuCalloutAvailable();
|
---|
489 | bool renderspuCalloutClient(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void *pvCb);
|
---|
490 |
|
---|
491 |
|
---|
492 | #ifdef __cplusplus
|
---|
493 | extern "C" {
|
---|
494 | #endif
|
---|
495 | DECLEXPORT(void) renderspuSetWindowId(uint64_t winId);
|
---|
496 | DECLEXPORT(void) renderspuReparentWindow(GLint window);
|
---|
497 | #ifdef __cplusplus
|
---|
498 | }
|
---|
499 | #endif
|
---|
500 |
|
---|
501 | #endif /* CR_RENDERSPU_H */
|
---|