Changeset 51432 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- May 28, 2014 7:39:07 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r51423 r51432 2905 2905 } 2906 2906 2907 if (CrFbIsEnabled(getFramebuffer())) 2907 int rc = windowDimensionsSync(); 2908 if (!RT_SUCCESS(rc)) 2909 { 2910 WARN(("windowDimensionsSync failed rc %d", rc)); 2911 return rc; 2912 } 2913 2914 return VINF_SUCCESS; 2915 } 2916 2917 virtual int windowSetCompositor(bool fSet) 2918 { 2919 if (fSet) 2920 { 2921 const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(getFramebuffer()); 2922 return mpWindow->SetCompositor(pCompositor); 2923 } 2924 return mpWindow->SetCompositor(NULL); 2925 } 2926 2927 virtual int windowCleanup() 2928 { 2929 int rc = mpWindow->UpdateBegin(); 2930 if (!RT_SUCCESS(rc)) 2931 { 2932 WARN(("err")); 2933 return rc; 2934 } 2935 2936 rc = windowDimensionsSync(true); 2937 if (!RT_SUCCESS(rc)) 2938 { 2939 WARN(("err")); 2940 mpWindow->UpdateEnd(); 2941 return rc; 2942 } 2943 2944 rc = windowSetCompositor(false); 2945 if (!RT_SUCCESS(rc)) 2946 { 2947 WARN(("err")); 2948 mpWindow->UpdateEnd(); 2949 return rc; 2950 } 2951 2952 mpWindow->UpdateEnd(); 2953 2954 return VINF_SUCCESS; 2955 } 2956 2957 virtual int fbCleanup() 2958 { 2959 int rc = windowCleanup(); 2960 if (!RT_SUCCESS(rc)) 2961 { 2962 WARN(("windowCleanup failed")); 2963 return rc; 2964 } 2965 return CrFbDisplayBase::fbCleanup(); 2966 } 2967 2968 int windowDimensionsSync(bool fForceCleanup = false) 2969 { 2970 int rc = VINF_SUCCESS; 2971 2972 HCR_FRAMEBUFFER hFb = getFramebuffer(); 2973 if (!fForceCleanup && hFb && CrFbIsEnabled(hFb)) 2908 2974 { 2909 2975 const RTRECT* pRect = getRect(); 2910 int rc = mpWindow->SetPosition(pRect->xLeft - mViewportRect.xLeft, pRect->yTop - mViewportRect.yTop); 2976 2977 rc = mpWindow->SetPosition(pRect->xLeft - mViewportRect.xLeft, pRect->yTop - mViewportRect.yTop); 2911 2978 if (!RT_SUCCESS(rc)) 2912 2979 { 2913 WARN((" SetComposition failed rc %d", rc));2980 WARN(("err")); 2914 2981 return rc; 2915 2982 } … … 2920 2987 if (!RT_SUCCESS(rc)) 2921 2988 { 2922 WARN((" SetSize failed rc %d", rc));2989 WARN(("err")); 2923 2990 return rc; 2924 2991 } … … 2927 2994 if (!RT_SUCCESS(rc)) 2928 2995 { 2929 WARN((" SetVisible failed rc %d", rc));2996 WARN(("err")); 2930 2997 return rc; 2931 2998 } 2932 2933 return VINF_SUCCESS; 2934 } 2935 2936 return mpWindow->SetVisible(false); 2937 } 2938 2939 virtual int windowSetCompositor(bool fSet) 2940 { 2941 if (fSet) 2942 { 2943 const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(getFramebuffer()); 2944 return mpWindow->SetCompositor(pCompositor); 2945 } 2946 return mpWindow->SetCompositor(NULL); 2947 } 2948 2949 virtual int windowCleanup() 2999 } 3000 else 3001 { 3002 rc = mpWindow->SetVisible(false); 3003 if (!RT_SUCCESS(rc)) 3004 { 3005 WARN(("err")); 3006 return rc; 3007 } 3008 } 3009 3010 return rc; 3011 } 3012 3013 virtual int windowSync() 2950 3014 { 2951 3015 int rc = mpWindow->UpdateBegin(); … … 2956 3020 } 2957 3021 2958 rc = mpWindow->SetVisible(false);3022 rc = windowSetCompositor(true); 2959 3023 if (!RT_SUCCESS(rc)) 2960 3024 { … … 2964 3028 } 2965 3029 2966 rc = windowSetCompositor(false); 2967 if (!RT_SUCCESS(rc)) 2968 { 2969 WARN(("err")); 2970 mpWindow->UpdateEnd(); 2971 return rc; 2972 } 2973 2974 mpWindow->UpdateEnd(); 2975 2976 return VINF_SUCCESS; 2977 } 2978 2979 virtual int fbCleanup() 2980 { 2981 int rc = windowCleanup(); 2982 if (!RT_SUCCESS(rc)) 2983 { 2984 WARN(("windowCleanup failed")); 2985 return rc; 2986 } 2987 return CrFbDisplayBase::fbCleanup(); 2988 } 2989 2990 virtual int windowSync() 2991 { 2992 const RTRECT* pRect = getRect(); 2993 2994 int rc = mpWindow->UpdateBegin(); 2995 if (!RT_SUCCESS(rc)) 2996 { 2997 WARN(("err")); 2998 return rc; 2999 } 3000 3001 rc = windowSetCompositor(true); 3002 if (!RT_SUCCESS(rc)) 3003 { 3004 WARN(("err")); 3005 mpWindow->UpdateEnd(); 3006 return rc; 3007 } 3008 3009 rc = mpWindow->SetPosition(pRect->xLeft - mViewportRect.xLeft, pRect->yTop - mViewportRect.yTop); 3010 if (!RT_SUCCESS(rc)) 3011 { 3012 WARN(("err")); 3013 mpWindow->UpdateEnd(); 3014 return rc; 3015 } 3016 3017 rc = mpWindow->SetSize((uint32_t)(pRect->xRight - pRect->xLeft), (uint32_t)(pRect->yBottom - pRect->yTop)); 3018 if (!RT_SUCCESS(rc)) 3019 { 3020 WARN(("err")); 3021 mpWindow->UpdateEnd(); 3022 return rc; 3023 } 3024 3025 HCR_FRAMEBUFFER hFb = getFramebuffer(); 3026 rc = mpWindow->SetVisible(hFb && CrFbIsEnabled(hFb) && !g_CrPresenter.fWindowsForceHidden); 3030 rc = windowDimensionsSync(); 3027 3031 if (!RT_SUCCESS(rc)) 3028 3032 { … … 4610 4614 g_CrPresenter.u32DisplayMode = u32DisplayMode; 4611 4615 4612 for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled(); 4616 /* disabled framebuffers may still have displays attached */ 4617 for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstInitialized(); 4613 4618 hFb; 4614 hFb = CrPMgrFbGetNext Enabled(hFb))4619 hFb = CrPMgrFbGetNextInitialized(hFb)) 4615 4620 { 4616 4621 crPMgrModeModify(hFb, u32ModeAdd, u32ModeRemove); … … 4794 4799 4795 4800 VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aRemovedTargetMap); 4801 VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aAddedTargetMap); 4802 4796 4803 bool fDisplaysAdded = false, fDisplaysRemoved = false; 4797 4804 4798 4805 memcpy(aRemovedTargetMap, pFbInfo->aTargetMap, sizeof (aRemovedTargetMap)); 4799 for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i) 4800 { 4801 aRemovedTargetMap[i] = (aRemovedTargetMap[i] & ~pTargetMap[i]); 4802 if (aRemovedTargetMap[i]) 4803 fDisplaysRemoved = true; 4804 } 4805 4806 VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aAddedTargetMap); 4807 4808 memcpy(aAddedTargetMap, pFbInfo->aTargetMap, sizeof (aAddedTargetMap)); 4809 for (int i = 0; i < RT_ELEMENTS(aAddedTargetMap); ++i) 4810 { 4811 aAddedTargetMap[i] = (pTargetMap[i] & ~aAddedTargetMap[i]); 4812 if (aAddedTargetMap[i]) 4813 fDisplaysAdded = true; 4806 4807 if (pScreen->u16Flags & VBVA_SCREEN_F_DISABLED) 4808 { 4809 /* so far there is no need in keeping displays attached to disabled Framebffer, 4810 * just disconnect everything */ 4811 for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i) 4812 { 4813 if (aRemovedTargetMap[i]) 4814 { 4815 fDisplaysRemoved = true; 4816 break; 4817 } 4818 } 4819 4820 memset(aAddedTargetMap, 0, sizeof (aAddedTargetMap)); 4821 } 4822 else 4823 { 4824 for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i) 4825 { 4826 aRemovedTargetMap[i] = (aRemovedTargetMap[i] & ~pTargetMap[i]); 4827 if (aRemovedTargetMap[i]) 4828 fDisplaysRemoved = true; 4829 } 4830 4831 memcpy(aAddedTargetMap, pFbInfo->aTargetMap, sizeof (aAddedTargetMap)); 4832 for (int i = 0; i < RT_ELEMENTS(aAddedTargetMap); ++i) 4833 { 4834 aAddedTargetMap[i] = (pTargetMap[i] & ~aAddedTargetMap[i]); 4835 if (aAddedTargetMap[i]) 4836 fDisplaysAdded = true; 4837 } 4814 4838 } 4815 4839
Note:
See TracChangeset
for help on using the changeset viewer.