Changeset 47485 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Timestamp:
- Jul 31, 2013 12:44:53 PM (11 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r46885 r47485 133 133 GLboolean crServerSupportRedirMuralFBO(void); 134 134 135 void crVBoxServerNotifyEvent(int32_t idScreen );135 void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void*pvData); 136 136 void crServerDisplayTermAll(); 137 138 void crServerWindowSize(CRMuralInfo *pMural); 139 void crServerWindowShow(CRMuralInfo *pMural); 140 void crServerWindowVisibleRegion(CRMuralInfo *pMural); 141 142 void crServerWindowSetIsVisible(CRMuralInfo *pMural, GLboolean fIsVisible); 143 void crServerWindowCheckIsVisible(CRMuralInfo *pMural); 137 144 138 145 #define CR_SERVER_REDIR_F_NONE 0x00 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
r46801 r47485 59 59 cr_server.bWindowsInitiallyHidden = GL_FALSE; 60 60 61 memset(cr_server. NotifyEventMap, 0, sizeof (cr_server.NotifyEventMap));62 cr_server.cDisableEvent = 0; 61 memset(cr_server.acVisibleWindows, 0, sizeof (cr_server.acVisibleWindows)); 62 63 63 cr_server.pfnNotifyEventCB = NULL; 64 64 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r47158 r47485 2640 2640 } 2641 2641 2642 void crVBoxServerNotifyEvent(int32_t idScreen )2642 void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void*pvData) 2643 2643 { 2644 2644 /* this is something unexpected, but just in case */ … … 2649 2649 } 2650 2650 2651 if (!cr_server.cDisableEvent) 2652 cr_server.pfnNotifyEventCB(idScreen, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_WINDOW, NULL); 2653 else 2654 ASMBitSet(cr_server.NotifyEventMap, idScreen); 2651 cr_server.pfnNotifyEventCB(idScreen, uEvent, pvData); 2655 2652 } 2656 2653 … … 2669 2666 2670 2667 renderspuReparentWindow(pMI->spuWindow); 2671 2672 if (pMI->bVisible && (pMI->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) && pMI->fHasParentWindow)2673 crVBoxServerNotifyEvent(pMI->screenId);2674 2668 2675 2669 crServerVBoxCompositionDisableLeave(pMI, GL_FALSE); … … 2827 2821 goto end; 2828 2822 } 2829 2830 rc = CrVrScrCompositorRegionsGet(&pMI->RootVrCompositor, &cRects, NULL, &pRects, NULL);2831 if (!RT_SUCCESS(rc))2832 {2833 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);2834 goto end;2835 }2836 2823 } 2837 2824 else 2838 2825 { 2839 2826 CrVrScrCompositorClear(&pMI->RootVrCompositor); 2840 rc = CrVrScrCompositorRegionsGet(&pMI->Compositor, &cRects, NULL, &pRects, NULL); 2841 if (!RT_SUCCESS(rc)) 2842 { 2843 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 2844 goto end; 2845 } 2846 } 2847 2848 cr_server.head_spu->dispatch_table.WindowVisibleRegion(pMI->spuWindow, cRects, (const GLint*)pRects); 2827 } 2849 2828 2850 2829 pMI->fRootVrOn = cr_server.fRootVrOn; 2830 2831 crServerWindowVisibleRegion(pMI); 2851 2832 2852 2833 end: -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r47158 r47485 149 149 primaryS = 0; 150 150 } 151 else 152 { 153 Assert(brS == tlS); 154 155 primaryS = brS; 156 } 157 151 158 152 159 Assert(brS == tlS); … … 186 193 } 187 194 195 CRASSERT(primaryS >= 0); 196 188 197 winID = overlappingScreenCount ? cr_server.screen[primaryS].winID : 0; 189 198 … … 196 205 renderspuReparentWindow(mural->spuWindow); 197 206 renderspuSetWindowId(cr_server.screen[0].winID); 198 199 if (mural->bVisible && (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) && mural->fHasParentWindow) 200 crVBoxServerNotifyEvent(mural->screenId); 201 } 202 203 mural->screenId = primaryS; 207 } 208 209 if (primaryS != mural->screenId) 210 { 211 /* mark it invisible on the old screen */ 212 crServerWindowSetIsVisible(mural, GL_FALSE); 213 mural->screenId = primaryS; 214 /* check if mural is visivle on the new screen, and mark it as such */ 215 crServerWindowCheckIsVisible(mural); 216 } 204 217 205 218 mural->hX = mural->gX-cr_server.screen[primaryS].x; … … 207 220 208 221 fPresentMode = cr_server.fPresentMode; 222 223 if (!mural->fHasParentWindow) 224 fPresentMode &= ~CR_SERVER_REDIR_F_DISPLAY; 225 209 226 if (!overlappingScreenCount) 210 227 fPresentMode &= ~CR_SERVER_REDIR_F_DISPLAY; … … 360 377 if (!(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY)) 361 378 { 362 if (mural->bVisible && mural->fHasParentWindow)363 {364 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_TRUE);365 crVBoxServerNotifyEvent(mural->screenId);366 }367 379 mural->fPresentMode |= CR_SERVER_REDIR_F_DISPLAY; 380 381 if (mural->bVisible) 382 crServerWindowShow(mural); 368 383 } 369 384 } … … 372 387 if ((mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY)) 373 388 { 389 mural->fPresentMode &= ~CR_SERVER_REDIR_F_DISPLAY; 390 374 391 if (mural->bVisible) 375 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_FALSE); 376 mural->fPresentMode &= ~CR_SERVER_REDIR_F_DISPLAY; 392 crServerWindowShow(mural); 377 393 } 378 394 } … … 765 781 DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable) 766 782 { 767 if (!fEnable)768 ++cr_server.cDisableEvent;769 770 783 crHashtableWalk(cr_server.muralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)(uintptr_t)fEnable); 771 784 772 785 crHashtableWalk(cr_server.dummyMuralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)(uintptr_t)fEnable); 773 774 if (fEnable)775 {776 --cr_server.cDisableEvent;777 CRASSERT(cr_server.cDisableEvent < UINT32_MAX/2);778 if(!cr_server.cDisableEvent)779 {780 int i;781 for (i = 0; i < cr_server.screenCount; ++i)782 {783 if (!ASMBitTest(cr_server.NotifyEventMap, i))784 continue;785 786 cr_server.pfnNotifyEventCB(i, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_WINDOW, NULL);787 788 ASMBitClear(cr_server.NotifyEventMap, i);789 }790 }791 }792 786 } 793 787 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r46990 r47485 10 10 #include "cr_rand.h" 11 11 #include "cr_string.h" 12 13 static GLboolean crServerWindowCalcIsVisible(CRMuralInfo *pMural) 14 { 15 uint32_t cRegions; 16 int rc; 17 if (!pMural->width || !pMural->height) 18 return GL_FALSE; 19 20 if (!pMural->bVisible || !(pMural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY)) 21 return GL_FALSE; 22 23 rc = CrVrScrCompositorRegionsGet(pMural->fRootVrOn ? &pMural->RootVrCompositor : &pMural->Compositor, &cRegions, NULL, NULL, NULL); 24 if (RT_FAILURE(rc)) 25 { 26 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 27 return GL_FALSE; 28 } 29 30 if (!cRegions) 31 return GL_FALSE; 32 33 return GL_TRUE; 34 } 35 36 void crServerWindowSetIsVisible(CRMuralInfo *pMural, GLboolean fIsVisible) 37 { 38 if (!fIsVisible == !pMural->fIsVisible) 39 return; 40 41 pMural->fIsVisible = fIsVisible; 42 43 CRASSERT(pMural->screenId < RT_ELEMENTS(cr_server.acVisibleWindows)); 44 45 if (fIsVisible) 46 { 47 ++cr_server.acVisibleWindows[pMural->screenId]; 48 if (cr_server.acVisibleWindows[pMural->screenId] == 1) 49 crVBoxServerNotifyEvent(pMural->screenId, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA, (void*)1); 50 } 51 else 52 { 53 --cr_server.acVisibleWindows[pMural->screenId]; 54 CRASSERT(cr_server.acVisibleWindows[pMural->screenId] < UINT32_MAX/2); 55 if (cr_server.acVisibleWindows[pMural->screenId] == 0) 56 crVBoxServerNotifyEvent(pMural->screenId, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA, NULL); 57 } 58 } 59 60 void crServerWindowCheckIsVisible(CRMuralInfo *pMural) 61 { 62 GLboolean fIsVisible = crServerWindowCalcIsVisible(pMural); 63 64 crServerWindowSetIsVisible(pMural, fIsVisible); 65 } 66 67 void crServerWindowSize(CRMuralInfo *pMural) 68 { 69 cr_server.head_spu->dispatch_table.WindowSize(pMural->spuWindow, pMural->width, pMural->height); 70 71 crServerWindowCheckIsVisible(pMural); 72 } 73 74 void crServerWindowShow(CRMuralInfo *pMural) 75 { 76 cr_server.head_spu->dispatch_table.WindowShow(pMural->spuWindow, 77 !!(pMural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) && pMural->bVisible); 78 79 crServerWindowCheckIsVisible(pMural); 80 } 81 82 void crServerWindowVisibleRegion(CRMuralInfo *pMural) 83 { 84 uint32_t cRects; 85 const RTRECT *pRects; 86 int rc = CrVrScrCompositorRegionsGet(pMural->fRootVrOn ? &pMural->RootVrCompositor : &pMural->Compositor, &cRects, NULL, &pRects, NULL); 87 if (RT_SUCCESS(rc)) 88 { 89 cr_server.head_spu->dispatch_table.WindowVisibleRegion(pMural->spuWindow, cRects, (const GLint*)pRects); 90 91 crServerWindowCheckIsVisible(pMural); 92 } 93 else 94 crWarning("CrVrScrCompositorRegionsGet failed rc %d", rc); 95 96 } 12 97 13 98 GLint SERVER_DISPATCH_APIENTRY … … 128 213 || pRects[0].xRight != mural->width || pRects[0].yBottom != mural->height) 129 214 { 130 /* do visible rects only i gthey differ from the default */131 cr _server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, (const GLint*)pRects);215 /* do visible rects only if they differ from the default */ 216 crServerWindowVisibleRegion(mural); 132 217 } 133 218 } … … 435 520 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height) 436 521 { 437 uint32_t cRects;438 const RTRECT *pRects;439 522 RTRECT Rect; 440 523 VBOXVR_TEXTURE Tex; … … 515 598 } 516 599 517 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRects, NULL, &pRects, NULL);518 if (!RT_SUCCESS(rc))519 {520 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc);521 goto end;522 }523 524 600 if (mural->fRootVrOn) 525 601 { … … 530 606 goto end; 531 607 } 532 533 rc = CrVrScrCompositorRegionsGet(&mural->RootVrCompositor, &cRects, NULL, &pRects, NULL);534 if (!RT_SUCCESS(rc))535 {536 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc);537 goto end;538 }539 608 } 540 609 541 610 crServerCheckMuralGeometry(mural); 542 611 543 cr _server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);544 545 cr _server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, (const GLint*)pRects);612 crServerWindowSize(mural); 613 614 crServerWindowVisibleRegion(mural); 546 615 547 616 if (mural->pvOutputRedirectInstance) 548 617 { 618 uint32_t cRects; 619 const RTRECT *pRects; 620 549 621 /* always get non-stretched rects for output redirect */ 550 622 // if (mural->fRootVrOn) … … 635 707 if (RT_SUCCESS(rc)) 636 708 { 637 rc = CrVrScrCompositorRegionsGet(&mural->RootVrCompositor, &cRects, NULL, &pRects, NULL); 638 if (RT_SUCCESS(rc)) 639 { 640 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, (const GLint*)pRects); 641 } 642 else 643 { 644 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 645 } 709 crServerWindowVisibleRegion(mural); 646 710 } 647 711 else … … 728 792 if (fRegionsChanged) 729 793 { 730 const RTRECT * pRealRects;731 uint32_t cRealRects;732 733 794 if (mural->fRootVrOn) 734 795 { … … 739 800 goto end; 740 801 } 741 742 rc = CrVrScrCompositorRegionsGet(&mural->RootVrCompositor, &cRealRects, NULL, &pRealRects, NULL); 802 } 803 804 crServerWindowVisibleRegion(mural); 805 806 if (mural->pvOutputRedirectInstance) 807 { 808 const RTRECT * pRealRects; 809 uint32_t cRealRects; 810 811 /* always get unstretched regions here */ 812 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRealRects, NULL, NULL, &pRealRects); 743 813 if (!RT_SUCCESS(rc)) 744 814 { … … 746 816 goto end; 747 817 } 748 } 749 else 750 { 751 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRealRects, NULL, &pRealRects, NULL); 752 if (!RT_SUCCESS(rc)) 753 { 754 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 755 goto end; 756 } 757 } 758 759 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRealRects, (const GLint*)pRealRects); 760 761 if (mural->pvOutputRedirectInstance) 762 { 763 // if (mural->fRootVrOn) 764 { 765 /* always get unstretched regions here */ 766 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRealRects, NULL, NULL, &pRealRects); 767 if (!RT_SUCCESS(rc)) 768 { 769 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 770 goto end; 771 } 772 } 818 773 819 /* @todo the code assumes that RTRECT == four GLInts. */ 774 820 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, cRealRects, pRealRects); … … 796 842 void crServerMuralShow( CRMuralInfo *mural, GLint state ) 797 843 { 844 mural->bVisible = !!state; 845 798 846 if (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) 799 { 800 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state); 801 802 if (state && mural->fHasParentWindow) 803 crVBoxServerNotifyEvent(mural->screenId); 804 } 805 806 mural->bVisible = !!state; 847 crServerWindowShow(mural); 807 848 } 808 849
Note:
See TracChangeset
for help on using the changeset viewer.