Changeset 42518 in vbox
- Timestamp:
- Aug 1, 2012 4:54:38 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
include/VBox/VBoxVideo3D.h (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9wddm.def (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c (modified) (3 diffs)
-
src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h (modified) (2 diffs)
-
src/VBox/Additions/common/crOpenGL/context.c (modified) (10 diffs)
-
src/VBox/Additions/common/crOpenGL/load.c (modified) (3 diffs)
-
src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c (modified) (1 diff)
-
src/VBox/Additions/common/crOpenGL/stub.c (modified) (5 diffs)
-
src/VBox/Additions/common/crOpenGL/stub.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxVideo3D.h
r39847 r42518 111 111 #define VBoxTlsRefGetCurrent(_t, _Tsd) ((_t*) VBoxTlsRefGetImpl((_Tsd))) 112 112 113 #define VBoxTlsRefGetCurrentFunctional(_val, _t, _Tsd) do { \ 114 _t * cur = VBoxTlsRefGetCurrent(_t, _Tsd); \ 115 if (!cur || VBoxTlsRefIsFunctional(cur)) { \ 116 (_val) = cur; \ 117 } else { \ 118 VBoxTlsRefSetCurrent(_t, _Tsd, NULL); \ 119 (_val) = NULL; \ 120 } \ 121 } while (0) 122 113 123 #define VBoxTlsRefSetCurrent(_t, _Tsd, _p) do { \ 114 124 _t * oldCur = VBoxTlsRefGetCurrent(_t, _Tsd); \ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r42501 r42518 6621 6621 if (VBOXDISPMODE_IS_3D(pAdapter)) 6622 6622 { 6623 // Assert(!pDevice->cScreens); 6624 /* destroy the device first, since destroying PVBOXWDDMDISP_SWAPCHAIN would result in a device window termination */ 6623 vboxWddmSwapchainDestroyAll(pDevice); 6624 /* ensure the device is destroyed in any way. 6625 * Release may not work in case of some leaking, which will leave the crOgl context refering the destroyed VBOXUHGSMI */ 6625 6626 if (pDevice->pDevice9If) 6626 { 6627 pDevice->pDevice9If->Release(); 6628 } 6629 vboxWddmSwapchainDestroyAll(pDevice); 6627 pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9Term((IDirect3DDevice9Ex *)pDevice->pDevice9If); 6630 6628 } 6631 6629 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp
r42285 r42518 80 80 } 81 81 82 pD3D->pfnVBoxWineExD3DDev9Term = (PFNVBOXWINEEXD3DDEV9_TERM)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Term"); 83 if (!pD3D->pfnVBoxWineExD3DDev9Term) 84 { 85 WARN(("no VBoxWineExD3DDev9Term")); 86 break; 87 } 88 82 89 pD3D->pfnVBoxWineExD3DRc9SetShRcState = (PFNVBOXWINEEXD3DRC9_SETSHRCSTATE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DRc9SetShRcState"); 83 90 if (!pD3D->pfnVBoxWineExD3DRc9SetShRcState) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h
r41637 r42518 63 63 PFNVBOXWINEEXD3DDEV9_UPDATE pfnVBoxWineExD3DDev9Update; 64 64 65 PFNVBOXWINEEXD3DDEV9_TERM pfnVBoxWineExD3DDev9Term; 66 65 67 PFNVBOXWINEEXD3DRC9_SETSHRCSTATE pfnVBoxWineExD3DRc9SetShRcState; 66 68 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9wddm.def
r40388 r42518 16 16 VBoxWineExD3DDev9CreateCubeTexture 17 17 VBoxWineExD3DDev9Update 18 VBoxWineExD3DDev9Term 18 19 VBoxWineExD3DSwapchain9Present 19 20 VBoxWineExD3DRc9SetShRcState -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c
r42499 r42518 260 260 } 261 261 262 static ULONG IDirect3DDevice9Impl_Term(IDirect3DDevice9Impl *This) 263 { 264 ULONG wined3dDevRefs = 0; 265 unsigned i; 266 This->inDestruction = TRUE; 267 268 wined3d_mutex_lock(); 269 for(i = 0; i < This->numConvertedDecls; i++) { 270 /* Unless Wine is buggy or the app has a bug the refcount will be 0, because decls hold a reference to the 271 * device 272 */ 273 IDirect3DVertexDeclaration9Impl_Destroy(This->convertedDecls[i]); 274 } 275 HeapFree(GetProcessHeap(), 0, This->convertedDecls); 276 277 IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D9CB_DestroySwapChain); 278 #ifndef VBOX_WITH_WDDM 279 IWineD3DDevice_ReleaseFocusWindow(This->WineD3DDevice); 280 #endif 281 wined3dDevRefs = IWineD3DDevice_Release(This->WineD3DDevice); 282 wined3d_mutex_unlock(); 283 284 HeapFree(GetProcessHeap(), 0, This); 285 return wined3dDevRefs; 286 } 287 262 288 static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9EX iface) { 263 289 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; … … 270 296 271 297 if (ref == 0) { 272 unsigned i; 273 This->inDestruction = TRUE; 274 275 wined3d_mutex_lock(); 276 for(i = 0; i < This->numConvertedDecls; i++) { 277 /* Unless Wine is buggy or the app has a bug the refcount will be 0, because decls hold a reference to the 278 * device 279 */ 280 IDirect3DVertexDeclaration9Impl_Destroy(This->convertedDecls[i]); 281 } 282 HeapFree(GetProcessHeap(), 0, This->convertedDecls); 283 284 IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D9CB_DestroySwapChain); 285 #ifndef VBOX_WITH_WDDM 286 IWineD3DDevice_ReleaseFocusWindow(This->WineD3DDevice); 287 #endif 288 IWineD3DDevice_Release(This->WineD3DDevice); 289 wined3d_mutex_unlock(); 290 291 HeapFree(GetProcessHeap(), 0, This); 298 IDirect3DDevice9Impl_Term(This); 292 299 } 293 300 return ref; … … 822 829 IDirect3DDevice9_AddRef(iface); 823 830 *outIface = iface; 831 return D3D_OK; 832 } 833 834 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Term(IDirect3DDevice9Ex *iface) 835 { 836 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 837 IWineD3DDevice *WineD3DDevice = This->WineD3DDevice; 838 ULONG wined3dRefs; 839 if (This->ref != 1) 840 { 841 ERR("unexpected ref count %d, destroying in anyway", This->ref); 842 } 843 wined3dRefs = IDirect3DDevice9Impl_Term(This); 844 if (wined3dRefs) 845 { 846 ERR("unexpected wined3dRefs %d, destroying in anyway", wined3dRefs); 847 while (IWineD3DDevice_Release(WineD3DDevice)) {} 848 } 824 849 return D3D_OK; 825 850 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h
r42499 r42518 53 53 typedef FNVBOXWINEEXD3DDEV9_UPDATE *PFNVBOXWINEEXD3DDEV9_UPDATE; 54 54 55 typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_TERM(IDirect3DDevice9Ex *iface); 56 typedef FNVBOXWINEEXD3DDEV9_TERM *PFNVBOXWINEEXD3DDEV9_TERM; 57 55 58 typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DRC9_SETSHRCSTATE(IDirect3DResource9 *iface, VBOXWINEEX_SHRC_STATE enmState); 56 59 typedef FNVBOXWINEEXD3DRC9_SETSHRCSTATE *PFNVBOXWINEEXD3DRC9_SETSHRCSTATE; … … 80 83 IDirect3DDevice9Ex **outIface); /* update device parameters */ 81 84 85 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Term(IDirect3DDevice9Ex *iface); 86 82 87 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DRc9SetShRcState(IDirect3DResource9 *iface, VBOXWINEEX_SHRC_STATE enmState); 83 88 -
trunk/src/VBox/Additions/common/crOpenGL/context.c
r42499 r42518 88 88 } 89 89 90 void stubForcedFlush(GLint con) 91 { 92 #if 0 93 GLint buffer; 94 stub.spu->dispatch_table.GetIntegerv(GL_DRAW_BUFFER, &buffer); 95 stub.spu->dispatch_table.DrawBuffer(GL_FRONT); 96 stub.spu->dispatch_table.Flush(); 97 stub.spu->dispatch_table.DrawBuffer(buffer); 98 #else 99 if (con) 100 { 101 stub.spu->dispatch_table.VBoxConFlush(con); 102 } 103 else 104 { 105 stub.spu->dispatch_table.Flush(); 106 } 107 #endif 108 } 109 110 static void stubWindowCleanupForContextsCB(unsigned long key, void *data1, void *data2) 111 { 112 ContextInfo *context = (ContextInfo *) data1; 113 114 CRASSERT(context); 115 116 if (context->currentDrawable == data2) 117 context->currentDrawable = NULL; 118 } 119 120 void stubDestroyWindow( GLint con, GLint window ) 121 { 122 WindowInfo *winInfo = (WindowInfo *) 123 crHashtableSearch(stub.windowTable, (unsigned int) window); 124 if (winInfo && winInfo->type == CHROMIUM && stub.spu) 125 { 126 crHashtableLock(stub.windowTable); 127 128 stub.spu->dispatch_table.VBoxWindowDestroy(con, winInfo->spuWindow ); 129 130 #ifdef WINDOWS 131 if (winInfo->hVisibleRegion != INVALID_HANDLE_VALUE) 132 { 133 DeleteObject(winInfo->hVisibleRegion); 134 } 135 #elif defined(GLX) 136 if (winInfo->pVisibleRegions) 137 { 138 XFree(winInfo->pVisibleRegions); 139 } 140 # ifdef CR_NEWWINTRACK 141 if (winInfo->syncDpy) 142 { 143 XCloseDisplay(winInfo->syncDpy); 144 } 145 # endif 146 #endif 147 stubForcedFlush(con); 148 149 crHashtableWalk(stub.contextTable, stubWindowCleanupForContextsCB, winInfo); 150 151 crHashtableDelete(stub.windowTable, window, crFree); 152 153 crHashtableUnlock(stub.windowTable); 154 } 155 } 90 156 91 157 /** … … 333 399 334 400 static void 401 stubContextFree( ContextInfo *context ) 402 { 403 crMemZero(context, sizeof(ContextInfo)); /* just to be safe */ 404 crFree(context); 405 } 406 407 static void 335 408 stubDestroyContextLocked( ContextInfo *context ) 336 409 { … … 367 440 #endif 368 441 369 crMemZero(context, sizeof(ContextInfo)); /* just to be safe */ 370 crHashtableDelete(stub.contextTable, contextId, crFree); 442 crHashtableDelete(stub.contextTable, contextId, NULL); 371 443 } 372 444 … … 374 446 static DECLCALLBACK(void) stubContextDtor(void*pvContext) 375 447 { 376 crHashtableLock(stub.windowTable); 377 crHashtableLock(stub.contextTable); 378 stubDestroyContextLocked((ContextInfo*)pvContext); 379 crHashtableUnlock(stub.contextTable); 380 crHashtableUnlock(stub.windowTable); 448 stubContextFree((ContextInfo*)pvContext); 381 449 } 382 450 #endif … … 1015 1083 could be destroyed. 1016 1084 */ 1017 crWindowDestroy((GLint)pWindow->hWnd);1085 stubDestroyWindow(CR_CTX_CON(pCtx), (GLint)pWindow->hWnd); 1018 1086 #else 1019 crWindowDestroy((GLint)pWindow->drawable);1087 stubDestroyWindow(CR_CTX_CON(pCtx), (GLint)pWindow->drawable); 1020 1088 #endif 1021 1089 } … … 1167 1235 if (context->currentDrawable->hWnd!=WindowFromDC(context->currentDrawable->drawable)) 1168 1236 { 1169 crWindowDestroy((GLint)context->currentDrawable->hWnd);1237 stubDestroyWindow(CR_CTX_CON(context), (GLint)context->currentDrawable->hWnd); 1170 1238 } 1171 1239 #else … … 1177 1245 if (!XGetGeometry(context->currentDrawable->dpy, context->currentDrawable->drawable, &root, &x, &y, &w, &h, &border, &depth)) 1178 1246 { 1179 crWindowDestroy((GLint)context->currentDrawable->drawable);1247 stubDestroyWindow(CR_CTX_CON(context), (GLint)context->currentDrawable->drawable); 1180 1248 } 1181 1249 XUNLOCK(context->currentDrawable->dpy); … … 1196 1264 window->type = context->type; 1197 1265 window->pOwner = context; 1198 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)1199 window->spuConnection = context->spuConnection;1200 #endif1201 1266 context->currentDrawable = window; 1202 1267 stubSetCurrentContext(context); … … 1286 1351 CRASSERT(context); 1287 1352 1353 CRASSERT(0); 1354 stubDestroyContextLocked(context); 1355 1288 1356 #ifdef CHROMIUM_THREADSAFE 1289 1357 if (stubGetCurrentContext() == context) { … … 1291 1359 } 1292 1360 1361 VBoxTlsRefMarkDestroy(context); 1293 1362 VBoxTlsRefRelease(context); 1294 1363 #else 1295 stubDestroyContextLocked(context);1296 1297 1364 if (stubGetCurrentContext() == context) { 1298 1365 stubSetCurrentContext(NULL); 1299 1366 } 1367 stubContextFree(context); 1300 1368 #endif 1301 1369 crHashtableUnlock(stub.contextTable); -
trunk/src/VBox/Additions/common/crOpenGL/load.c
r42499 r42518 190 190 { 191 191 #ifdef WINDOWS 192 crWindowDestroy((GLint)pWindow->hWnd);192 stubDestroyWindow(CR_CTX_CON(pCtx), (GLint)pWindow->hWnd); 193 193 #else 194 crWindowDestroy((GLint)pWindow->drawable);194 stubDestroyWindow(CR_CTX_CON(pCtx), (GLint)pWindow->drawable); 195 195 #endif 196 196 return; … … 843 843 if (!stubSystemWindowExist(pWindow)) 844 844 { 845 crWindowDestroy((GLint)pWindow->hWnd);845 stubDestroyWindow(0, (GLint)pWindow->hWnd); 846 846 return; 847 847 } … … 991 991 { 992 992 #ifdef WINDOWS 993 crWindowDestroy((GLint)pWindow->hWnd);993 stubDestroyWindow(0, (GLint)pWindow->hWnd); 994 994 #else 995 crWindowDestroy((GLint)pWindow->drawable);995 stubDestroyWindow(0, (GLint)pWindow->drawable); 996 996 #endif 997 997 /*No need to flush here as crWindowDestroy does it*/ -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r42499 r42518 160 160 if (CRPACKSPU_IS_WDDM_CRHGSMI()) 161 161 { 162 ThreadInfo *thread; 163 CRPackContext * curPacker = crPackGetContext(); 164 if (!con) 165 { 166 crError("connection expected!!"); 162 GET_THREAD(thread); 163 if (con) 164 { 165 CRPackContext * curPacker = crPackGetContext(); 166 CRASSERT(!thread || !thread->bInjectThread); 167 thread = GET_THREAD_VAL_ID(con); 168 crPackSetContext(thread->packer); 169 crPackWindowDestroy(window); 170 if (curPacker != thread->packer) 171 crPackSetContext(curPacker); 167 172 return; 168 173 } 169 thread = GET_THREAD_VAL_ID(con); 170 crPackSetContext(thread->packer); 171 crPackWindowDestroy(window); 172 if (curPacker != thread->packer) 173 crPackSetContext(curPacker); 174 return; 174 CRASSERT(thread); 175 CRASSERT(thread->bInjectThread); 175 176 } 176 177 crPackWindowDestroy(window); -
trunk/src/VBox/Additions/common/crOpenGL/stub.c
r42500 r42518 10 10 #include "stub.h" 11 11 #include <iprt/thread.h> 12 13 static void crForcedFlush(14 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)15 GLint con16 #endif17 )18 {19 #if 020 GLint buffer;21 stub.spu->dispatch_table.GetIntegerv(GL_DRAW_BUFFER, &buffer);22 stub.spu->dispatch_table.DrawBuffer(GL_FRONT);23 stub.spu->dispatch_table.Flush();24 stub.spu->dispatch_table.DrawBuffer(buffer);25 #else26 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)27 if (con)28 {29 stub.spu->dispatch_table.VBoxConFlush(con);30 }31 else32 #endif33 {34 stub.spu->dispatch_table.Flush();35 }36 #endif37 }38 12 39 13 #ifdef GLX … … 142 116 } 143 117 144 static void stubWindowCleanupForContextsCB(unsigned long key, void *data1, void *data2)145 {146 ContextInfo *context = (ContextInfo *) data1;147 148 CRASSERT(context);149 150 if (context->currentDrawable == data2)151 context->currentDrawable = NULL;152 }153 154 118 void APIENTRY crWindowDestroy( GLint window ) 155 119 { 156 WindowInfo *winInfo = (WindowInfo *) 157 crHashtableSearch(stub.windowTable, (unsigned int) window); 158 if (winInfo && winInfo->type == CHROMIUM && stub.spu) 159 { 160 crHashtableLock(stub.windowTable); 161 162 stub.spu->dispatch_table.VBoxWindowDestroy( 163 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 164 winInfo->spuConnection, 165 #else 166 0, 167 #endif 168 winInfo->spuWindow ); 169 170 #ifdef WINDOWS 171 if (winInfo->hVisibleRegion != INVALID_HANDLE_VALUE) 172 { 173 DeleteObject(winInfo->hVisibleRegion); 174 } 175 #elif defined(GLX) 176 if (winInfo->pVisibleRegions) 177 { 178 XFree(winInfo->pVisibleRegions); 179 } 180 # ifdef CR_NEWWINTRACK 181 if (winInfo->syncDpy) 182 { 183 XCloseDisplay(winInfo->syncDpy); 184 } 185 # endif 186 #endif 187 crForcedFlush( 188 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 189 winInfo->spuConnection 190 #endif 191 ); 192 193 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 194 winInfo->spuConnection = 0; 195 #endif 196 crHashtableWalk(stub.contextTable, stubWindowCleanupForContextsCB, winInfo); 197 198 crHashtableDelete(stub.windowTable, window, crFree); 199 200 crHashtableUnlock(stub.windowTable); 201 } 120 stubDestroyWindow( 0, window ); 202 121 } 203 122 … … 415 334 if (stubUpdateWindowGeometry(winInfo, GL_FALSE) || changed) 416 335 { 417 crForcedFlush();336 stubForcedFlush(0); 418 337 } 419 338 break; … … 429 348 if (stub.trackWindowVisibleRgn && stubUpdateWindowVisibileRegions(winInfo)) 430 349 { 431 crForcedFlush();350 stubForcedFlush(0); 432 351 } 433 352 break; … … 439 358 { 440 359 crDebug("Visibility info updated due to unknown hooked message (%d)", pMsgInfo->message); 441 crForcedFlush();360 stubForcedFlush(0); 442 361 } 443 362 break; -
trunk/src/VBox/Additions/common/crOpenGL/stub.h
r42499 r42518 170 170 ContextInfo *pOwner; /* ctx which created this window */ 171 171 GLboolean mapped; 172 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)173 GLint spuConnection;174 #endif175 172 #ifdef WINDOWS 176 173 HDC drawable; … … 289 286 extern CRtsd g_stubCurrentContextTSD; 290 287 291 # define stubGetCurrentContext() VBoxTlsRefGetCurrent(ContextInfo, &g_stubCurrentContextTSD) 288 DECLINLINE(ContextInfo*) stubGetCurrentContext() 289 { 290 ContextInfo* ctx; 291 VBoxTlsRefGetCurrentFunctional(ctx, ContextInfo, &g_stubCurrentContextTSD); 292 return ctx; 293 } 292 294 # define stubSetCurrentContext(_ctx) VBoxTlsRefSetCurrent(ContextInfo, &g_stubCurrentContextTSD, _ctx) 293 295 #else … … 345 347 extern GLboolean stubMakeCurrent( WindowInfo *window, ContextInfo *context ); 346 348 extern GLint stubNewWindow( const char *dpyName, GLint visBits ); 349 extern void stubDestroyWindow( GLint con, GLint window ); 347 350 extern void stubSwapBuffers(WindowInfo *window, GLint flags); 348 351 extern void stubGetWindowGeometry(WindowInfo *win, int *x, int *y, unsigned int *w, unsigned int *h); … … 351 354 extern bool stubInit(void); 352 355 356 extern void stubForcedFlush(GLint con); 353 357 extern void APIENTRY stub_GetChromiumParametervCR( GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid *values ); 354 358 355 359 extern void APIENTRY glBoundsInfoCR(const CRrecti *, const GLbyte *, GLint, GLint); 356 360 361 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 362 # define CR_CTX_CON(_pCtx) ((_pCtx)->spuConnection) 363 #else 364 # define CR_CTX_CON(_pCtx) (0) 365 #endif 366 357 367 #endif /* CR_STUB_H */
Note:
See TracChangeset
for help on using the changeset viewer.

