diff options
Diffstat (limited to 'src/VBox/Additions/common/crOpenGL/context.c')
-rw-r--r-- | src/VBox/Additions/common/crOpenGL/context.c | 107 |
1 files changed, 72 insertions, 35 deletions
diff --git a/src/VBox/Additions/common/crOpenGL/context.c b/src/VBox/Additions/common/crOpenGL/context.c index 4a077a5d..6c6e4b97 100644 --- a/src/VBox/Additions/common/crOpenGL/context.c +++ b/src/VBox/Additions/common/crOpenGL/context.c @@ -107,6 +107,22 @@ void stubForcedFlush(GLint con) #endif } +void stubConChromiumParameteriCR(GLint con, GLenum param, GLint value) +{ + if (con) + stub.spu->dispatch_table.VBoxConChromiumParameteriCR(con, param, value); + else + crError("VBoxConChromiumParameteriCR called with null connection"); +} + +void stubConFlush(GLint con) +{ + if (con) + stub.spu->dispatch_table.VBoxConFlush(con); + else + crError("stubConFlush called with null connection"); +} + static void stubWindowCleanupForContextsCB(unsigned long key, void *data1, void *data2) { ContextInfo *context = (ContextInfo *) data1; @@ -144,6 +160,7 @@ void stubDestroyWindow( GLint con, GLint window ) } # endif #endif + stubForcedFlush(con); crHashtableWalk(stub.contextTable, stubWindowCleanupForContextsCB, winInfo); @@ -189,7 +206,7 @@ stubNewWindow( const char *dpyName, GLint visBits ) #ifdef VBOX_WITH_WDDM if (stub.bRunningUnderWDDM) { - crError("Should not be here: WindowCreate/Destroy & VBoxPackGetInjectID recuire connection id!"); + crError("Should not be here: WindowCreate/Destroy & VBoxPackGetInjectID require connection id!"); winInfo->mapped = 0; } else @@ -433,10 +450,6 @@ stubDestroyContextLocked( ContextInfo *context ) #ifdef GLX crFreeHashtable(context->pGLXPixmapsHash, crFree); - if (context->damageDpy) - { - XCloseDisplay(context->damageDpy); - } #endif crHashtableDelete(stub.contextTable, contextId, NULL); @@ -535,8 +548,7 @@ stubNewContext( const char *dpyName, GLint visBits, ContextType type, #ifdef GLX context->pGLXPixmapsHash = crAllocHashtable(); - context->damageInitFailed = GL_FALSE; - context->damageDpy = NULL; + context->damageQueryFailed = GL_FALSE; context->damageEventsBase = 0; #endif @@ -1089,6 +1101,50 @@ static void stubWindowCheckOwnerCB(unsigned long key, void *data1, void *data2) } } +GLboolean stubCtxCreate(ContextInfo *context) +{ + /* + * Create a Chromium context. + */ +#if defined(GLX) || defined(DARWIN) + GLint spuShareCtx = context->share ? context->share->spuContext : 0; +#else + GLint spuShareCtx = 0; +#endif + GLint spuConnection = 0; + CRASSERT(stub.spu); + CRASSERT(stub.spu->dispatch_table.CreateContext); + context->type = CHROMIUM; + +#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) + if (context->pHgsmi) + { + spuConnection = stub.spu->dispatch_table.VBoxConCreate(context->pHgsmi); + if (!spuConnection) + { + crWarning("VBoxConCreate failed"); + return GL_FALSE; + } + context->spuConnection = spuConnection; + } +#endif + + context->spuContext + = stub.spu->dispatch_table.VBoxCreateContext(spuConnection, context->dpyName, + context->visBits, + spuShareCtx); + + return GL_TRUE; +} + +GLboolean stubCtxCheckCreate(ContextInfo *context) +{ + if (context->type == UNDECIDED) + return stubCtxCreate(context); + return CHROMIUM == context->type; +} + + GLboolean stubMakeCurrent( WindowInfo *window, ContextInfo *context ) { @@ -1119,42 +1175,22 @@ stubMakeCurrent( WindowInfo *window, ContextInfo *context ) #endif if (stubCheckUseChromium(window)) { - /* - * Create a Chromium context. - */ -#if defined(GLX) || defined(DARWIN) - GLint spuShareCtx = context->share ? context->share->spuContext : 0; -#else - GLint spuShareCtx = 0; -#endif GLint spuConnection = 0; - CRASSERT(stub.spu); - CRASSERT(stub.spu->dispatch_table.CreateContext); - context->type = CHROMIUM; -#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) - if (context->pHgsmi) + if (!stubCtxCreate(context)) { - spuConnection = stub.spu->dispatch_table.VBoxConCreate(context->pHgsmi); - if (!spuConnection) - { - crWarning("VBoxConCreate failed"); - return GL_FALSE; - } - context->spuConnection = spuConnection; + crWarning("stubCtxCreate failed"); + return GL_FALSE; } + +#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) + spuConnection = context->spuConnection; #endif - context->spuContext - = stub.spu->dispatch_table.VBoxCreateContext(spuConnection, context->dpyName, - context->visBits, - spuShareCtx); if (window->spuWindow == -1) { /*crDebug("(1)stubMakeCurrent ctx=%p(%i) window=%p(%i)", context, context->spuContext, window, window->spuWindow);*/ - window->spuWindow = stub.spu->dispatch_table.VBoxWindowCreate( - spuConnection, - window->dpyName, context->visBits ); + window->spuWindow = stub.spu->dispatch_table.VBoxWindowCreate(spuConnection, window->dpyName, context->visBits ); #ifdef CR_NEWWINTRACK window->u32ClientID = stub.spu->dispatch_table.VBoxPackGetInjectID(spuConnection); #endif @@ -1311,7 +1347,8 @@ stubMakeCurrent( WindowInfo *window, ContextInfo *context ) stub.spu->dispatch_table.Viewport( 0, 0, winW, winH ); } #ifdef VBOX_WITH_WDDM - stub.spu->dispatch_table.WindowVisibleRegion(window->spuWindow, 0, NULL); + if (stub.trackWindowVisibleRgn) + stub.spu->dispatch_table.WindowVisibleRegion(window->spuWindow, 0, NULL); #endif } |