Changeset 45148 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Mar 22, 2013 9:28:29 PM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r45132 r45148 991 991 CHECK_ERROR_BREAK(pConsole, COMGETTER(Display)(pDisplay.asOutParam())); 992 992 993 crServerVBoxCompositionSetEnableStateGlobal(GL_FALSE); 994 993 995 rc = crVBoxServerSetScreenCount(monitorCount); 994 996 AssertRCReturn(rc, rc); … … 1016 1018 g_pConsole = pConsole; 1017 1019 1020 crServerVBoxCompositionSetEnableStateGlobal(GL_TRUE); 1021 1018 1022 rc = VINF_SUCCESS; 1019 1023 } … … 1105 1109 CHECK_ERROR_RET(g_pConsole, COMGETTER(Display)(pDisplay.asOutParam()), rc); 1106 1110 CHECK_ERROR_RET(pDisplay, GetFramebuffer(screenId, pFramebuffer.asOutParam(), &xo, &yo), rc); 1111 1112 crServerVBoxCompositionSetEnableStateGlobal(GL_FALSE); 1107 1113 1108 1114 if (!pFramebuffer) … … 1130 1136 } 1131 1137 } 1138 1139 crServerVBoxCompositionSetEnableStateGlobal(GL_TRUE); 1132 1140 1133 1141 rc = VINF_SUCCESS; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r45132 r45148 143 143 void crServerMuralFBOSwapBuffers(CRMuralInfo *mural); 144 144 145 void crServerVBoxComposition Reenable(CRMuralInfo *mural, GLboolean fForcePresent);146 void crServerVBoxCompositionDisable (CRMuralInfo *mural);145 void crServerVBoxCompositionDisableEnter(CRMuralInfo *mural); 146 void crServerVBoxCompositionDisableLeave(CRMuralInfo *mural, GLboolean fForcePresentOnEnabled); 147 147 void crServerVBoxCompositionPresent(CRMuralInfo *mural); 148 148 DECLINLINE(GLboolean) crServerVBoxCompositionPresentNeeded(CRMuralInfo *mural) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_clear.c
r43980 r45148 428 428 ctx = crStateGetCurrent(); 429 429 430 CRASSERT(cr_server.curClient && cr_server.curClient->currentMural == mural); 431 430 432 if (ctx->framebufferobject.drawFB 431 433 || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT)) 432 cr_server.curClient->currentMural->bFbDraw = GL_FALSE;434 mural->bFbDraw = GL_FALSE; 433 435 434 436 if (crServerIsRedirectedToFBO()) … … 440 442 { 441 443 cr_server.head_spu->dispatch_table.SwapBuffers( mural->spuWindow, flags ); 444 if (crServerVBoxCompositionPresentNeeded(mural)) 445 mural->fDataPresented = GL_TRUE; 442 446 } 443 447 } … … 449 453 cr_server.head_spu->dispatch_table.Flush(); 450 454 451 if (!cr_server.curClient->currentMural) /* <- on window destroy this will be zero */ 452 return; 453 454 if (cr_server.curClient->currentMural->bFbDraw && crServerIsRedirectedToFBO()) 455 { 456 crServerPresentFBO(cr_server.curClient->currentMural); 457 } 458 459 if (ctx->framebufferobject.drawFB 460 || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT)) 461 cr_server.curClient->currentMural->bFbDraw = GL_FALSE; 455 if (cr_server.curClient && cr_server.curClient->currentMural) 456 { 457 CRMuralInfo *mural = cr_server.curClient->currentMural; 458 if (mural->bFbDraw) 459 { 460 if (crServerIsRedirectedToFBO()) 461 crServerPresentFBO(mural); 462 else if (crServerVBoxCompositionPresentNeeded(mural)) 463 mural->fDataPresented = GL_TRUE; 464 } 465 466 if (ctx->framebufferobject.drawFB 467 || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT)) 468 mural->bFbDraw = GL_FALSE; 469 } 462 470 } 463 471 … … 469 477 cr_server.head_spu->dispatch_table.Finish(); 470 478 471 if (cr_server.curClient->currentMural->bFbDraw && crServerIsRedirectedToFBO()) 472 { 473 crServerPresentFBO(cr_server.curClient->currentMural); 474 } 475 476 if (ctx->framebufferobject.drawFB 477 || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT)) 478 cr_server.curClient->currentMural->bFbDraw = GL_FALSE; 479 } 479 if (cr_server.curClient && cr_server.curClient->currentMural) 480 { 481 CRMuralInfo *mural = cr_server.curClient->currentMural; 482 if (mural->bFbDraw) 483 { 484 if (crServerIsRedirectedToFBO()) 485 crServerPresentFBO(mural); 486 else if (crServerVBoxCompositionPresentNeeded(mural)) 487 mural->fDataPresented = GL_TRUE; 488 } 489 490 if (ctx->framebufferobject.drawFB 491 || (ctx->buffer.drawBuffer != GL_FRONT && ctx->buffer.drawBuffer != GL_FRONT_LEFT)) 492 mural->bFbDraw = GL_FALSE; 493 } 494 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r45132 r45148 1814 1814 crVBoxServerFBImageDataTerm(&Data.data); 1815 1815 1816 if (pMural->fUseFBO && crServerVBoxCompositionPresentNeeded(pMural))1816 if (pMural->fUseFBO && pMural->fDataPresented && crServerVBoxCompositionPresentNeeded(pMural)) 1817 1817 { 1818 1818 crServerPresentFBO(pMural); … … 2207 2207 int *sIndex = (int*) data2; 2208 2208 2209 Assert(pMI->cDisabled); 2210 2209 2211 if (pMI->screenId == *sIndex) 2210 2212 { 2213 crServerVBoxCompositionDisableEnter(pMI); 2214 2211 2215 renderspuReparentWindow(pMI->spuWindow); 2216 2217 crServerVBoxCompositionDisableLeave(pMI, GL_FALSE); 2212 2218 } 2213 2219 } … … 2345 2351 fForcePresent = crServerVBoxCompositionPresentNeeded(pMI); 2346 2352 2347 crServerVBoxCompositionDisable (pMI);2353 crServerVBoxCompositionDisableEnter(pMI); 2348 2354 2349 2355 if (cr_server.fRootVrOn) … … 2403 2409 pMI->fRootVrOn = cr_server.fRootVrOn; 2404 2410 2405 crServerVBoxComposition Reenable(pMI, fForcePresent);2411 crServerVBoxCompositionDisableLeave(pMI, fForcePresent); 2406 2412 2407 2413 return rc; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r45132 r45148 112 112 } 113 113 114 crServerVBoxCompositionDisableEnter(mural); 115 114 116 if (cr_server.screenCount<2 && !cr_server.bForceOffscreenRendering) 115 117 { … … 122 124 123 125 cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y); 126 127 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 124 128 125 129 return; … … 222 226 mural->width, mural->height); 223 227 } 228 229 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 224 230 } 225 231 … … 251 257 } 252 258 253 crServerVBoxCompositionDisable (mural);259 crServerVBoxCompositionDisableEnter(mural); 254 260 255 261 if (redir) … … 258 264 { 259 265 crWarning("FBO not supported, can't redirect window output"); 266 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 260 267 return; 261 268 } … … 288 295 else 289 296 { 290 if (redir == CR_SERVER_REDIR_NONE)291 {292 /* tell renderspu we do not want compositor presentation anymore293 * renderspu will ensure its redraw thread is done with using the compositor, etc. */294 crServerVBoxCompositionDisable(mural);295 }296 297 297 if (mural->fUseFBO == CR_SERVER_REDIR_FBO_RAM) 298 298 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible); … … 315 315 316 316 mural->fUseFBO = redir; 317 crServerVBoxComposition Reenable(mural, GL_FALSE);317 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 318 318 } 319 319 … … 535 535 CRASSERT(curCtx == crStateGetCurrent()); 536 536 537 mural->fDataPresented = GL_TRUE; 538 537 539 if (currentMural) 538 540 { … … 563 565 } 564 566 565 void crServerVBoxCompositionReenable(CRMuralInfo *mural, GLboolean fForcePresent) 566 { 567 if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT || 568 (!fForcePresent 567 static void crServerVBoxCompositionReenable(CRMuralInfo *mural, GLboolean fForcePresent) 568 { 569 if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT 570 || !mural->fDataPresented 571 || (!fForcePresent 569 572 && !crServerVBoxCompositionPresentNeeded(mural))) 570 573 return; … … 573 576 } 574 577 575 void crServerVBoxCompositionDisable(CRMuralInfo *mural) 576 { 577 if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT) 578 static void crServerVBoxCompositionDisable(CRMuralInfo *mural) 579 { 580 if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT 581 || !mural->fDataPresented) 578 582 return; 579 583 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, NULL, NULL); 584 } 585 586 void crServerVBoxCompositionDisableEnter(CRMuralInfo *mural) 587 { 588 ++mural->cDisabled; 589 Assert(mural->cDisabled); 590 if (mural->cDisabled == 1) 591 { 592 crServerVBoxCompositionDisable(mural); 593 } 594 } 595 596 void crServerVBoxCompositionDisableLeave(CRMuralInfo *mural, GLboolean fForcePresentOnEnabled) 597 { 598 mural->fForcePresentState = fForcePresentOnEnabled; 599 --mural->cDisabled; 600 Assert(mural->cDisabled < UINT32_MAX/2); 601 if (!mural->cDisabled) 602 { 603 crServerVBoxCompositionReenable(mural, mural->fForcePresentState); 604 mural->fForcePresentState = GL_FALSE; 605 } 606 } 607 608 static void crServerVBoxCompositionSetEnableStateGlobalCB(unsigned long key, void *data1, void *data2) 609 { 610 CRMuralInfo *mural = (CRMuralInfo *)data1; 611 612 if (data2) 613 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 614 else 615 crServerVBoxCompositionDisableEnter(mural); 616 } 617 618 DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable) 619 { 620 crHashtableWalk(cr_server.muralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)fEnable); 621 622 crHashtableWalk(cr_server.dummyMuralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)fEnable); 580 623 } 581 624 … … 600 643 if (!crServerVBoxCompositionPresentNeeded(mural)) 601 644 return; 645 646 mural->fDataPresented = GL_TRUE; 602 647 603 648 Tex.width = mural->width; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r45132 r45148 466 466 467 467 /* 1. tell renderspu to stop using the current compositor (see above comment) */ 468 crServerVBoxCompositionDisable (mural);468 crServerVBoxCompositionDisableEnter(mural); 469 469 470 470 /* 2. do necessary modifications (see above comment) */ … … 495 495 mural->height = height; 496 496 497 mural->fDataPresented = GL_FALSE; 498 497 499 if (cr_server.currentMural == mural) 498 500 { … … 564 566 /* uncomment when needed */ 565 567 /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way 566 crServerVBoxCompositionReenable(mural); 568 567 569 */ 570 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 568 571 } 569 572 } … … 615 618 616 619 /* 1. tell renderspu to stop using the current compositor (see above comment) */ 617 crServerVBoxCompositionDisable (mural);620 crServerVBoxCompositionDisableEnter(mural); 618 621 619 622 /* 2. do necessary modifications (see above comment) */ … … 663 666 664 667 /* 3. re-set the compositor (see above comment) */ 665 crServerVBoxComposition Reenable(mural, fForcePresent);668 crServerVBoxCompositionDisableLeave(mural, fForcePresent); 666 669 } 667 670 } … … 690 693 691 694 /* 1. tell renderspu to stop using the current compositor (see above comment) */ 692 crServerVBoxCompositionDisable (mural);695 crServerVBoxCompositionDisableEnter(mural); 693 696 694 697 /* 2. do necessary modifications (see above comment) */ … … 769 772 770 773 /* 3. re-set the compositor (see above comment) */ 771 crServerVBoxComposition Reenable(mural, fForcePresent);774 crServerVBoxCompositionDisableLeave(mural, fForcePresent); 772 775 } 773 776 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r45132 r45148 656 656 { 657 657 renderspu_SystemVBoxPresentComposition(window, pChangedEntry); 658 if (CrVrScrCompositorIsEmpty(pCompositor))659 renderspuVBoxCompositorSet( window, NULL);660 658 } 661 659 } … … 978 976 int rc; 979 977 Assert(window->pCompositor); 980 if (CrVrScrCompositorIsEmpty(window->pCompositor) )978 if (CrVrScrCompositorIsEmpty(window->pCompositor) && RTCritSectGetRecursion(&window->CompositorLock) == 1) 981 979 window->pCompositor = NULL; 982 980 rc = RTCritSectLeave(&window->CompositorLock); -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r45132 r45148 1086 1086 #ifdef CR_RENDER_FORCE_PRESENT_MAIN_THREAD 1087 1087 renderspuVBoxCompositorRelease(m_pWinInfo); 1088 pCompositor = NULL; 1088 1089 #endif 1089 1090 } … … 1105 1106 { 1106 1107 glFlush(); 1108 1107 1109 /* issue to the gui thread */ 1108 1110 [self setNeedsDisplay:YES];
Note:
See TracChangeset
for help on using the changeset viewer.