Changeset 50095 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
- Timestamp:
- Jan 17, 2014 4:34:07 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r50041 r50095 188 188 crFreeHashtable(cr_server.muralTable, deleteMuralInfoCallback); 189 189 190 crServerDisplayTermAll(); 191 CrDemTerm(&cr_server.PresentTexturepMap); 192 CrDemTeGlobalTerm(); 193 memset(cr_server.DisplaysInitMap, 0, sizeof (cr_server.DisplaysInitMap)); 194 memset(cr_server.aDispplays, 0, sizeof (cr_server.aDispplays)); 190 CrPMgrTerm(); 195 191 196 192 for (i = 0; i < cr_server.numClients; i++) { … … 369 365 cr_server.dummyMuralTable = crAllocHashtable(); 370 366 371 CrDemGlobalInit(); 372 373 CrDemInit(&cr_server.PresentTexturepMap); 374 memset(cr_server.DisplaysInitMap, 0, sizeof (cr_server.DisplaysInitMap)); 375 memset(cr_server.aDispplays, 0, sizeof (cr_server.aDispplays)); 367 CrPMgrInit(); 376 368 377 369 cr_server.fRootVrOn = GL_FALSE; … … 486 478 cr_server.dummyMuralTable = crAllocHashtable(); 487 479 488 CrDemGlobalInit(); 489 490 CrDemInit(&cr_server.PresentTexturepMap); 491 memset(cr_server.DisplaysInitMap, 0, sizeof (cr_server.DisplaysInitMap)); 492 memset(cr_server.aDispplays, 0, sizeof (cr_server.aDispplays)); 480 CrPMgrInit(); 493 481 494 482 cr_server.fRootVrOn = GL_FALSE; … … 1005 993 return NULL; 1006 994 } 1007 id = crServerMuralInit(pMural, "", visualBits, 0 , GL_TRUE);995 id = crServerMuralInit(pMural, "", visualBits, 0); 1008 996 if (id < 0) 1009 997 { … … 1149 1137 1150 1138 pEl = &pData->aElements[pData->cElements]; 1151 pEl->idFBO = pMural && (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO)? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;1139 pEl->idFBO = pMural && pMural->fRedirected ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0; 1152 1140 pEl->enmBuffer = pData->aElements[1].idFBO ? GL_COLOR_ATTACHMENT0 : GL_FRONT; 1153 1141 pEl->posX = 0; … … 1176 1164 { 1177 1165 pEl = &pData->aElements[pData->cElements]; 1178 pEl->idFBO = pMural && (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO)? pMural->aidFBOs[CR_SERVER_FBO_BB_IDX(pMural)] : 0;1166 pEl->idFBO = pMural && pMural->fRedirected ? pMural->aidFBOs[CR_SERVER_FBO_BB_IDX(pMural)] : 0; 1179 1167 pEl->enmBuffer = pData->aElements[1].idFBO ? GL_COLOR_ATTACHMENT0 : GL_BACK; 1180 1168 pEl->posX = 0; … … 1206 1194 AssertCompile(sizeof (GLfloat) == 4); 1207 1195 pEl = &pData->aElements[pData->cElements]; 1208 pEl->idFBO = pMural && (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO)? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;1196 pEl->idFBO = pMural && pMural->fRedirected ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0; 1209 1197 pEl->enmBuffer = 0; /* we do not care */ 1210 1198 pEl->posX = 0; … … 1237 1225 AssertCompile(sizeof (GLuint) == 4); 1238 1226 pEl = &pData->aElements[pData->cElements]; 1239 pEl->idFBO = pMural && (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO)? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;1227 pEl->idFBO = pMural && pMural->fRedirected ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0; 1240 1228 pEl->enmBuffer = 0; /* we do not care */ 1241 1229 pEl->posX = 0; … … 1262 1250 { 1263 1251 pEl = &pData->aElements[pData->cElements]; 1264 pEl->idFBO = pMural && (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO)? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;1252 pEl->idFBO = pMural && pMural->fRedirected ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0; 1265 1253 pEl->enmBuffer = 0; /* we do not care */ 1266 1254 pEl->posX = 0; … … 1719 1707 } 1720 1708 1721 rc = crServerDisplaySaveState(pSSM);1709 rc = CrPMgrSaveState(pSSM); 1722 1710 AssertRCReturn(rc, rc); 1723 1711 … … 2137 2125 crFree(muralInfo.pVisibleRects); 2138 2126 } 2139 2140 Assert(!pActualMural->fDataPresented);2141 2142 if (version >= SHCROGL_SSM_VERSION_WITH_PRESENT_STATE)2143 pActualMural->fDataPresented = muralInfo.fDataPresented;2144 else2145 pActualMural->fDataPresented = crServerVBoxCompositionPresentNeeded(pActualMural);2146 2127 } 2147 2128 … … 2231 2212 crVBoxServerFBImageDataTerm(&Data.data); 2232 2213 2233 if ((pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) && pMural->fDataPresented && crServerVBoxCompositionPresentNeeded(pMural)) 2234 { 2235 crServerPresentFBO(pMural); 2236 } 2214 crServerPresentFBO(pMural); 2237 2215 2238 2216 CRASSERT(cr_server.currentMural); … … 2610 2588 if (version >= SHCROGL_SSM_VERSION_WITH_SCREEN_INFO) 2611 2589 { 2612 rc = crServerDisplayLoadState(pSSM, version); 2590 HCR_FRAMEBUFFER hFb; 2591 2592 rc = CrPMgrLoadState(pSSM, version); 2613 2593 AssertRCReturn(rc, rc); 2614 2594 } … … 2682 2662 } 2683 2663 2664 void crServerWindowReparent(CRMuralInfo *pMural) 2665 { 2666 pMural->fHasParentWindow = !!cr_server.screen[pMural->screenId].winID; 2667 2668 renderspuReparentWindow(pMural->spuWindow); 2669 } 2670 2684 2671 static void crVBoxServerReparentMuralCB(unsigned long key, void *data1, void *data2) 2685 2672 { … … 2687 2674 int *sIndex = (int*) data2; 2688 2675 2689 Assert(pMI->cDisabled);2690 2691 2676 if (pMI->screenId == *sIndex) 2692 2677 { 2693 2678 crServerWindowReparent(pMI); 2694 2679 } 2695 }2696 2697 static void crVBoxServerCheckMuralCB(unsigned long key, void *data1, void *data2)2698 {2699 CRMuralInfo *pMI = (CRMuralInfo*) data1;2700 (void) data2;2701 2702 crServerCheckMuralGeometry(pMI);2703 2680 } 2704 2681 … … 2737 2714 if (MAPPED(SCREEN(sIndex))) 2738 2715 { 2739 PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex);2740 2741 2716 SCREEN(sIndex).winID = 0; 2742 2717 renderspuSetWindowId(0); … … 2746 2721 crHashtableWalk(cr_server.dummyMuralTable, crVBoxServerReparentMuralCB, &sIndex); 2747 2722 2748 if (pDisplay) 2749 CrDpReparent(pDisplay, &SCREEN(sIndex)); 2723 CrPMgrScreenChanged((uint32_t)sIndex); 2750 2724 } 2751 2725 2752 2726 renderspuSetWindowId(SCREEN(0).winID); 2753 2754 crHashtableWalk(cr_server.muralTable, crVBoxServerCheckMuralCB, NULL);2755 2727 2756 2728 /* crVBoxServerNotifyEvent(sIndex, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA, NULL); */ … … 2783 2755 crHashtableWalk(cr_server.dummyMuralTable, crVBoxServerReparentMuralCB, &sIndex); 2784 2756 renderspuSetWindowId(SCREEN(0).winID); 2785 2786 crHashtableWalk(cr_server.muralTable, crVBoxServerCheckMuralCB, NULL);2787 2757 2788 2758 #ifndef WINDOWS … … 2819 2789 #endif 2820 2790 2821 { 2822 PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex); 2823 if (pDisplay) 2824 CrDpReparent(pDisplay, &SCREEN(sIndex)); 2825 } 2791 CrPMgrScreenChanged((uint32_t)sIndex); 2826 2792 2827 2793 crVBoxServerNotifyEvent(sIndex, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA, … … 2831 2797 } 2832 2798 2833 int crVBoxServerUpdateMuralRootVisibleRegion(CRMuralInfo *pMI)2834 {2835 GLboolean fForcePresent;2836 2837 int rc = VINF_SUCCESS;2838 2839 fForcePresent = crServerVBoxCompositionPresentNeeded(pMI);2840 2841 crServerVBoxCompositionDisableEnter(pMI);2842 2843 if (cr_server.fRootVrOn)2844 {2845 if (!pMI->fRootVrOn)2846 {2847 CrVrScrCompositorInit(&pMI->RootVrCompositor);2848 }2849 2850 rc = crServerMuralSynchRootVr(pMI, NULL);2851 if (!RT_SUCCESS(rc))2852 {2853 crWarning("crServerMuralSynchRootVr failed, rc %d", rc);2854 goto end;2855 }2856 }2857 else2858 {2859 CrVrScrCompositorClear(&pMI->RootVrCompositor);2860 }2861 2862 pMI->fRootVrOn = cr_server.fRootVrOn;2863 2864 crServerWindowVisibleRegion(pMI);2865 2866 end:2867 crServerVBoxCompositionDisableLeave(pMI, fForcePresent);2868 2869 return rc;2870 }2871 2872 static void crVBoxServerSetRootVisibleRegionCB(unsigned long key, void *data1, void *data2)2873 {2874 CRMuralInfo *pMI = (CRMuralInfo*) data1;2875 2876 if (!pMI->CreateInfo.externalID)2877 return;2878 (void) data2;2879 2880 crVBoxServerUpdateMuralRootVisibleRegion(pMI);2881 }2882 2883 2799 DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, const RTRECT *pRects) 2884 2800 { 2885 2801 int32_t rc = VINF_SUCCESS; 2886 int i;2802 GLboolean fOldRootVrOn = cr_server.fRootVrOn; 2887 2803 2888 2804 /* non-zero rects pointer indicate rects are present and switched on … … 2911 2827 } 2912 2828 2913 crHashtableWalk(cr_server.muralTable, crVBoxServerSetRootVisibleRegionCB, NULL); 2914 2915 for (i = 0; i < cr_server.screenCount; ++i) 2916 { 2917 PCR_DISPLAY pDisplay = crServerDisplayGetInitialized((uint32_t)i); 2918 if (!pDisplay) 2919 continue; 2920 2921 CrDpRootUpdate(pDisplay); 2829 if (!fOldRootVrOn != !cr_server.fRootVrOn) 2830 { 2831 rc = CrPMgrModeRootVr(cr_server.fRootVrOn); 2832 if (!RT_SUCCESS(rc)) 2833 { 2834 crWarning("CrPMgrModeRootVr failed rc %d", rc); 2835 return rc; 2836 } 2837 } 2838 else if (cr_server.fRootVrOn) 2839 { 2840 rc = CrPMgrRootVrUpdate(); 2841 if (!RT_SUCCESS(rc)) 2842 { 2843 crWarning("CrPMgrRootVrUpdate failed rc %d", rc); 2844 return rc; 2845 } 2922 2846 } 2923 2847 … … 2930 2854 } 2931 2855 2932 int32_t crServerSetOffscreenRenderingMode(GLuint value)2933 {2934 /* sanitize values */2935 value = crServerRedirModeAdjust(value);2936 2937 if (value == CR_SERVER_REDIR_F_NONE)2938 {2939 crWarning("crServerSetOffscreenRenderingMode: value undefined");2940 }2941 2942 if (cr_server.fPresentMode==value)2943 {2944 return VINF_SUCCESS;2945 }2946 2947 if ((value & CR_SERVER_REDIR_F_FBO) && !crServerSupportRedirMuralFBO())2948 {2949 crWarning("crServerSetOffscreenRenderingMode: FBO not supported");2950 return VERR_NOT_SUPPORTED;2951 }2952 2953 cr_server.fPresentMode=value;2954 2955 crHashtableWalk(cr_server.muralTable, crVBoxServerCheckMuralCB, NULL);2956 2957 return VINF_SUCCESS;2958 }2959 2960 2856 DECLEXPORT(int32_t) crVBoxServerSetOffscreenRendering(GLboolean value) 2961 2857 { 2962 return crServerSetOffscreenRenderingMode(value ? 2963 cr_server.fPresentModeDefault | CR_SERVER_REDIR_F_FBO_RAM_VRDP | cr_server.fVramPresentModeDefault 2964 : cr_server.fPresentModeDefault); 2965 } 2966 2967 static void crVBoxServerOutputRedirectCB(unsigned long key, void *data1, void *data2) 2968 { 2969 CRMuralInfo *mural = (CRMuralInfo*) data1; 2970 2971 if (!mural->CreateInfo.externalID) 2972 return; 2973 2974 if (cr_server.bUseOutputRedirect) 2975 crServerPresentOutputRedirect(mural); 2976 else 2977 crServerOutputRedirectCheckEnableDisable(mural); 2858 return CrPMgrModeVrdp(value); 2978 2859 } 2979 2860 … … 2984 2865 { 2985 2866 cr_server.outputRedirect = *pCallbacks; 2986 cr_server.bUseOutputRedirect = true;2987 2867 } 2988 2868 else 2989 2869 { 2990 cr_server.bUseOutputRedirect = false; 2991 } 2992 2993 /* dynamically intercept already existing output */ 2994 crHashtableWalk(cr_server.muralTable, crVBoxServerOutputRedirectCB, NULL); 2870 memset (&cr_server.outputRedirect, 0, sizeof (cr_server.outputRedirect)); 2871 } 2995 2872 2996 2873 return VINF_SUCCESS; 2997 2874 } 2998 2875 2999 static void crVBoxServerUpdateScreenViewportCB(unsigned long key, void *data1, void *data2)3000 {3001 CRMuralInfo *mural = (CRMuralInfo*) data1;3002 int *sIndex = (int*) data2;3003 3004 if (mural->screenId != *sIndex)3005 return;3006 3007 crServerCheckMuralGeometry(mural);3008 }3009 3010 3011 2876 DECLEXPORT(int32_t) crVBoxServerSetScreenViewport(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h) 3012 2877 { 3013 CRScreenViewportInfo *pVieport; 3014 GLboolean fPosChanged, fSizeChanged; 2878 CRScreenViewportInfo *pViewport; 2879 RTRECT NewRect; 2880 GLboolean fChanged; 2881 int rc; 3015 2882 3016 2883 crDebug("crVBoxServerSetScreenViewport(%i)", sIndex); … … 3022 2889 } 3023 2890 3024 pVieport = &cr_server.screenVieport[sIndex]; 3025 fPosChanged = (pVieport->x != x || pVieport->y != y); 3026 fSizeChanged = (pVieport->w != w || pVieport->h != h); 3027 3028 if (!fPosChanged && !fSizeChanged) 2891 NewRect.xLeft = x; 2892 NewRect.yTop = y; 2893 NewRect.xRight = x + w; 2894 NewRect.yBottom = y + h; 2895 2896 pViewport = &cr_server.screenVieport[sIndex]; 2897 2898 fChanged = !!memcmp(&NewRect, &pViewport->Rect, sizeof (NewRect)); 2899 if (!fChanged) 3029 2900 { 3030 2901 crDebug("crVBoxServerSetScreenViewport: no changes"); … … 3032 2903 } 3033 2904 3034 if (fPosChanged) 3035 { 3036 pVieport->x = x; 3037 pVieport->y = y; 3038 3039 crHashtableWalk(cr_server.muralTable, crVBoxServerUpdateScreenViewportCB, &sIndex); 3040 } 3041 3042 if (fSizeChanged) 3043 { 3044 pVieport->w = w; 3045 pVieport->h = h; 3046 3047 /* no need to do anything here actually */ 3048 } 3049 3050 if (fPosChanged || fSizeChanged) 3051 { 3052 PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex); 3053 if (pDisplay) 3054 CrDpResize(pDisplay, SCREEN(sIndex).x, SCREEN(sIndex).y, SCREEN(sIndex).w, SCREEN(sIndex).h); 3055 } 2905 pViewport->Rect = NewRect; 2906 rc = CrPMgrViewportUpdate((uint32_t)sIndex); 2907 if (!RT_SUCCESS(rc)) 2908 { 2909 crWarning("CrPMgrViewportUpdate failed %d", rc); 2910 return rc; 2911 } 2912 3056 2913 return VINF_SUCCESS; 3057 2914 } … … 3371 3228 } 3372 3229 3373 3374 3230 int32_t crVBoxServerCrHgsmiCmd(struct VBOXVDMACMD_CHROMIUM_CMD *pCmd, uint32_t cbCmd) 3375 3231 {
Note:
See TracChangeset
for help on using the changeset viewer.