Changeset 46801 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Jun 26, 2013 1:01:07 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
r46515 r46801 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 );115 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fSetVRegs); 116 116 void crServerMuralTerm(CRMuralInfo *mural); 117 117 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height); … … 131 131 132 132 void crVBoxServerNotifyEvent(int32_t idScreen); 133 void crServerDisplayTermAll(); 133 134 134 135 #define CR_SERVER_REDIR_F_NONE 0x00 … … 403 404 void crServerDumpDrawel(const char*pszFormat, ...); 404 405 void crServerDumpDrawelv(GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal); 405 406 int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal); 407 void CrDpEnter(PCR_DISPLAY pDisplay); 408 void CrDpLeave(PCR_DISPLAY pDisplay); 406 409 407 410 extern unsigned long g_CrDbgDumpEnabled; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
r45940 r46801 64 64 } 65 65 66 staticint crServerVBoxParseNumerics(const char *pszStr, const int defaultVal)66 int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal) 67 67 { 68 68 int result = 0; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r46783 r46801 187 187 crFreeHashtable(cr_server.muralTable, deleteMuralInfoCallback); 188 188 189 crServerDisplayTermAll(); 190 CrDemTerm(&cr_server.PresentTexturepMap); 191 memset(cr_server.DisplaysInitMap, 0, sizeof (cr_server.DisplaysInitMap)); 192 memset(cr_server.aDispplays, 0, sizeof (cr_server.aDispplays)); 193 189 194 for (i = 0; i < cr_server.numClients; i++) { 190 195 if (cr_server.clients[i]) { … … 333 338 } 334 339 340 env = crGetenv("CR_SERVER_CAPS"); 341 if (env && env[0] != '\0') 342 { 343 cr_server.u32Caps = crServerVBoxParseNumerics(env, 0); 344 cr_server.u32Caps &= ~(CR_VBOX_CAP_TEX_PRESENT | CR_VBOX_CAP_NO_DWM_SUPPORT); 345 } 346 else 347 { 348 cr_server.u32Caps = 0; 349 #ifdef DEBUG_misha 350 cr_server.u32Caps = CR_VBOX_CAP_TEX_PRESENT; 351 #endif 352 } 353 335 354 cr_server.firstCallCreateContext = GL_TRUE; 336 355 cr_server.firstCallMakeCurrent = GL_TRUE; … … 362 381 cr_server.dummyMuralTable = crAllocHashtable(); 363 382 383 CrDemInit(&cr_server.PresentTexturepMap); 384 memset(cr_server.DisplaysInitMap, 0, sizeof (cr_server.DisplaysInitMap)); 385 memset(cr_server.aDispplays, 0, sizeof (cr_server.aDispplays)); 386 364 387 cr_server.fRootVrOn = GL_FALSE; 365 388 VBoxVrListInit(&cr_server.RootVr); … … 425 448 crInfo("Info: using multiple contexts!"); 426 449 crDebug("Debug: using multiple contexts!"); 450 } 451 452 env = crGetenv("CR_SERVER_CAPS"); 453 if (env && env[0] != '\0') 454 { 455 cr_server.u32Caps = crServerVBoxParseNumerics(env, 0); 456 cr_server.u32Caps &= ~(CR_VBOX_CAP_TEX_PRESENT | CR_VBOX_CAP_NO_DWM_SUPPORT); 457 } 458 else 459 { 460 cr_server.u32Caps = 0; 461 #ifdef DEBUG_misha 462 cr_server.u32Caps = CR_VBOX_CAP_TEX_PRESENT; 463 #endif 427 464 } 428 465 … … 464 501 465 502 cr_server.dummyMuralTable = crAllocHashtable(); 503 504 CrDemInit(&cr_server.PresentTexturepMap); 505 memset(cr_server.DisplaysInitMap, 0, sizeof (cr_server.DisplaysInitMap)); 506 memset(cr_server.aDispplays, 0, sizeof (cr_server.aDispplays)); 466 507 467 508 cr_server.fRootVrOn = GL_FALSE; … … 970 1011 return NULL; 971 1012 } 972 id = crServerMuralInit(pMural, "", visualBits, -1 );1013 id = crServerMuralInit(pMural, "", visualBits, -1, GL_TRUE); 973 1014 if (id < 0) 974 1015 { -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r46173 r46801 62 62 int CrDpInit(PCR_DISPLAY pDisplay) 63 63 { 64 int rc = CrVrScrCompositorInit(&pDisplay->Compositor); 65 if (RT_SUCCESS(rc)) 66 { 67 const GLint visBits = CR_RGB_BIT | CR_DOUBLE_BIT; 68 if (crServerMuralInit(&pDisplay->Mural, "", visBits, -1) >= 0) 69 { 70 return VINF_SUCCESS; 71 // crServerMuralTerm(&pDisplay->Mural); 72 } 73 else 74 { 75 crWarning("crServerMuralInit failed!"); 76 rc = VERR_GENERAL_FAILURE; 77 } 78 CrVrScrCompositorTerm(&pDisplay->Compositor); 79 } 80 else 81 { 82 crWarning("CrVrScrCompositorInit failed, rc %d", rc); 83 } 84 CRASSERT(RT_FAILURE(rc)); 85 return rc; 64 const GLint visBits = cr_server.MainContextInfo.CreateInfo.visualBits; 65 if (crServerMuralInit(&pDisplay->Mural, "", visBits, -1, GL_FALSE) < 0) 66 { 67 crWarning("crServerMuralInit failed!"); 68 return VERR_GENERAL_FAILURE; 69 } 70 71 return VINF_SUCCESS; 86 72 } 87 73 88 74 void CrDpTerm(PCR_DISPLAY pDisplay) 89 75 { 90 CrVrScrCompositorTerm(&pDisplay->Compositor);91 76 crServerMuralTerm(&pDisplay->Mural); 92 77 } … … 99 84 StretchY = ((float)stretchedHeight)/height; 100 85 crServerMuralSize(&pDisplay->Mural, stretchedWidth, stretchedHeight); 101 CrVrScrCompositorLock(&pDisplay->Compositor); 102 CrVrScrCompositorSetStretching(&pDisplay->Compositor, StretchX, StretchY); 103 CrVrScrCompositorUnlock(&pDisplay->Compositor); 86 CrVrScrCompositorSetStretching(&pDisplay->Mural.Compositor, StretchX, StretchY); 104 87 } 105 88 106 89 int CrDpEntryRegionsSet(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 107 90 { 108 CrVrScrCompositorLock(&pDisplay->Compositor); 109 int rc = CrVrScrCompositorEntryRegionsSet(&pDisplay->Compositor, &pEntry->CEntry, pPos, cRegions, paRegions, NULL); 110 CrVrScrCompositorUnlock(&pDisplay->Compositor); 91 int rc = CrVrScrCompositorEntryRegionsSet(&pDisplay->Mural.Compositor, pEntry ? &pEntry->CEntry : NULL, pPos, cRegions, paRegions, NULL); 111 92 return rc; 112 93 } … … 114 95 int CrDpEntryRegionsAdd(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 115 96 { 116 CrVrScrCompositorLock(&pDisplay->Compositor); 117 int rc = CrVrScrCompositorEntryRegionsAdd(&pDisplay->Compositor, &pEntry->CEntry, pPos, cRegions, paRegions, NULL); 118 CrVrScrCompositorUnlock(&pDisplay->Compositor); 97 int rc = CrVrScrCompositorEntryRegionsAdd(&pDisplay->Mural.Compositor, pEntry ? &pEntry->CEntry : NULL, pPos, cRegions, paRegions, NULL); 119 98 return rc; 120 99 } 121 100 122 int CrDpPresentEntry(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry)123 {124 GLuint idDrawFBO = 0, idReadFBO = 0;125 CRMuralInfo *pMural = cr_server.currentMural;126 CRContext *pCtx = cr_server.currentCtxInfo ? cr_server.currentCtxInfo->pContext : cr_server.MainContextInfo.pContext;127 128 if (pMural)129 {130 idDrawFBO = CR_SERVER_FBO_FOR_IDX(pMural, pMural->iCurDrawBuffer);131 idReadFBO = CR_SERVER_FBO_FOR_IDX(pMural, pMural->iCurReadBuffer);132 }133 134 crStateSwitchPrepare(NULL, pCtx, idDrawFBO, idReadFBO);135 136 cr_server.head_spu->dispatch_table.VBoxPresentComposition(pDisplay->Mural.spuWindow, &pDisplay->Compositor, &pEntry->CEntry);137 138 crStateSwitchPostprocess(pCtx, NULL, idDrawFBO, idReadFBO);139 140 return VINF_SUCCESS;141 }142 143 101 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData) 144 102 { … … 148 106 void CrDpEntryCleanup(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry) 149 107 { 150 CrVrScrCompositorLock(&pDisplay->Compositor); 151 CrVrScrCompositorEntryRemove(&pDisplay->Compositor, &pEntry->CEntry); 152 CrVrScrCompositorUnlock(&pDisplay->Compositor); 108 CrVrScrCompositorEntryRemove(&pDisplay->Mural.Compositor, &pEntry->CEntry); 109 } 110 111 void CrDpEnter(PCR_DISPLAY pDisplay) 112 { 113 crServerVBoxCompositionDisableEnter(&pDisplay->Mural); 114 } 115 116 void CrDpLeave(PCR_DISPLAY pDisplay) 117 { 118 pDisplay->Mural.fDataPresented = GL_TRUE; 119 crServerVBoxCompositionDisableLeave(&pDisplay->Mural, GL_FALSE); 153 120 } 154 121 … … 278 245 } 279 246 247 void crServerDisplayTermAll() 248 { 249 int i; 250 for (i = 0; i < cr_server.screenCount; ++i) 251 { 252 if (ASMBitTest(cr_server.DisplaysInitMap, i)) 253 { 254 CrDpTerm(&cr_server.aDispplays[i]); 255 ASMBitClear(cr_server.DisplaysInitMap, i); 256 } 257 } 258 } 259 280 260 void CrHlpFreeTexImage(CRContext *pCurCtx, GLuint idPBO, void *pvData) 281 261 { … … 395 375 } 396 376 397 PCR_DISPLAY_ENTRY pEntry = CrDemEntryGetCreate(&cr_server.PresentTexturepMap, texture, cr_server.currentCtxInfo); 398 if (!pEntry) 399 { 400 crWarning("CrDemEntryGetCreate Failed"); 401 return; 402 } 377 PCR_DISPLAY_ENTRY pEntry = NULL; 378 if (texture) 379 { 380 pEntry = CrDemEntryGetCreate(&cr_server.PresentTexturepMap, texture, cr_server.currentCtxInfo); 381 if (!pEntry) 382 { 383 crWarning("CrDemEntryGetCreate Failed"); 384 return; 385 } 386 } 387 388 CrDpEnter(pDisplay); 403 389 404 390 RTPOINT Point = {xPos, yPos}; … … 410 396 } 411 397 412 rc = CrDpPresentEntry(pDisplay, pEntry); 413 if (!RT_SUCCESS(rc)) 414 { 415 crWarning("CrDpEntrySetRegions Failed rc %d", rc); 416 return; 417 } 418 } 398 CrDpLeave(pDisplay); 399 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r46343 r46801 17 17 } 18 18 19 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID )19 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fSetVRegs) 20 20 { 21 21 CRMuralInfo *defaultMural; … … 24 24 GLint spuWindow; 25 25 VBOXVR_TEXTURE Tex = {0}; 26 RTRECT Rect;27 26 int rc; 28 27 … … 103 102 CR_STATE_SHAREDOBJ_USAGE_INIT(mural); 104 103 105 Rect.xLeft = 0; 106 Rect.xRight = mural->width; 107 Rect.yTop = 0; 108 Rect.yBottom = mural->height; 109 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL); 110 if (!RT_SUCCESS(rc)) 111 { 112 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 113 return -1; 104 if (fSetVRegs) 105 { 106 RTRECT Rect; 107 Rect.xLeft = 0; 108 Rect.xRight = mural->width; 109 Rect.yTop = 0; 110 Rect.yBottom = mural->height; 111 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL); 112 if (!RT_SUCCESS(rc)) 113 { 114 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 115 return -1; 116 } 114 117 } 115 118 … … 183 186 } 184 187 185 windowID = crServerMuralInit(mural, dpyName, visBits, preloadWinID );188 windowID = crServerMuralInit(mural, dpyName, visBits, preloadWinID, GL_TRUE); 186 189 if (windowID < 0) 187 190 {
Note:
See TracChangeset
for help on using the changeset viewer.