Changeset 51064 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/render
- Timestamp:
- Apr 14, 2014 2:21:37 PM (11 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/render
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r50405 r51064 599 599 } 600 600 601 void renderspuWindowTermBase( WindowInfo *window ) 602 { 603 renderspuVBoxCompositorSet(window, NULL); 604 renderspuVBoxPresentBlitterCleanup(window); 605 renderspu_SystemDestroyWindow( window ); 606 RTCritSectDelete(&window->CompositorLock); 607 } 608 601 609 void renderspuWindowTerm( WindowInfo *window ) 602 610 { … … 605 613 CRASSERT(!pOldCtx == !pOldWindow); 606 614 /* ensure no concurrent draws can take place */ 607 renderspuVBoxCompositorSet(window, NULL); 608 renderspuVBoxPresentBlitterCleanup(window); 609 renderspu_SystemDestroyWindow( window ); 610 RTCritSectDelete(&window->CompositorLock); 615 renderspuWindowTermBase(window); 611 616 /* check if this window is bound to some ctx. Note: window pointer is already freed here */ 612 617 crHashtableWalk(render_spu.contextTable, renderspuCheckCurrentCtxWindowCB, window); … … 1367 1372 } 1368 1373 1369 1370 1374 static void RENDER_APIENTRY renderspuChromiumParameteriCR(GLenum target, GLint value) 1371 1375 { 1372 1373 1376 switch (target) 1374 1377 { … … 1382 1385 1383 1386 renderspuSetDefaultSharedContext(pCtx); 1387 break; 1388 } 1389 case GL_HH_RENDERTHREAD_INFORM: 1390 { 1391 if (value) 1392 { 1393 int rc = renderspuDefaultCtxInit(); 1394 if (RT_FAILURE(rc)) 1395 { 1396 WARN(("renderspuDefaultCtxInit failed")); 1397 break; 1398 } 1399 } 1400 else 1401 { 1402 renderspuCleanupBase(false); 1403 } 1384 1404 break; 1385 1405 } … … 1753 1773 { 1754 1774 WindowInfo *pWindow = (WindowInfo *)data1; 1755 1756 renderspu_SystemReparentWindow(pWindow); 1775 CRHashTable *pTable = (CRHashTable*)data2; 1776 1777 crHashtableDelete(pTable, key, NULL); 1778 1779 renderspuWindowTerm(pWindow); 1780 1781 crFree(pWindow); 1757 1782 } 1758 1783 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
r50095 r51064 424 424 extern PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData ); 425 425 extern PCR_BLITTER renderspuVBoxPresentBlitterEnsureCreated( WindowInfo *window, int32_t i32MakeCurrentUserData ); 426 void renderspuWindowTermBase( WindowInfo *window ); 426 427 extern void renderspuWindowTerm( WindowInfo *window ); 427 428 extern WindowInfo* renderspuGetDummyWindow(GLint visBits); … … 443 444 extern uint32_t renderspuContextMarkDeletedAndRelease( ContextInfo *context ); 444 445 446 int renderspuDefaultCtxInit(); 447 void renderspuCleanupBase(bool fDeleteTables); 448 445 449 ContextInfo * renderspuDefaultSharedContextAcquire(); 446 450 void renderspuDefaultSharedContextRelease(ContextInfo * pCtx); -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
r50095 r51064 673 673 if (RT_SUCCESS(rc)) 674 674 { 675 675 rc = RTSemEventWait(render_spu.hWinCmdCompleteEvent, RT_INDEFINITE_WAIT); 676 676 if (RT_SUCCESS(rc)) 677 677 { 678 679 678 return VINF_SUCCESS; 679 } 680 680 else 681 681 { 682 683 684 685 682 crWarning("RTSemEventWait failed rc %d", rc); 683 } 684 685 RTThreadWait(render_spu.hWinCmdThread, RT_INDEFINITE_WAIT, NULL); 686 686 } 687 687 else … … 689 689 crWarning("RTThreadCreate failed rc %d", rc); 690 690 } 691 RTSemEventDestroy(render_spu.hWinCmdCompleteEvent);691 RTSemEventDestroy(render_spu.hWinCmdCompleteEvent); 692 692 } 693 693 else -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
r50095 r51064 134 134 #endif 135 135 136 int renderspuDefaultCtxInit() 137 { 138 GLint defaultWin, defaultCtx; 139 WindowInfo *windowInfo; 140 141 /* 142 * Create the default window and context. Their indexes are zero and 143 * a client can use them without calling CreateContext or WindowCreate. 144 */ 145 crDebug("Render SPU: Creating default window (visBits=0x%x, id=0)", 146 render_spu.default_visual); 147 defaultWin = renderspuWindowCreateEx( NULL, render_spu.default_visual, CR_RENDER_DEFAULT_WINDOW_ID ); 148 if (defaultWin != CR_RENDER_DEFAULT_WINDOW_ID) { 149 crError("Render SPU: Couldn't get a double-buffered, RGB visual with Z!"); 150 return VERR_GENERAL_FAILURE; 151 } 152 crDebug( "Render SPU: WindowCreate returned %d (0=normal)", defaultWin ); 153 154 crDebug("Render SPU: Creating default context, visBits=0x%x", 155 render_spu.default_visual ); 156 defaultCtx = renderspuCreateContextEx( NULL, render_spu.default_visual, CR_RENDER_DEFAULT_CONTEXT_ID, 0 ); 157 if (defaultCtx != CR_RENDER_DEFAULT_CONTEXT_ID) { 158 crError("Render SPU: failed to create default context!"); 159 return VERR_GENERAL_FAILURE; 160 } 161 162 renderspuMakeCurrent( defaultWin, 0, defaultCtx ); 163 164 /* Get windowInfo for the default window */ 165 windowInfo = (WindowInfo *) crHashtableSearch(render_spu.windowTable, CR_RENDER_DEFAULT_WINDOW_ID); 166 CRASSERT(windowInfo); 167 windowInfo->mapPending = GL_TRUE; 168 169 return VINF_SUCCESS; 170 } 171 136 172 static SPUFunctions * 137 173 renderSPUInit( int id, SPU *child, SPU *self, … … 139 175 { 140 176 int numFuncs, numSpecial; 141 GLint defaultWin, defaultCtx; 142 WindowInfo *windowInfo; 177 143 178 const char * pcpwSetting; 144 179 int rc; … … 267 302 #endif /* DARWIN */ 268 303 269 /* 270 * Create the default window and context. Their indexes are zero and 271 * a client can use them without calling CreateContext or WindowCreate. 272 */ 273 crDebug("Render SPU: Creating default window (visBits=0x%x, id=0)", 274 render_spu.default_visual); 275 defaultWin = renderspuWindowCreateEx( NULL, render_spu.default_visual, CR_RENDER_DEFAULT_WINDOW_ID ); 276 if (defaultWin != CR_RENDER_DEFAULT_WINDOW_ID) { 277 crError("Render SPU: Couldn't get a double-buffered, RGB visual with Z!"); 304 rc = renderspuDefaultCtxInit(); 305 if (!RT_SUCCESS(rc)) 306 { 307 WARN(("renderspuDefaultCtxInit failed %d", rc)); 278 308 return NULL; 279 309 } 280 crDebug( "Render SPU: WindowCreate returned %d (0=normal)", defaultWin );281 282 crDebug("Render SPU: Creating default context, visBits=0x%x",283 render_spu.default_visual );284 defaultCtx = renderspuCreateContextEx( NULL, render_spu.default_visual, CR_RENDER_DEFAULT_CONTEXT_ID, 0 );285 if (defaultCtx != CR_RENDER_DEFAULT_CONTEXT_ID) {286 crError("Render SPU: failed to create default context!");287 return NULL;288 }289 290 renderspuMakeCurrent( defaultWin, 0, defaultCtx );291 292 /* Get windowInfo for the default window */293 windowInfo = (WindowInfo *) crHashtableSearch(render_spu.windowTable, CR_RENDER_DEFAULT_WINDOW_ID);294 CRASSERT(windowInfo);295 windowInfo->mapPending = GL_TRUE;296 310 297 311 /* … … 414 428 { 415 429 WindowInfo *window = (WindowInfo *) data; 416 renderspu _SystemDestroyWindow(window);430 renderspuWindowTermBase(window); 417 431 crFree(window); 418 432 } … … 433 447 } 434 448 449 450 static void renderspuDeleteBlitterCB(unsigned long key, void *data1, void *data2) 451 { 452 CRHashTable *pTbl = (CRHashTable*)data2; 453 454 crHashtableDelete( pTbl, key, NULL ); 455 456 DeleteBlitterCallback(data1); 457 } 458 459 460 static void renderspuDeleteWindowCB(unsigned long key, void *data1, void *data2) 461 { 462 CRHashTable *pTbl = (CRHashTable*)data2; 463 464 crHashtableDelete( pTbl, key, NULL ); 465 466 DeleteWindowCallback(data1); 467 } 468 469 static void renderspuDeleteBarierCB(unsigned long key, void *data1, void *data2) 470 { 471 CRHashTable *pTbl = (CRHashTable*)data2; 472 473 crHashtableDelete( pTbl, key, NULL ); 474 475 crFree(data1); 476 } 477 478 479 static void renderspuDeleteContextCB(unsigned long key, void *data1, void *data2) 480 { 481 CRHashTable *pTbl = (CRHashTable*)data2; 482 483 crHashtableDelete( pTbl, key, NULL ); 484 485 DeleteContextCallback(data1); 486 } 487 488 void renderspuCleanupBase(bool fDeleteTables) 489 { 490 renderspuVBoxCompositorClearAll(); 491 492 if (render_spu.blitterTable) 493 { 494 if (fDeleteTables) 495 { 496 crFreeHashtable(render_spu.blitterTable, DeleteBlitterCallback); 497 render_spu.blitterTable = NULL; 498 } 499 else 500 { 501 crHashtableWalk(render_spu.blitterTable, renderspuDeleteBlitterCB, render_spu.contextTable); 502 } 503 } 504 else 505 { 506 crHashtableWalk(render_spu.windowTable, renderspuBlitterCleanupCB, NULL); 507 508 crHashtableWalk(render_spu.dummyWindowTable, renderspuBlitterCleanupCB, NULL); 509 } 510 511 renderspuSetDefaultSharedContext(NULL); 512 513 if (fDeleteTables) 514 { 515 crFreeHashtable(render_spu.contextTable, DeleteContextCallback); 516 render_spu.contextTable = NULL; 517 crFreeHashtable(render_spu.windowTable, DeleteWindowCallback); 518 render_spu.windowTable = NULL; 519 crFreeHashtable(render_spu.dummyWindowTable, DeleteWindowCallback); 520 render_spu.dummyWindowTable = NULL; 521 crFreeHashtable(render_spu.barrierHash, crFree); 522 render_spu.barrierHash = NULL; 523 } 524 else 525 { 526 crHashtableWalk(render_spu.contextTable, renderspuDeleteContextCB, render_spu.contextTable); 527 crHashtableWalk(render_spu.windowTable, renderspuDeleteWindowCB, render_spu.windowTable); 528 crHashtableWalk(render_spu.dummyWindowTable, renderspuDeleteWindowCB, render_spu.dummyWindowTable); 529 crHashtableWalk(render_spu.barrierHash, renderspuDeleteBarierCB, render_spu.barrierHash); 530 } 531 } 532 435 533 static int renderSPUCleanup(void) 436 534 { 437 renderspuVBoxCompositorClearAll(); 438 439 if (render_spu.blitterTable) 440 { 441 crFreeHashtable(render_spu.blitterTable, DeleteBlitterCallback); 442 render_spu.blitterTable = NULL; 443 } 444 else 445 { 446 crHashtableWalk(render_spu.windowTable, renderspuBlitterCleanupCB, NULL); 447 448 crHashtableWalk(render_spu.dummyWindowTable, renderspuBlitterCleanupCB, NULL); 449 } 450 451 renderspuSetDefaultSharedContext(NULL); 452 453 crFreeHashtable(render_spu.contextTable, DeleteContextCallback); 454 render_spu.contextTable = NULL; 455 crFreeHashtable(render_spu.windowTable, DeleteWindowCallback); 456 render_spu.windowTable = NULL; 457 crFreeHashtable(render_spu.dummyWindowTable, DeleteWindowCallback); 458 render_spu.dummyWindowTable = NULL; 459 crFreeHashtable(render_spu.barrierHash, crFree); 460 render_spu.barrierHash = NULL; 535 renderspuCleanupBase(true); 461 536 462 537 #ifdef RT_OS_DARWIN
Note:
See TracChangeset
for help on using the changeset viewer.