Changeset 46885 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Timestamp:
- Jul 1, 2013 2:02:37 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86869
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r46802 r46885 113 113 GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID); 114 114 GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID); 115 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean f SetVRegs);115 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fUseDefaultDEntry); 116 116 void crServerMuralTerm(CRMuralInfo *mural); 117 117 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height); 118 int crServerMuralSynchRootVr(CRMuralInfo *mural, uint32_t *pcRects, const RTRECT **ppRects); 118 void crServerMutalPosition(CRMuralInfo *mural, GLint x, GLint y); 119 void crServerMuralVisibleRegion( CRMuralInfo *mural, GLint cRects, const GLint *pRects ); 120 void crServerMuralShow( CRMuralInfo *mural, GLint state ); 121 int crServerMuralSynchRootVr(CRMuralInfo *mural); 119 122 120 123 GLint crServerGenerateID(GLint *pCounter); … … 186 189 && mural->width 187 190 && mural->height 188 && !mural->fRootVrOn ? CrVrScrCompositorEntryIsInList(&mural->CEntry) : CrVrScrCompositorEntryIsInList(&mural->RootVrCEntry);191 && !mural->fRootVrOn ? !CrVrScrCompositorIsEmpty(&mural->Compositor) : !CrVrScrCompositorIsEmpty(&mural->RootVrCompositor); 189 192 } 190 193 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r46801 r46885 2797 2797 PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex); 2798 2798 if (pDisplay) 2799 CrDpResize(pDisplay, w, h, w, h);2799 CrDpResize(pDisplay, x, y, w, h); 2800 2800 } 2801 2801 … … 2818 2818 if (!pMI->fRootVrOn) 2819 2819 { 2820 VBOXVR_TEXTURE Tex = {0}; 2821 2822 rc = CrVrScrCompositorInit(&pMI->RootVrCompositor); 2823 if (!RT_SUCCESS(rc)) 2824 { 2825 crWarning("CrVrScrCompositorInit failed, rc %d", rc); 2826 goto end; 2827 } 2828 2829 2830 Tex.width = pMI->width; 2831 Tex.height = pMI->height; 2832 Tex.target = GL_TEXTURE_2D; 2833 Tex.hwid = 0; 2834 CrVrScrCompositorEntryInit(&pMI->RootVrCEntry, &Tex); 2835 } 2836 2837 rc = crServerMuralSynchRootVr(pMI, &cRects, &pRects); 2820 CrVrScrCompositorInit(&pMI->RootVrCompositor); 2821 } 2822 2823 rc = crServerMuralSynchRootVr(pMI); 2838 2824 if (!RT_SUCCESS(rc)) 2839 2825 { … … 2842 2828 } 2843 2829 2844 if (!pMI->fRootVrOn) 2845 { 2846 rc = CrVrScrCompositorEntryTexUpdate(&pMI->RootVrCompositor, &pMI->RootVrCEntry, CrVrScrCompositorEntryTexGet(&pMI->CEntry)); 2847 if (!RT_SUCCESS(rc)) 2848 { 2849 crWarning("CrVrScrCompositorEntryTexUpdate failed, rc %d", rc); 2850 goto end; 2851 } 2852 } 2853 } 2854 else 2855 { 2856 CrVrScrCompositorTerm(&pMI->RootVrCompositor); 2857 rc = CrVrScrCompositorEntryRegionsGet(&pMI->Compositor, &pMI->CEntry, &cRects, NULL, &pRects); 2830 rc = CrVrScrCompositorRegionsGet(&pMI->RootVrCompositor, &cRects, NULL, &pRects, NULL); 2858 2831 if (!RT_SUCCESS(rc)) 2859 2832 { … … 2861 2834 goto end; 2862 2835 } 2863 2864 /* CEntry should always be in sync */ 2865 // rc = CrVrScrCompositorEntryTexUpdate(&pMI->Compositor, &pMI->CEntry, CrVrScrCompositorEntryTexGet(&pMI->RootVrCEntry)); 2866 // if (!RT_SUCCESS(rc)) 2867 // { 2868 // crWarning("CrVrScrCompositorEntryTexUpdate failed, rc %d", rc); 2869 // goto end; 2870 // } 2836 } 2837 else 2838 { 2839 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 } 2871 2846 } 2872 2847 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r46343 r46885 90 90 const RTRECT *pRects; 91 91 92 int rc = CrVrScrCompositor EntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);92 int rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRects, NULL, &pRects, NULL); 93 93 if (!RT_SUCCESS(rc)) 94 94 { … … 120 120 CRASSERT(mural->spuWindow != CR_RENDER_DEFAULT_WINDOW_ID); 121 121 122 crServerVBoxCompositionDisableEnter(mural); 123 122 124 if (!mural->width || !mural->height) 123 125 { 124 126 crServerRedirMuralFBO(mural, CR_SERVER_REDIR_F_NONE); 125 127 crServerDeleteMuralFBO(mural); 126 return; 127 } 128 129 crServerVBoxCompositionDisableEnter(mural); 128 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 129 return; 130 } 130 131 131 132 tlS = crServerGetPointScreen(mural->gX, mural->gY); … … 208 209 else if (overlappingScreenCount > 1) 209 210 fPresentMode = (fPresentMode | CR_SERVER_REDIR_F_FBO_RAM_VMFB | cr_server.fVramPresentModeDefault) & ~CR_SERVER_REDIR_F_DISPLAY; 211 212 if (!mural->fUseDefaultDEntry) 213 { 214 /* only display matters */ 215 fPresentMode &= CR_SERVER_REDIR_F_DISPLAY; 216 } 210 217 211 218 fPresentMode = crServerRedirModeAdjust(fPresentMode); … … 453 460 CRASSERT(mural->aidFBOs[0]==0); 454 461 CRASSERT(mural->aidFBOs[1]==0); 455 CRASSERT(mural->width == mural->CEntry.Tex.width); 456 CRASSERT(mural->height == mural->CEntry.Tex.height); 462 CRASSERT(mural->fUseDefaultDEntry); 463 CRASSERT(mural->width == mural->DefaultDEntry.CEntry.Tex.width); 464 CRASSERT(mural->height == mural->DefaultDEntry.CEntry.Tex.height); 457 465 458 466 pMuralContextInfo = cr_server.currentCtxInfo; … … 566 574 CRASSERT(mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 567 575 568 CrVrScrCompositorEntryTexNameUpdate(&mural-> CEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]);569 570 if (mural->fRootVrOn)571 CrVrScrCompositorEntryTexNameUpdate(&mural->RootVrCEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]);576 CrVrScrCompositorEntryTexNameUpdate(&mural->DefaultDEntry.CEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 577 578 // if (mural->fRootVrOn) 579 // CrVrScrCompositorEntryTexNameUpdate(&mural->DefaultDEntry.RootVrCEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 572 580 } 573 581 … … 668 676 CRASSERT(curCtx == crStateGetCurrent()); 669 677 670 Assert( mural->fPresentMode & CR_SERVER_REDIR_F_FBO);678 Assert((mural->fPresentMode & CR_SERVER_REDIR_F_FBO) || !mural->fUseDefaultDEntry); 671 679 Assert(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY); 672 680 … … 687 695 688 696 if (!mural->fRootVrOn) 689 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry);697 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, NULL); 690 698 else 691 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->RootVrCompositor, &mural->RootVrCEntry);699 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->RootVrCompositor, NULL); 692 700 693 701 crStateSwitchPostprocess(curCtx, NULL, idDrawFBO, idReadFBO); … … 703 711 static void crServerVBoxCompositionReenable(CRMuralInfo *mural, GLboolean fForcePresent) 704 712 { 705 if ((mural->fPresentMode & (CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY)) != (CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY) 713 if (!(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) 714 || (mural->fUseDefaultDEntry && !(mural->fPresentMode & CR_SERVER_REDIR_F_FBO)) 706 715 || !mural->fDataPresented 707 716 || (!fForcePresent … … 1036 1045 } 1037 1046 Assert(mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 1038 CrVrScrCompositorEntryTexNameUpdate(&mural->CEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 1047 Assert(mural->fUseDefaultDEntry); 1048 CrVrScrCompositorEntryTexNameUpdate(&mural->DefaultDEntry.CEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 1039 1049 if (mural->fRootVrOn) 1040 CrVrScrCompositorEntryTexNameUpdate(&mural-> RootVrCEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]);1041 } 1050 CrVrScrCompositorEntryTexNameUpdate(&mural->DefaultDEntry.RootVrCEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 1051 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r46801 r46885 68 68 return VERR_GENERAL_FAILURE; 69 69 } 70 70 pDisplay->fForcePresent = GL_FALSE; 71 71 return VINF_SUCCESS; 72 72 } … … 77 77 } 78 78 79 void CrDpResize(PCR_DISPLAY pDisplay, uint32_t width, uint32_t height, 80 uint32_t stretchedWidth, uint32_t stretchedHeight) 81 { 82 float StretchX, StretchY; 83 StretchX = ((float)stretchedWidth)/width; 84 StretchY = ((float)stretchedHeight)/height; 85 crServerMuralSize(&pDisplay->Mural, stretchedWidth, stretchedHeight); 86 CrVrScrCompositorSetStretching(&pDisplay->Mural.Compositor, StretchX, StretchY); 79 void CrDpResize(PCR_DISPLAY pDisplay, int32_t xPos, int32_t yPos, uint32_t width, uint32_t height) 80 { 81 crServerMuralVisibleRegion(&pDisplay->Mural, 0, NULL); 82 crServerMutalPosition(&pDisplay->Mural, xPos, yPos); 83 crServerMuralSize(&pDisplay->Mural, width, height); 84 crServerMuralShow(&pDisplay->Mural, GL_TRUE); 85 CrVrScrCompositorSetStretching(&pDisplay->Mural.Compositor, 1., 1.); 87 86 } 88 87 89 88 int CrDpEntryRegionsSet(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 90 89 { 91 int rc = CrVrScrCompositorEntryRegionsSet(&pDisplay->Mural.Compositor, pEntry ? &pEntry->CEntry : NULL, pPos, cRegions, paRegions, NULL);90 int rc = CrVrScrCompositorEntryRegionsSet(&pDisplay->Mural.Compositor, pEntry ? &pEntry->CEntry : NULL, pPos, cRegions, paRegions, false, NULL); 92 91 return rc; 93 92 } 94 93 94 void crDbgDumpRect(uint32_t i, const RTRECT *pRect) 95 { 96 crDebug("%d: (%d;%d) X (%d;%d)", i, pRect->xLeft, pRect->yTop, pRect->xRight, pRect->yBottom); 97 } 98 99 void crDbgDumpRects(uint32_t cRects, const RTRECT *paRects) 100 { 101 crDebug("Dumping rects (%d)", cRects); 102 for (uint32_t i = 0; i < cRects; ++i) 103 { 104 crDbgDumpRect(i, &paRects[i]); 105 } 106 crDebug("End Dumping rects (%d)", cRects); 107 } 108 95 109 int CrDpEntryRegionsAdd(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 96 110 { 97 int rc = CrVrScrCompositorEntryRegionsAdd(&pDisplay->Mural.Compositor, pEntry ? &pEntry->CEntry : NULL, pPos, cRegions, paRegions, NULL); 111 uint32_t fChangeFlags = 0; 112 int rc = CrVrScrCompositorEntryRegionsAdd(&pDisplay->Mural.Compositor, pEntry ? &pEntry->CEntry : NULL, pPos, cRegions, paRegions, false, &fChangeFlags); 113 if (RT_SUCCESS(rc)) 114 { 115 if (fChangeFlags & VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED) 116 { 117 uint32_t cRects; 118 const RTRECT *pRects; 119 rc = CrVrScrCompositorRegionsGet(&pDisplay->Mural.Compositor, &cRects, NULL, &pRects, NULL); 120 if (RT_SUCCESS(rc)) 121 crServerMuralVisibleRegion(&pDisplay->Mural, cRects, (GLint *)pRects); 122 else 123 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 124 } 125 } 126 else 127 crWarning("CrVrScrCompositorEntryRegionsAdd failed, rc %d", rc); 128 98 129 return rc; 99 130 } 100 131 132 void CrDpEntryRegionsClear(PCR_DISPLAY pDisplay) 133 { 134 bool fChanged = false; 135 CrVrScrCompositorRegionsClear(&pDisplay->Mural.Compositor, &fChanged); 136 if (fChanged) 137 { 138 crServerMuralVisibleRegion(&pDisplay->Mural, 0, NULL); 139 } 140 } 141 101 142 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData) 102 143 { 103 144 CrVrScrCompositorEntryInit(&pEntry->CEntry, pTextureData); 145 CrVrScrCompositorEntryFlagsSet(&pEntry->CEntry, CRBLT_F_INVERT_SRC_YCOORDS); 146 CrVrScrCompositorEntryInit(&pEntry->RootVrCEntry, pTextureData); 147 CrVrScrCompositorEntryFlagsSet(&pEntry->RootVrCEntry, CRBLT_F_INVERT_SRC_YCOORDS); 104 148 } 105 149 … … 111 155 void CrDpEnter(PCR_DISPLAY pDisplay) 112 156 { 157 pDisplay->fForcePresent = crServerVBoxCompositionPresentNeeded(&pDisplay->Mural); 113 158 crServerVBoxCompositionDisableEnter(&pDisplay->Mural); 114 159 } … … 117 162 { 118 163 pDisplay->Mural.fDataPresented = GL_TRUE; 119 crServerVBoxCompositionDisableLeave(&pDisplay->Mural, GL_FALSE);164 crServerVBoxCompositionDisableLeave(&pDisplay->Mural, pDisplay->fForcePresent); 120 165 } 121 166 … … 199 244 } 200 245 201 #define CR_PRESENT_SCREEN_MASK 0xffff202 #define CR_PRESENT_FLAGS_OFFSET 16203 204 #define CR_PRESENT_GET_SCREEN(_cfg) ((_cfg) & CR_PRESENT_SCREEN_MASK)205 #define CR_PRESENT_GET_FLAGS(_cfg) ((_cfg) >> CR_PRESENT_FLAGS_OFFSET)206 207 246 PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen) 208 247 { … … 222 261 if (ASMBitTest(cr_server.DisplaysInitMap, idScreen)) 223 262 return &cr_server.aDispplays[idScreen]; 224 225 /* the display (screen id == 0) can be initialized while doing crServerCheckInitDisplayBlitter,226 * so re-check the bit map */227 if (ASMBitTest(cr_server.DisplaysInitMap, idScreen))228 return &cr_server.aDispplays[idScreen];229 263 230 264 int rc = CrDpInit(&cr_server.aDispplays[idScreen]); … … 232 266 { 233 267 CrDpResize(&cr_server.aDispplays[idScreen], 234 cr_server.screen[idScreen]. w, cr_server.screen[idScreen].h,268 cr_server.screen[idScreen].x, cr_server.screen[idScreen].y, 235 269 cr_server.screen[idScreen].w, cr_server.screen[idScreen].h); 236 270 ASMBitSet(cr_server.DisplaysInitMap, idScreen); … … 388 422 CrDpEnter(pDisplay); 389 423 390 RTPOINT Point = {xPos, yPos}; 391 int rc = CrDpEntryRegionsAdd(pDisplay, pEntry, &Point, (uint32_t)cRects, (const RTRECT*)pRects); 392 if (!RT_SUCCESS(rc)) 393 { 394 crWarning("CrDpEntrySetRegions Failed rc %d", rc); 395 return; 424 if (!(cfg & CR_PRESENT_FLAG_CLEAR_RECTS)) 425 { 426 RTPOINT Point = {xPos, yPos}; 427 int rc = CrDpEntryRegionsAdd(pDisplay, pEntry, &Point, (uint32_t)cRects, (const RTRECT*)pRects); 428 if (!RT_SUCCESS(rc)) 429 { 430 crWarning("CrDpEntrySetRegions Failed rc %d", rc); 431 return; 432 } 433 } 434 else 435 { 436 CrDpEntryRegionsClear(pDisplay); 396 437 } 397 438 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r46801 r46885 17 17 } 18 18 19 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean f SetVRegs)19 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fUseDefaultDEntry) 20 20 { 21 21 CRMuralInfo *defaultMural; … … 23 23 GLint windowID = -1; 24 24 GLint spuWindow; 25 VBOXVR_TEXTURE Tex = {0};26 25 int rc; 27 26 28 27 crMemset(mural, 0, sizeof (*mural)); 29 28 30 rc = CrVrScrCompositorInit(&mural->Compositor); 31 if (!RT_SUCCESS(rc)) 32 { 33 crWarning("CrVrScrCompositorInit failed, rc %d", rc); 34 return -1; 35 } 29 CrVrScrCompositorInit(&mural->Compositor); 36 30 37 31 if (cr_server.fRootVrOn) 38 32 { 39 rc = CrVrScrCompositorInit(&mural->RootVrCompositor); 40 if (!RT_SUCCESS(rc)) 41 { 42 crWarning("CrVrScrCompositorInit failed, rc %d", rc); 43 return -1; 44 } 33 CrVrScrCompositorInit(&mural->RootVrCompositor); 45 34 } 46 35 … … 50 39 spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, visBits ); 51 40 if (spuWindow < 0) { 52 CrVrScrCompositor Term(&mural->Compositor);41 CrVrScrCompositorClear(&mural->Compositor); 53 42 if (cr_server.fRootVrOn) 54 CrVrScrCompositor Term(&mural->RootVrCompositor);43 CrVrScrCompositorClear(&mural->RootVrCompositor); 55 44 return spuWindow; 56 45 } … … 59 48 cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, spuWindow, GL_INT, 2, dims); 60 49 61 Tex.width = dims[0]; 62 Tex.height = dims[1]; 63 Tex.target = GL_TEXTURE_2D; 64 Tex.hwid = 0; 65 CrVrScrCompositorEntryInit(&mural->CEntry, &Tex); 66 67 if (cr_server.fRootVrOn) 68 { 69 CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex); 70 mural->fRootVrOn = GL_TRUE; 50 if (fUseDefaultDEntry) 51 { 52 VBOXVR_TEXTURE Tex = {0}; 53 Tex.width = dims[0]; 54 Tex.height = dims[1]; 55 Tex.target = GL_TEXTURE_2D; 56 Tex.hwid = 0; 57 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex); 58 59 if (cr_server.fRootVrOn) 60 { 61 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.RootVrCEntry, &Tex); 62 mural->fRootVrOn = GL_TRUE; 63 } 71 64 } 72 65 … … 81 74 mural->screenId = 0; 82 75 mural->fHasParentWindow = !!cr_server.screen[0].winID; 83 mural->bVisible = cr_server.bWindowsInitiallyHidden;76 mural->bVisible = !cr_server.bWindowsInitiallyHidden; 84 77 mural->fPresentMode = CR_SERVER_REDIR_F_NONE; 85 78 … … 102 95 CR_STATE_SHAREDOBJ_USAGE_INIT(mural); 103 96 104 if (f SetVRegs)97 if (fUseDefaultDEntry) 105 98 { 106 99 RTRECT Rect; … … 109 102 Rect.yTop = 0; 110 103 Rect.yBottom = mural->height; 111 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural-> CEntry, NULL, 1, &Rect, NULL);104 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->DefaultDEntry.CEntry, NULL, 1, &Rect, false, NULL); 112 105 if (!RT_SUCCESS(rc)) 113 106 { … … 123 116 uint32_t cRects; 124 117 const RTRECT *pRects; 125 int rc = crServerMuralSynchRootVr(mural , &cRects, &pRects);118 int rc = crServerMuralSynchRootVr(mural); 126 119 if (RT_SUCCESS(rc)) 127 120 { 128 if (cRects != 1 129 || pRects[0].xLeft != 0 || pRects[0].yTop != 0 130 || pRects[0].xRight != mural->width || pRects[0].yBottom != mural->height) 131 { 132 /* do visible rects only ig they differ from the default */ 133 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, (const GLint*)pRects); 121 rc = CrVrScrCompositorRegionsGet(&mural->RootVrCompositor, &cRects, NULL, &pRects, NULL); 122 if (RT_SUCCESS(rc)) 123 { 124 if (cRects != 1 125 || pRects[0].xLeft != 0 || pRects[0].yTop != 0 126 || pRects[0].xRight != mural->width || pRects[0].yBottom != mural->height) 127 { 128 /* do visible rects only ig they differ from the default */ 129 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, (const GLint*)pRects); 130 } 131 } 132 else 133 { 134 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 134 135 } 135 136 } … … 296 297 crFree(mural->CreateInfo.pszDpyName); 297 298 298 CrVrScrCompositor Term(&mural->Compositor);299 CrVrScrCompositorClear(&mural->Compositor); 299 300 300 301 if (mural->fRootVrOn) 301 CrVrScrCompositor Term(&mural->RootVrCompositor);302 CrVrScrCompositorClear(&mural->RootVrCompositor); 302 303 } 303 304 … … 401 402 } 402 403 403 int crServerMuralSynchRootVr(CRMuralInfo *mural, uint32_t *pcRects, const RTRECT **ppRects) 404 #define CR_DENTRY_FROM_CENTRY(_pCentry) ((CR_DISPLAY_ENTRY*)((uint8_t*)(_pCentry) - RT_OFFSETOF(CR_DISPLAY_ENTRY, CEntry))) 405 406 static DECLCALLBACK(VBOXVR_SCR_COMPOSITOR_ENTRY*) crServerMuralGetRootVrCEntry(VBOXVR_SCR_COMPOSITOR_ENTRY*pEntry, void *pvContext) 407 { 408 CR_DISPLAY_ENTRY *pDEntry = CR_DENTRY_FROM_CENTRY(pEntry); 409 CrVrScrCompositorEntryInit(&pDEntry->RootVrCEntry, CrVrScrCompositorEntryTexGet(pEntry)); 410 return &pDEntry->RootVrCEntry; 411 } 412 413 int crServerMuralSynchRootVr(CRMuralInfo *mural) 404 414 { 405 415 int rc; 406 416 407 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, pcRects, NULL, ppRects); 417 crServerVBoxRootVrTranslateForMural(mural); 418 419 rc = CrVrScrCompositorIntersectedList(&mural->Compositor, &cr_server.RootVr, &mural->RootVrCompositor, crServerMuralGetRootVrCEntry, NULL, NULL); 408 420 if (!RT_SUCCESS(rc)) 409 421 { 410 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 411 return rc; 412 } 413 414 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, *pcRects, *ppRects, NULL); 415 if (!RT_SUCCESS(rc)) 416 { 417 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 418 return rc; 419 } 420 421 crServerVBoxRootVrTranslateForMural(mural); 422 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL); 423 if (!RT_SUCCESS(rc)) 424 { 425 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 426 return rc; 427 } 428 429 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, pcRects, NULL, ppRects); 430 if (!RT_SUCCESS(rc)) 431 { 432 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 422 crWarning("CrVrScrCompositorIntersectedList failed, rc %d", rc); 433 423 return rc; 434 424 } … … 468 458 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 469 459 /* CrVrScrCompositorLock(&mural->Compositor); */ 470 if (!mural->bReceivedRects) 471 { 472 rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry); 473 if (!RT_SUCCESS(rc)) 474 { 475 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc); 476 goto end; 477 } 478 CrVrScrCompositorEntryInit(&mural->CEntry, &Tex); 479 /* initially set regions to all visible since this is what some guest assume 480 * and will not post any more visible regions command */ 481 Rect.xLeft = 0; 482 Rect.xRight = width; 483 Rect.yTop = 0; 484 Rect.yBottom = height; 485 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL); 486 if (!RT_SUCCESS(rc)) 487 { 488 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 489 goto end; 460 if (mural->fUseDefaultDEntry) 461 { 462 if (!mural->bReceivedRects) 463 { 464 rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->DefaultDEntry.CEntry); 465 if (!RT_SUCCESS(rc)) 466 { 467 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc); 468 goto end; 469 } 470 CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex); 471 /* initially set regions to all visible since this is what some guest assume 472 * and will not post any more visible regions command */ 473 Rect.xLeft = 0; 474 Rect.xRight = width; 475 Rect.yTop = 0; 476 Rect.yBottom = height; 477 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->DefaultDEntry.CEntry, NULL, 1, &Rect, false, NULL); 478 if (!RT_SUCCESS(rc)) 479 { 480 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 481 goto end; 482 } 483 } 484 else 485 { 486 rc = CrVrScrCompositorEntryTexUpdate(&mural->Compositor, &mural->DefaultDEntry.CEntry, &Tex); 487 if (!RT_SUCCESS(rc)) 488 { 489 crWarning("CrVrScrCompositorEntryTexUpdate failed, rc %d", rc); 490 goto end; 491 } 490 492 } 491 493 } 492 494 else 493 495 { 494 rc = CrVrScrCompositorEntryTexUpdate(&mural->Compositor, &mural->CEntry, &Tex); 495 if (!RT_SUCCESS(rc)) 496 { 497 crWarning("CrVrScrCompositorEntryTexUpdate failed, rc %d", rc); 498 goto end; 499 } 496 CrVrScrCompositorClear(&mural->Compositor); 500 497 } 501 498 … … 512 509 } 513 510 514 rc = CrVrScrCompositor EntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);511 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRects, NULL, &pRects, NULL); 515 512 if (!RT_SUCCESS(rc)) 516 513 { 517 crWarning("CrVrScrCompositor EntryRegionsGet failed, rc %d", rc);514 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 518 515 goto end; 519 516 } … … 521 518 if (mural->fRootVrOn) 522 519 { 523 rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry);520 rc = crServerMuralSynchRootVr(mural); 524 521 if (!RT_SUCCESS(rc)) 525 522 { 526 crWarning(" CrVrScrCompositorEntryRemovefailed, rc %d", rc);523 crWarning("crServerMuralSynchRootVr failed, rc %d", rc); 527 524 goto end; 528 525 } 529 CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex); 530 531 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, cRects, pRects, NULL); 526 527 rc = CrVrScrCompositorRegionsGet(&mural->RootVrCompositor, &cRects, NULL, &pRects, NULL); 532 528 if (!RT_SUCCESS(rc)) 533 529 { 534 crWarning("CrVrScrCompositor EntryRegionsSet failed, rc %d", rc);530 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 535 531 goto end; 536 532 } 537 538 crServerVBoxRootVrTranslateForMural(mural);539 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL);540 if (!RT_SUCCESS(rc))541 {542 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);543 goto end;544 }545 546 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects);547 if (!RT_SUCCESS(rc))548 {549 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);550 goto end;551 }552 }553 else554 {555 533 } 556 534 … … 563 541 if (mural->pvOutputRedirectInstance) 564 542 { 565 if (mural->fRootVrOn) 566 { 567 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects); 543 /* always get non-stretched rects for output redirect */ 544 // if (mural->fRootVrOn) 545 { 546 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRects, NULL, NULL, &pRects); 568 547 if (!RT_SUCCESS(rc)) 569 548 { 570 crWarning("CrVrScrCompositor EntryRegionsGet failed, rc %d", rc);549 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 571 550 goto end; 572 551 } … … 609 588 } 610 589 611 612 void SERVER_DISPATCH_APIENTRY 613 crServerDispatchWindowPosition( GLint window, GLint x, GLint y ) 614 { 615 CRMuralInfo *mural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, window); 590 void crServerMutalPosition(CRMuralInfo *mural, GLint x, GLint y) 591 { 616 592 GLboolean fForcePresent = GL_FALSE; 617 593 /* crDebug("CRServer: Window %d pos %d, %d", window, x, y);*/ 618 if (!mural) { 619 #if EXTRA_WARN 620 crWarning("CRServer: invalid window %d passed to WindowPosition()", window); 621 #endif 622 return; 623 } 594 624 595 // if (mural->gX != x || mural->gY != y) 625 596 { … … 648 619 mural->gY = y; 649 620 650 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */651 /* CrVrScrCompositorLock(&mural->Compositor); */652 621 /* no need to set position because the position is relative to window */ 653 622 /*CrVrScrCompositorEntryPosSet(&mural->Compositor, &mural->CEntry, &Pos);*/ 654 /*CrVrScrCompositorUnlock(&mural->Compositor);*/655 623 656 624 if (mural->fRootVrOn) … … 658 626 uint32_t cRects; 659 627 const RTRECT *pRects; 660 int rc = crServerMuralSynchRootVr(mural, &cRects, &pRects); 661 628 int rc = crServerMuralSynchRootVr(mural); 662 629 if (RT_SUCCESS(rc)) 663 630 { 664 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, (const GLint*)pRects); 631 rc = CrVrScrCompositorRegionsGet(&mural->RootVrCompositor, &cRects, NULL, &pRects, NULL); 632 if (RT_SUCCESS(rc)) 633 { 634 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, (const GLint*)pRects); 635 } 636 else 637 { 638 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 639 } 665 640 } 666 641 else … … 679 654 680 655 void SERVER_DISPATCH_APIENTRY 681 crServerDispatchWindow VisibleRegion( GLint window, GLint cRects, const GLint *pRects)656 crServerDispatchWindowPosition( GLint window, GLint x, GLint y ) 682 657 { 683 658 CRMuralInfo *mural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, window); 659 if (!mural) { 660 #if EXTRA_WARN 661 crWarning("CRServer: invalid window %d passed to WindowPosition()", window); 662 #endif 663 return; 664 } 665 crServerMutalPosition(mural, x, y); 666 } 667 668 void crServerMuralVisibleRegion( CRMuralInfo *mural, GLint cRects, const GLint *pRects ) 669 { 684 670 GLboolean fForcePresent = crServerVBoxCompositionPresentNeeded(mural); 685 671 bool fRegionsChanged = false; 686 672 int rc = VINF_SUCCESS; 687 if (!mural) {688 #if EXTRA_WARN689 crWarning("CRServer: invalid window %d passed to WindowVisibleRegion()", window);690 #endif691 return;692 }693 673 694 674 /* since we're going to change the current compositor & the window we need to avoid … … 722 702 } 723 703 724 /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */ 725 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 726 /* CrVrScrCompositorLock(&mural->Compositor); */ 727 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, cRects, (const RTRECT *)pRects, &fRegionsChanged); 728 /*CrVrScrCompositorUnlock(&mural->Compositor);*/ 729 if (!RT_SUCCESS(rc)) 730 { 731 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 732 goto end; 704 if (mural->fUseDefaultDEntry) 705 { 706 /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */ 707 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 708 /* CrVrScrCompositorLock(&mural->Compositor); */ 709 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->DefaultDEntry.CEntry, NULL, cRects, (const RTRECT *)pRects, false, &fRegionsChanged); 710 /*CrVrScrCompositorUnlock(&mural->Compositor);*/ 711 if (!RT_SUCCESS(rc)) 712 { 713 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 714 goto end; 715 } 716 } 717 else 718 { 719 fRegionsChanged = true; 733 720 } 734 721 … … 740 727 if (mural->fRootVrOn) 741 728 { 742 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, cRects, (const RTRECT *)pRects, NULL);729 rc = rc = crServerMuralSynchRootVr(mural); 743 730 if (!RT_SUCCESS(rc)) 744 731 { 745 crWarning(" CrVrScrCompositorEntryRegionsSetfailed, rc %d", rc);732 crWarning("crServerMuralSynchRootVr failed, rc %d", rc); 746 733 goto end; 747 734 } 748 735 749 crServerVBoxRootVrTranslateForMural(mural); 750 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL); 736 rc = CrVrScrCompositorRegionsGet(&mural->RootVrCompositor, &cRealRects, NULL, &pRealRects, NULL); 751 737 if (!RT_SUCCESS(rc)) 752 738 { 753 crWarning("CrVrScrCompositor EntryRegionsSet failed, rc %d", rc);739 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 754 740 goto end; 755 741 } 756 757 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRealRects, NULL, &pRealRects); 742 } 743 else 744 { 745 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRealRects, NULL, &pRealRects, NULL); 758 746 if (!RT_SUCCESS(rc)) 759 747 { 760 crWarning("CrVrScrCompositor EntryRegionsGet failed, rc %d", rc);748 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 761 749 goto end; 762 750 } 763 751 } 764 else765 {766 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRealRects, NULL, &pRealRects);767 if (!RT_SUCCESS(rc))768 {769 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);770 goto end;771 }772 }773 752 774 753 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRealRects, (const GLint*)pRealRects); … … 776 755 if (mural->pvOutputRedirectInstance) 777 756 { 778 if (mural->fRootVrOn) 779 { 780 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRealRects, NULL, &pRealRects); 757 // if (mural->fRootVrOn) 758 { 759 /* always get unstretched regions here */ 760 rc = CrVrScrCompositorRegionsGet(&mural->Compositor, &cRealRects, NULL, NULL, &pRealRects); 781 761 if (!RT_SUCCESS(rc)) 782 762 { 783 crWarning("CrVrScrCompositor EntryRegionsGet failed, rc %d", rc);763 crWarning("CrVrScrCompositorRegionsGet failed, rc %d", rc); 784 764 goto end; 785 765 } … … 792 772 /* 3. re-set the compositor (see above comment) */ 793 773 crServerVBoxCompositionDisableLeave(mural, fForcePresent); 774 } 775 776 void SERVER_DISPATCH_APIENTRY 777 crServerDispatchWindowVisibleRegion( GLint window, GLint cRects, const GLint *pRects ) 778 { 779 CRMuralInfo *mural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, window); 780 if (!mural) { 781 #if EXTRA_WARN 782 crWarning("CRServer: invalid window %d passed to WindowVisibleRegion()", window); 783 #endif 784 return; 785 } 786 787 crServerMuralVisibleRegion( mural, cRects, pRects ); 788 } 789 790 void crServerMuralShow( CRMuralInfo *mural, GLint state ) 791 { 792 if (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) 793 { 794 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state); 795 796 if (state && mural->fHasParentWindow) 797 crVBoxServerNotifyEvent(mural->screenId); 798 } 799 800 mural->bVisible = !!state; 794 801 } 795 802 … … 805 812 } 806 813 807 if (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) 808 { 809 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state); 810 811 if (state && mural->fHasParentWindow) 812 crVBoxServerNotifyEvent(mural->screenId); 813 } 814 815 mural->bVisible = !!state; 816 } 817 814 crServerMuralShow( mural, state ); 815 } 818 816 819 817 GLint
Note:
See TracChangeset
for help on using the changeset viewer.