Changeset 51442 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- May 28, 2014 11:09:30 AM (11 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r51432 r51442 2501 2501 { 2502 2502 mFlags.fForcePresentOnReenable = false; 2503 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, mpCompositor, NULL); 2503 if (mpCompositor) 2504 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, mpCompositor, NULL); 2505 else 2506 { 2507 VBOXVR_SCR_COMPOSITOR TmpCompositor; 2508 RTRECT Rect; 2509 Rect.xLeft = 0; 2510 Rect.yTop = 0; 2511 Rect.xRight = mWidth; 2512 Rect.yBottom = mHeight; 2513 CrVrScrCompositorInit(&TmpCompositor, &Rect); 2514 /* this is a cleanup operation 2515 * empty compositor is guarantid to be released on VBoxPresentComposition return */ 2516 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, mpCompositor, NULL); 2517 } 2504 2518 g_pLed->Asserted.s.fWriting = 1; 2505 2519 } -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r51349 r51442 450 450 crMemset(window, 0, sizeof (*window)); 451 451 RTCritSectInit(&window->CompositorLock); 452 window->fCompositorPresentEmpty = GL_FALSE;453 452 window->pCompositor = NULL; 454 453 … … 777 776 window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win); 778 777 if (window) { 779 if (pCompositor && CrVrScrCompositorIsEmpty(pCompositor) && !window->fCompositorPresentEmpty) 780 pCompositor = NULL; 781 782 if (pCompositor) 783 window->fCompositorPresentEmpty = GL_FALSE; 784 785 renderspuVBoxCompositorSet( window, pCompositor); 786 if (pCompositor) 778 if (renderspuVBoxCompositorSet(window, pCompositor)) 787 779 { 788 780 renderspu_SystemVBoxPresentComposition(window, pChangedEntry); … … 1016 1008 } 1017 1009 1018 voidrenderspuVBoxCompositorSet( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor)1010 GLboolean renderspuVBoxCompositorSet( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor) 1019 1011 { 1020 1012 int rc; 1013 GLboolean fEmpty = pCompositor && CrVrScrCompositorIsEmpty(pCompositor); 1014 GLboolean fNeedPresent; 1015 1021 1016 /* renderspuVBoxCompositorSet can be invoked from the chromium thread only and is not reentrant, 1022 1017 * no need to synch here 1023 1018 * the lock is actually needed to ensure we're in synch with the redraw thread */ 1024 if (window->pCompositor == pCompositor) 1025 return; 1019 if (window->pCompositor == pCompositor && ! fEmpty) 1020 return !!pCompositor; 1021 1026 1022 rc = RTCritSectEnter(&window->CompositorLock); 1027 1023 if (RT_SUCCESS(rc)) 1028 1024 { 1025 if (!fEmpty) 1026 fNeedPresent = !!pCompositor; 1027 else 1028 { 1029 fNeedPresent = renderspu_SystemWindowNeedEmptyPresent(window); 1030 pCompositor = NULL; 1031 } 1032 1029 1033 window->pCompositor = pCompositor; 1030 1034 RTCritSectLeave(&window->CompositorLock); 1031 return ;1035 return fNeedPresent; 1032 1036 } 1033 1037 else 1034 1038 { 1035 crWarning("RTCritSectEnter failed rc %d", rc); 1036 } 1039 WARN(("RTCritSectEnter failed rc %d", rc)); 1040 } 1041 1042 return GL_FALSE; 1037 1043 } 1038 1044 … … 1060 1066 const VBOXVR_SCR_COMPOSITOR * pCompositor = window->pCompositor; 1061 1067 if (pCompositor) 1068 { 1069 Assert(!CrVrScrCompositorIsEmpty(window->pCompositor)); 1062 1070 return pCompositor; 1071 } 1063 1072 1064 1073 /* if no compositor is set, release the lock and return */ … … 1072 1081 } 1073 1082 1074 int renderspuVBoxCompositorLock(WindowInfo *window )1083 int renderspuVBoxCompositorLock(WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR **ppCompositor) 1075 1084 { 1076 1085 int rc = RTCritSectEnter(&window->CompositorLock); 1077 AssertRC(rc); 1086 if (RT_SUCCESS(rc)) 1087 { 1088 if (ppCompositor) 1089 *ppCompositor = window->pCompositor; 1090 } 1091 else 1092 WARN(("RTCritSectEnter failed %d", rc)); 1078 1093 return rc; 1079 1094 } … … 1093 1108 *ppCompositor = window->pCompositor; 1094 1109 if (*ppCompositor) 1110 { 1111 Assert(!CrVrScrCompositorIsEmpty(window->pCompositor)); 1095 1112 return VINF_SUCCESS; 1113 } 1096 1114 1097 1115 /* if no compositor is set, release the lock and return */ … … 1110 1128 int rc; 1111 1129 Assert(window->pCompositor); 1112 if (CrVrScrCompositorIsEmpty(window->pCompositor) && RTCritSectGetRecursion(&window->CompositorLock) == 1) 1113 window->pCompositor = NULL; 1130 Assert(!CrVrScrCompositorIsEmpty(window->pCompositor)); 1114 1131 rc = RTCritSectLeave(&window->CompositorLock); 1115 1132 if (!RT_SUCCESS(rc)) -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
r51349 r51442 101 101 GLboolean visible; 102 102 GLboolean everCurrent; /**< has this window ever been bound? */ 103 GLboolean fCompositorPresentEmpty;104 103 char *title; 105 104 … … 400 399 extern void renderspu_SystemWindowPosition( WindowInfo *window, GLint x, GLint y ); 401 400 extern void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects); 401 extern GLboolean renderspu_SystemWindowNeedEmptyPresent(WindowInfo *window); 402 402 extern int renderspu_SystemInit(); 403 403 extern int renderspu_SystemTerm(); … … 411 411 extern void renderspu_GCWindow(void); 412 412 extern int renderspuCreateFunctions( SPUNamedFunctionTable table[] ); 413 extern voidrenderspuVBoxCompositorSet( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor);413 extern GLboolean renderspuVBoxCompositorSet( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR * pCompositor); 414 414 extern void renderspuVBoxCompositorClearAll(); 415 extern int renderspuVBoxCompositorLock(WindowInfo *window );415 extern int renderspuVBoxCompositorLock(WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR **ppCompositor); 416 416 extern int renderspuVBoxCompositorUnlock(WindowInfo *window); 417 417 extern const struct VBOXVR_SCR_COMPOSITOR * renderspuVBoxCompositorAcquire( WindowInfo *window); -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c
r51349 r51442 704 704 } 705 705 706 GLboolean renderspu_SystemWindowNeedEmptyPresent(WindowInfo *window) 707 { 708 return GL_FALSE; 709 } 710 706 711 void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects) 707 712 { -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c
r51082 r51442 180 180 } 181 181 182 GLboolean renderspu_SystemWindowNeedEmptyPresent(WindowInfo *pWinInfo) 183 { 184 return cocoaViewNeedsEmptyPresent(pWinInfo->window); 185 } 186 182 187 void renderspu_SystemWindowVisibleRegion(WindowInfo *pWinInfo, GLint cRects, const GLint* paRects) 183 188 { -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h
r50095 r51442 49 49 void cocoaViewMakeCurrentContext(NativeNSViewRef pView, NativeNSOpenGLContextRef pCtx); 50 50 void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, const GLint* paRects); 51 GLboolean cocoaViewNeedsEmptyPresent(NativeNSViewRef pView); 51 52 void cocoaViewPresentComposition(NativeNSViewRef pView, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry); 52 53 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r51360 r51442 349 349 bool m_fNeedCtxUpdate; 350 350 bool m_fDataVisible; 351 bool m_fCleanupNeeded; 351 352 bool m_fEverSized; 352 353 } … … 386 387 - (void)clearVisibleRegions; 387 388 - (void)setVisibleRegions:(GLint)cRects paRects:(const GLint*)paRects; 389 - (GLboolean)vboxNeedsEmptyPresent; 388 390 389 391 - (NSView*)dockTileScreen; … … 796 798 m_fNeedCtxUpdate = true; 797 799 m_fDataVisible = false; 800 m_fCleanupNeeded = false; 798 801 m_fEverSized = false; 799 802 … … 900 903 if (m_fEverSized) 901 904 [self performSelectorOnMainThread:@selector(vboxReshapePerform) withObject:nil waitUntilDone:NO]; 902 903 /* we need to redwar on regions change, however the compositor now is cleared904 * because all compositor&window data-related modifications are performed with compositor cleared905 * the renderspu client will re-set the compositor after modifications are complete906 * this way we indicate renderspu generic code not to ignore the empty compositor */907 /* generally this should not be needed for setPos because compositor should not be zeroed with it,908 * in any way setting this flag here should not hurt as it will be re-set on next present */909 m_pWinInfo->fCompositorPresentEmpty = GL_TRUE;910 905 } 911 906 … … 930 925 DEBUG_MSG(("OVIW(%p): setSize: new size: %dx%d\n", (void*)self, (int)size.width, (int)size.height)); 931 926 [self performSelectorOnMainThread:@selector(vboxReshapeOnResizePerform) withObject:nil waitUntilDone:NO]; 932 933 /* we need to redwar on regions change, however the compositor now is cleared934 * because all compositor&window data-related modifications are performed with compositor cleared935 * the renderspu client will re-set the compositor after modifications are complete936 * this way we indicate renderspu generic code not to ignore the empty compositor */937 /* generally this should not be needed for setSize because compositor should not be zeroed with it,938 * in any way setting this flag here should not hurt as it will be re-set on next present */939 m_pWinInfo->fCompositorPresentEmpty = GL_TRUE;940 927 } 941 928 … … 1193 1180 - (void)vboxTryDrawUI 1194 1181 { 1195 const VBOXVR_SCR_COMPOSITOR *pCompositor = renderspuVBoxCompositorAcquire(m_pWinInfo); 1196 if (!m_fDataVisible && !pCompositor) 1182 const VBOXVR_SCR_COMPOSITOR *pCompositor; 1183 int rc = renderspuVBoxCompositorLock(m_pWinInfo, &pCompositor); 1184 if (RT_FAILURE(rc)) 1185 { 1186 DEBUG_WARN(("renderspuVBoxCompositorLock failed\n")); 1197 1187 return; 1188 } 1189 1190 if (!pCompositor && !m_fCleanupNeeded) 1191 { 1192 renderspuVBoxCompositorUnlock(m_pWinInfo); 1193 return; 1194 } 1198 1195 1199 1196 VBOXVR_SCR_COMPOSITOR TmpCompositor; … … 1204 1201 { 1205 1202 Assert(!m_fDataVisible); 1203 Assert(!m_fCleanupNeeded); 1206 1204 renderspuVBoxCompositorRelease(m_pWinInfo); 1207 1205 if (![self vboxSharedCtxCreate]) … … 1215 1213 pCompositor = renderspuVBoxCompositorAcquire(m_pWinInfo); 1216 1214 Assert(!m_fDataVisible); 1215 Assert(!m_fCleanupNeeded); 1217 1216 if (!pCompositor) 1218 1217 return; … … 1221 1220 else 1222 1221 { 1222 Assert(m_fCleanupNeeded); 1223 1223 CrVrScrCompositorInit(&TmpCompositor, NULL); 1224 1224 pCompositor = &TmpCompositor; … … 1235 1235 } 1236 1236 1237 if (pCompositor != &TmpCompositor) 1238 renderspuVBoxCompositorRelease(m_pWinInfo); 1237 renderspuVBoxCompositorUnlock(m_pWinInfo); 1239 1238 } 1240 1239 … … 1569 1568 } 1570 1569 1570 - (GLboolean)vboxNeedsEmptyPresent 1571 { 1572 if (m_fDataVisible) 1573 { 1574 m_fCleanupNeeded = true; 1575 return GL_TRUE; 1576 } 1577 1578 return GL_FALSE; 1579 } 1580 1571 1581 - (void)setVisibleRegions:(GLint)cRects paRects:(const GLint*)paRects 1572 1582 { … … 1589 1599 memcpy(m_paClipRects, paRects, sizeof(GLint) * 4 * cRects); 1590 1600 } 1591 1592 /* we need to redwar on regions change, however the compositor now is cleared1593 * because all compositor&window data-related modifications are performed with compositor cleared1594 * the renderspu client will re-set the compositor after modifications are complete1595 * this way we indicate renderspu generic code not to ignore the empty compositor */1596 m_pWinInfo->fCompositorPresentEmpty = GL_TRUE;1597 1601 } 1598 1602 … … 1938 1942 } 1939 1943 1944 GLboolean cocoaViewNeedsEmptyPresent(NativeNSViewRef pView) 1945 { 1946 NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; 1947 1948 [(OverlayView*)pView vboxNeedsEmptyPresent]; 1949 1950 [pPool release]; 1951 } 1952 1940 1953 void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, const GLint* paRects) 1941 1954 { -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
r51349 r51442 1889 1889 } 1890 1890 1891 GLboolean renderspu_SystemWindowNeedEmptyPresent(WindowInfo *window) 1892 { 1893 return GL_FALSE; 1894 } 1895 1891 1896 void 1892 1897 renderspu_SystemWindowVisibleRegion( WindowInfo *window, GLint cRects, const GLint *pRects ) -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c
r51349 r51442 1580 1580 } 1581 1581 1582 GLboolean renderspu_SystemWindowNeedEmptyPresent(WindowInfo *window) 1583 { 1584 return GL_FALSE; 1585 } 1586 1582 1587 void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects) 1583 1588 {
Note:
See TracChangeset
for help on using the changeset viewer.