Changeset 43932 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Nov 21, 2012 7:28:05 PM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r43888 r43932 117 117 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height); 118 118 119 void crServerCreateInfoDeleteCB(void *data);120 121 119 GLint crServerGenerateID(GLint *pCounter); 122 120 … … 128 126 void crServerCheckMuralGeometry(CRMuralInfo *mural); 129 127 GLboolean crServerSupportRedirMuralFBO(void); 130 void crServerRedirMuralFBO(CRMuralInfo *mural, GLboolean redir); 128 129 #define CR_SERVER_REDIR_NONE 0 130 #define CR_SERVER_REDIR_FBO_BLT 1 131 #define CR_SERVER_REDIR_FBO_RAM 2 132 #define CR_SERVER_REDIR_MAXVAL CR_SERVER_REDIR_FBO_RAM 133 134 int32_t crServerSetOffscreenRenderingMode(GLubyte value); 135 void crServerRedirMuralFBO(CRMuralInfo *mural, GLubyte redir); 131 136 void crServerCreateMuralFBO(CRMuralInfo *mural); 132 137 void crServerDeleteMuralFBO(CRMuralInfo *mural); 133 138 void crServerPresentFBO(CRMuralInfo *mural); 134 139 GLboolean crServerIsRedirectedToFBO(); 140 PCR_BLITTER crServerGetFBOPresentBlitter(CRMuralInfo*pMural); 135 141 136 142 int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer); 143 144 PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen); 137 145 138 146 RT_C_DECLS_END -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_blitter.cpp
r43890 r43932 31 31 32 32 33 int CrBltInit(PCR_BLITTER pBlitter, CRMuralInfo *pCurrentMural , GLint visualBits)33 int CrBltInit(PCR_BLITTER pBlitter, CRMuralInfo *pCurrentMural) 34 34 { 35 35 memset(pBlitter, 0, sizeof (*pBlitter)); … … 43 43 44 44 pBlitter->CtxInfo.CreateInfo.pszDpyName = ""; 45 pBlitter->CtxInfo.CreateInfo.visualBits = visualBits;45 pBlitter->CtxInfo.CreateInfo.visualBits = pCurrentMural->CreateInfo.visualBits; 46 46 pBlitter->CtxInfo.SpuContext = cr_server.head_spu->dispatch_table.CreateContext(pBlitter->CtxInfo.CreateInfo.pszDpyName, 47 47 pBlitter->CtxInfo.CreateInfo.visualBits, … … 379 379 380 380 if (pBlitter->pRestoreCtxInfo != &pBlitter->CtxInfo) 381 cr_server.head_spu->dispatch_table.MakeCurrent(pBlitter->pRestoreMural->spuWindow, 0, pBlitter->pRestoreCtxInfo->SpuContext); 381 cr_server.head_spu->dispatch_table.MakeCurrent(pBlitter->pRestoreMural->spuWindow, 0, 382 pBlitter->pRestoreCtxInfo->SpuContext >= 0 383 ? pBlitter->pRestoreCtxInfo->SpuContext : cr_server.MainContextInfo.SpuContext); 382 384 else 383 385 cr_server.head_spu->dispatch_table.MakeCurrent(0, 0, 0); … … 410 412 int rc = crBltInitOnMakeCurent(pBlitter); 411 413 if (RT_SUCCESS(rc)) 414 { 415 pBlitter->Flags.Initialized = 1; 412 416 return VINF_SUCCESS; 417 } 413 418 414 419 crWarning("crBltInitOnMakeCurent failed, rc %d", rc); … … 447 452 } 448 453 454 void CrBltPresent(PCR_BLITTER pBlitter) 455 { 456 if (pBlitter->CtxInfo.CreateInfo.visualBits & CR_DOUBLE_BIT) 457 cr_server.head_spu->dispatch_table.SwapBuffers(pBlitter->pCurrentMural->spuWindow, 0); 458 else 459 cr_server.head_spu->dispatch_table.Flush(); 460 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
r40691 r43932 56 56 57 57 cr_server.screenCount = 0; 58 cr_server.bForceOffscreenRendering = GL_FALSE; 58 cr_server.bForceOffscreenRendering = CR_SERVER_REDIR_NONE; 59 cr_server.bOffscreenRenderingDefault = cr_server.bForceOffscreenRendering; 59 60 cr_server.bUsePBOForReadback = GL_FALSE; 60 61 cr_server.bUseOutputRedirect = GL_FALSE; … … 80 81 char **clientchain, **clientlist; 81 82 GLint dims[4]; 83 char * env; 82 84 83 85 defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0); … … 156 158 crSPULoadChain(num_spus, spu_ids, spu_names, spu_dir, &cr_server); 157 159 160 env = crGetenv( "CR_SERVER_DEFAULT_RENDER_TYPE" ); 161 if (env != NULL) 162 { 163 GLubyte redir = (env[0] - 0x30); 164 if (redir <= CR_SERVER_REDIR_MAXVAL) 165 { 166 int rc = crServerSetOffscreenRenderingMode(redir); 167 if (!RT_SUCCESS(rc)) 168 crWarning("offscreen rendering unsupported, no offscreen rendering will be used.."); 169 } 170 else 171 crWarning("invalid redir option %c", redir); 172 } 173 cr_server.bOffscreenRenderingDefault = cr_server.bForceOffscreenRendering; 174 158 175 /* Need to do this as early as possible */ 159 176 … … 259 276 int i; 260 277 GLint dims[4]; 278 char * env; 261 279 262 280 defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0); … … 272 290 if (!cr_server.head_spu) 273 291 return; 292 293 env = crGetenv( "CR_SERVER_DEFAULT_RENDER_TYPE" ); 294 if (env != NULL) 295 { 296 GLubyte redir = (env[0] - 0x30); 297 if (redir <= CR_SERVER_REDIR_MAXVAL) 298 { 299 int rc = crServerSetOffscreenRenderingMode(redir); 300 if (!RT_SUCCESS(rc)) 301 crWarning("offscreen rendering unsupported, no offscreen rendering will be used.."); 302 } 303 else 304 crWarning("invalid redir option %c", redir); 305 } 306 cr_server.bOffscreenRenderingDefault = cr_server.bForceOffscreenRendering; 274 307 275 308 cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_POSITION_CR, 0, GL_INT, 2, &dims[0]); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c
r43888 r43932 332 332 * crStateSwichPrepare restores the FBO state to its default values before the context window switch, 333 333 * while crStateSwichPostprocess restores it back to the original values */ 334 oldCtx = crStateSwichPrepare(ctx, cr_server.bUseMultipleContexts, oldMural && oldMural-> bUseFBO && crServerSupportRedirMuralFBO() ? oldMural->idFBO : 0);334 oldCtx = crStateSwichPrepare(ctx, cr_server.bUseMultipleContexts, oldMural && oldMural->fUseFBO && crServerSupportRedirMuralFBO() ? oldMural->idFBO : 0); 335 335 336 336 /* … … 395 395 crStateMakeCurrent( ctx ); 396 396 397 crStateSwichPostprocess(oldCtx, cr_server.bUseMultipleContexts, mural-> bUseFBO && crServerSupportRedirMuralFBO() ? mural->idFBO : 0);397 crStateSwichPostprocess(oldCtx, cr_server.bUseMultipleContexts, mural->fUseFBO && crServerSupportRedirMuralFBO() ? mural->idFBO : 0); 398 398 399 399 if (!ctx->framebufferobject.drawFB … … 401 401 cr_server.curClient->currentMural->bFbDraw = GL_TRUE; 402 402 403 if (!mural-> bUseFBO)403 if (!mural->fUseFBO) 404 404 { 405 405 ctx->buffer.width = mural->width; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r43182 r43932 150 150 crFreeHashtable(cr_server.contextTable, deleteContextInfoCallback); 151 151 152 /* Free context/window creation info */153 crFreeHashtable(cr_server.pWindowCreateInfoTable, crServerCreateInfoDeleteCB);154 155 152 /* Free vertex programs */ 156 153 crFreeHashtable(cr_server.programTable, crFree); … … 386 383 */ 387 384 cr_server.contextTable = crAllocHashtable(); 388 // cr_server.pContextCreateInfoTable = crAllocHashtable();389 cr_server.pWindowCreateInfoTable = crAllocHashtable();390 385 391 386 crServerSetVBoxConfigurationHGCM(); … … 691 686 CRASSERT(rc == VINF_SUCCESS); 692 687 693 rc = SSMR3PutMem(pSSM, pMI, sizeof(*pMI));688 rc = SSMR3PutMem(pSSM, pMI, RT_OFFSETOF(CRMuralInfo, CreateInfo)); 694 689 CRASSERT(rc == VINF_SUCCESS); 695 690 … … 708 703 709 704 CRASSERT(pCreateInfo && pSSM); 705 706 /* Don't store default mural create info */ 707 if (!key) return; 710 708 711 709 rc = SSMR3PutMem(pSSM, &key, sizeof(key)); … … 844 842 845 843 /* Save windows creation info */ 846 ui32 = crHashtableNumElements(cr_server.pWindowCreateInfoTable); 847 rc = SSMR3PutU32(pSSM, (uint32_t) ui32); 844 ui32 = crHashtableNumElements(cr_server.muralTable); 845 /* There should be default mural always */ 846 CRASSERT(ui32>=1); 847 rc = SSMR3PutU32(pSSM, (uint32_t) ui32-1); 848 848 AssertRCReturn(rc, rc); 849 crHashtableWalk(cr_server. pWindowCreateInfoTable, crVBoxServerSaveCreateInfoCB, pSSM);849 crHashtableWalk(cr_server.muralTable, crVBoxServerSaveCreateInfoCB, pSSM); 850 850 851 851 /* Save cr_server.muralTable 852 852 * @todo we don't need it all, just geometry info actually 853 853 */ 854 ui32 = crHashtableNumElements(cr_server.muralTable);855 /* There should be default mural always */856 CRASSERT(ui32>=1);857 854 rc = SSMR3PutU32(pSSM, (uint32_t) ui32-1); 858 855 AssertRCReturn(rc, rc); … … 1028 1025 rc = SSMR3GetMem(pSSM, &key, sizeof(key)); 1029 1026 AssertRCReturn(rc, rc); 1030 rc = SSMR3GetMem(pSSM, &muralInfo, sizeof(muralInfo));1027 rc = SSMR3GetMem(pSSM, &muralInfo, RT_OFFSETOF(CRMuralInfo, CreateInfo)); 1031 1028 AssertRCReturn(rc, rc); 1032 1029 … … 1332 1329 #endif 1333 1330 1331 { 1332 PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex); 1333 if (pDisplay) 1334 CrDpResize(pDisplay, w, h, w, h); 1335 } 1336 1334 1337 return VINF_SUCCESS; 1335 1338 } … … 1347 1350 } 1348 1351 1352 int32_t crServerSetOffscreenRenderingMode(GLubyte value) 1353 { 1354 if (cr_server.bForceOffscreenRendering==value) 1355 { 1356 return VINF_SUCCESS; 1357 } 1358 1359 if (value > CR_SERVER_REDIR_MAXVAL) 1360 { 1361 crWarning("crServerSetOffscreenRenderingMode: invalid arg: %d", value); 1362 return VERR_INVALID_PARAMETER; 1363 } 1364 1365 if (value && !crServerSupportRedirMuralFBO()) 1366 { 1367 return VERR_NOT_SUPPORTED; 1368 } 1369 1370 cr_server.bForceOffscreenRendering=value; 1371 1372 crHashtableWalk(cr_server.muralTable, crVBoxServerCheckMuralCB, NULL); 1373 1374 return VINF_SUCCESS; 1375 } 1376 1349 1377 DECLEXPORT(int32_t) crVBoxServerSetOffscreenRendering(GLboolean value) 1350 1378 { 1351 if (cr_server.bForceOffscreenRendering==value) 1352 { 1353 return VINF_SUCCESS; 1354 } 1355 1356 if (value && !crServerSupportRedirMuralFBO()) 1357 { 1358 return VERR_NOT_SUPPORTED; 1359 } 1360 1361 cr_server.bForceOffscreenRendering=value; 1362 1363 crHashtableWalk(cr_server.muralTable, crVBoxServerCheckMuralCB, NULL); 1364 1365 return VINF_SUCCESS; 1379 return crServerSetOffscreenRenderingMode(value ? CR_SERVER_REDIR_FBO_RAM : cr_server.bOffscreenRenderingDefault); 1366 1380 } 1367 1381 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r43287 r43932 264 264 } 265 265 266 void crServerCreateInfoDeleteCB(void *data)267 {268 CRCreateInfo_t *pCreateInfo = (CRCreateInfo_t *) data;269 if (pCreateInfo->pszDpyName)270 crFree(pCreateInfo->pszDpyName);271 crFree(pCreateInfo);272 }273 274 266 GLint crServerGenerateID(GLint *pCounter) 275 267 { … … 875 867 cr_server.curClient->currentMural->bFbDraw = GL_TRUE; 876 868 877 if (cr _server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()869 if (crServerIsRedirectedToFBO() 878 870 && cr_server.curClient->currentMural->idFBO) 879 871 { … … 903 895 crStateReadBuffer( mode ); 904 896 905 if (cr _server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()897 if (crServerIsRedirectedToFBO() 906 898 && cr_server.curClient->currentMural->idFBO 907 899 && !crStateGetCurrent()->framebufferobject.readFB) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r43182 r43932 108 108 CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId]; 109 109 CRASSERT(cr_server.screenCount>0); 110 CRASSERT(mural->fUseFBO == CR_SERVER_REDIR_NONE); 110 111 111 112 mural->hX = mural->gX-cr_server.screen[0].x; … … 163 164 CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId]; 164 165 165 if (mural-> bUseFBO)166 { 167 crServerRedirMuralFBO(mural, GL_FALSE);166 if (mural->fUseFBO) 167 { 168 crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE); 168 169 crServerDeleteMuralFBO(mural); 169 170 } … … 173 174 else 174 175 { 176 GLubyte redir = overlappingScreenCount >= 2 ? CR_SERVER_REDIR_FBO_RAM : cr_server.bForceOffscreenRendering; 177 175 178 if (mural->spuWindow) 176 179 { 177 if (!mural->bUseFBO) 178 { 179 crServerRedirMuralFBO(mural, GL_TRUE); 180 } 181 else 180 if (mural->fUseFBO) 182 181 { 183 182 if (mural->width!=mural->fboWidth 184 183 || mural->height!=mural->height) 185 184 { 186 crServerRedirMuralFBO(mural, GL_FALSE);185 crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE); 187 186 crServerDeleteMuralFBO(mural); 188 crServerRedirMuralFBO(mural, GL_TRUE);189 187 } 188 } 189 190 if (mural->fUseFBO != redir) 191 { 192 crServerRedirMuralFBO(mural, redir); 190 193 } 191 194 } … … 193 196 else 194 197 { 195 Assert(!mural-> bUseFBO);198 Assert(!mural->fUseFBO); 196 199 } 197 200 #endif 198 201 199 if ( !mural->bUseFBO)202 if (mural->fUseFBO != CR_SERVER_REDIR_FBO_RAM) 200 203 { 201 204 CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId]; … … 229 232 } 230 233 231 void crServerRedirMuralFBO(CRMuralInfo *mural, GLboolean redir) 232 { 234 void crServerRedirMuralFBO(CRMuralInfo *mural, GLubyte redir) 235 { 236 if (mural->fUseFBO == redir) 237 { 238 crWarning("crServerRedirMuralFBO called with the same redir status %d", redir); 239 return; 240 } 241 233 242 if (redir) 234 243 { … … 239 248 } 240 249 241 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_FALSE); 250 if (redir == CR_SERVER_REDIR_FBO_RAM) 251 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_FALSE); 252 else 253 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible); 242 254 243 255 if (mural->idFBO==0) … … 263 275 else 264 276 { 265 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible); 266 267 if (mural->bUseFBO && crServerSupportRedirMuralFBO()) 277 if (mural->fUseFBO == CR_SERVER_REDIR_FBO_RAM) 278 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible); 279 280 if (mural->fUseFBO && crServerSupportRedirMuralFBO()) 268 281 { 269 282 if (!crStateGetCurrent()->framebufferobject.drawFB) … … 284 297 } 285 298 286 mural-> bUseFBO = redir;299 mural->fUseFBO = redir; 287 300 } 288 301 … … 371 384 void crServerDeleteMuralFBO(CRMuralInfo *mural) 372 385 { 373 CRASSERT(!mural-> bUseFBO);386 CRASSERT(!mural->fUseFBO); 374 387 375 388 if (mural->idFBO!=0) … … 452 465 CRContext *ctx = crStateGetCurrent(); 453 466 454 CRASSERT(cr_server.pfnPresentFBO); 467 CRASSERT(mural->fUseFBO); 468 CRASSERT(cr_server.pfnPresentFBO || mural->fUseFBO == CR_SERVER_REDIR_FBO_BLT); 455 469 456 470 if (!mural->bVisible) … … 461 475 if (!mural->width || !mural->height) 462 476 { 477 return; 478 } 479 480 if (mural->fUseFBO == CR_SERVER_REDIR_FBO_BLT) 481 { 482 int rc; 483 PCR_BLITTER pBlitter = crServerGetFBOPresentBlitter(mural); 484 if (!pBlitter) 485 { 486 static int cPrintedWarnings = 0; 487 if (++cPrintedWarnings <= 5) 488 { 489 crWarning("crServerGetFBOPresentBlitter returned no blitter %d", cPrintedWarnings); 490 if (cPrintedWarnings == 5) 491 crWarning("won't print the above crServerGetFBOPresentBlitter warning any more", cPrintedWarnings); 492 } 493 return; 494 } 495 496 CrBltMuralSetCurrent(pBlitter, mural); 497 rc = CrBltEnter(pBlitter, cr_server.currentCtxInfo, cr_server.currentMural); 498 if (RT_SUCCESS(rc)) 499 { 500 CR_BLITTER_TEXTURE Tex; 501 RTRECT Rect; 502 Tex.width = mural->width; 503 Tex.height = mural->height; 504 Tex.target = GL_TEXTURE_2D; 505 Tex.hwid = mural->idColorTex; 506 Rect.xLeft = 0; 507 Rect.yTop = 0; 508 Rect.xRight = Tex.width; 509 Rect.yBottom = Tex.height; 510 511 CrBltBlitTexMural(pBlitter, &Tex, &Rect, &Rect, 1, 0); 512 CrBltPresent(pBlitter); 513 514 CrBltLeave(pBlitter); 515 } 516 else 517 { 518 crWarning("CrBltEnter failed rc %d", rc); 519 return; 520 } 463 521 return; 464 522 } … … 588 646 return cr_server.curClient 589 647 && cr_server.curClient->currentMural 590 && cr_server.curClient->currentMural-> bUseFBO;591 } 648 && cr_server.curClient->currentMural->fUseFBO; 649 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r43891 r43932 32 32 #include <iprt/mem.h> 33 33 34 typedef DECLCALLBACK(int) FNCRDISPLAY_REGIONS_CHANGED(struct CR_PRESENTER *pPresenter);35 typedef FNCRDISPLAY_REGIONS_CHANGED *PFNCRDISPLAY_REGIONS_CHANGED;36 37 typedef DECLCALLBACK(int) FNCRDISPLAY_DRAW_ENTRY(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter);38 typedef FNCRDISPLAY_DRAW_ENTRY *PFNCRDISPLAY_DRAW_ENTRY;39 40 typedef DECLCALLBACK(int) FNCRDISPLAY_DRAW_TEXTURE(struct CR_PRESENTER *pPresenter, PCR_BLITTER pBlitter,41 CR_BLITTER_TEXTURE *pTexture, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects);42 typedef FNCRDISPLAY_DRAW_TEXTURE *PFNCRDISPLAY_DRAW_TEXTURE;43 44 45 34 #define CR_DISPLAY_RECTS_UNDEFINED UINT32_MAX 46 35 … … 212 201 } 213 202 214 DECLCALLBACK(int) CrPtCbDrawEntrySingle(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter) 215 { 203 DECLCALLBACK(int) CrPtCbDrawEntrySingle(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter, bool *pfAllEntriesDrawn) 204 { 205 if (pfAllEntriesDrawn) 206 *pfAllEntriesDrawn = false; 207 216 208 int rc = crPtRectsCheckInit(pPresenter); 217 209 if (!RT_SUCCESS(rc)) … … 241 233 struct CR_PRESENTER_ENTRY *pEntry = CR_PRESENTER_ENTRY_FROM_ENTRY(pCEntry); 242 234 PCR_BLITTER pBlitter = (PCR_BLITTER)pvVisitor; 243 int rc = CrPtCbDrawEntrySingle(pPresenter, pEntry, pBlitter); 235 bool fAllEntriesDrawn; 236 int rc = CrPtCbDrawEntrySingle(pPresenter, pEntry, pBlitter, &fAllEntriesDrawn); 244 237 if (!RT_SUCCESS(rc)) 245 238 { 246 239 crWarning("CrPtCbDrawEntrySingle failed, rc %d", rc); 247 240 } 248 return true;249 } 250 251 DECLCALLBACK(int) CrPtCbDrawEntryAll(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter )241 return !fAllEntriesDrawn; 242 } 243 244 DECLCALLBACK(int) CrPtCbDrawEntryAll(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter, bool *pfAllEntriesDrawn) 252 245 { 253 246 int rc = crPtRectsCheckInit(pPresenter); … … 258 251 } 259 252 260 VBoxVrCompositorVisit(&pPresenter->Compositor, crPtDrawEntryAllCb, pPresenter); 253 VBoxVrCompositorVisit(&pPresenter->Compositor, crPtDrawEntryAllCb, pBlitter); 254 255 if (pfAllEntriesDrawn) 256 *pfAllEntriesDrawn = true; 261 257 262 258 return VINF_SUCCESS; … … 289 285 } 290 286 287 static int crPtEntryRegionsSet(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged) 288 { 289 bool fChanged; 290 int rc = VBoxVrCompositorEntryRegionsSet(&pPresenter->Compositor, &pEntry->Ce, cRegions, paRegions, &fChanged); 291 if (!RT_SUCCESS(rc)) 292 { 293 crWarning("VBoxVrCompositorEntryRegionsSet failed, rc %d", rc); 294 return rc; 295 } 296 297 if (fChanged) 298 { 299 crPtRectsInvalidate(pPresenter); 300 rc = pPresenter->pfnRegionsChanged(pPresenter); 301 if (!RT_SUCCESS(rc)) 302 { 303 crWarning("pfnRegionsChanged failed, rc %d", rc); 304 return rc; 305 } 306 } 307 308 if (pfChanged) 309 *pfChanged = fChanged; 310 return VINF_SUCCESS; 311 } 312 291 313 static void crPtEntryPositionSet(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, const RTPOINT *pPos) 292 314 { 293 if (pEntry && pEntry->Pos.x != pPos->x || pEntry->Pos.y != pPos->y) 294 { 295 VBoxVrCompositorEntryRemove(&pPresenter->Compositor, &pEntry->Ce); 296 crPtRectsInvalidate(pPresenter); 315 if (pEntry && (pEntry->Pos.x != pPos->x || pEntry->Pos.y != pPos->y)) 316 { 317 if (VBoxVrCompositorEntryIsInList(&pEntry->Ce)) 318 { 319 VBoxVrCompositorEntryRemove(&pPresenter->Compositor, &pEntry->Ce); 320 crPtRectsInvalidate(pPresenter); 321 } 297 322 pEntry->Pos = *pPos; 298 323 } 299 324 } 300 325 301 int CrPtEntryPresent(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, PCR_BLITTER pBlitter) 326 int CrPtPresentEntry(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, PCR_BLITTER pBlitter) 327 { 328 int rc = CrBltEnter(pBlitter, cr_server.currentCtxInfo, cr_server.currentMural); 329 if (!RT_SUCCESS(rc)) 330 { 331 crWarning("CrBltEnter failed, rc %d", rc); 332 return rc; 333 } 334 335 rc = pPresenter->pfnDrawEntry(pPresenter, pEntry, pBlitter, NULL); 336 337 CrBltLeave(pBlitter); 338 339 if (!RT_SUCCESS(rc)) 340 { 341 crWarning("pfnDraw failed, rc %d", rc); 342 return rc; 343 } 344 345 return VINF_SUCCESS; 346 } 347 348 static DECLCALLBACK(bool) crPtPresentCb(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pCEntry, void *pvVisitor) 349 { 350 struct CR_PRESENTER *pPresenter = CR_PRESENTER_FROM_COMPOSITOR(pCompositor); 351 struct CR_PRESENTER_ENTRY *pEntry = CR_PRESENTER_ENTRY_FROM_ENTRY(pCEntry); 352 PCR_BLITTER pBlitter = (PCR_BLITTER)pvVisitor; 353 bool fAllDrawn = false; 354 int rc = pPresenter->pfnDrawEntry(pPresenter, pEntry, pBlitter, &fAllDrawn); 355 if (!RT_SUCCESS(rc)) 356 { 357 crWarning("pfnDrawEntry failed, rc %d", rc); 358 } 359 return !fAllDrawn; 360 } 361 362 int CrPtPresent(PCR_PRESENTER pPresenter, PCR_BLITTER pBlitter) 363 { 364 int rc = CrBltEnter(pBlitter, cr_server.currentCtxInfo, cr_server.currentMural); 365 if (!RT_SUCCESS(rc)) 366 { 367 crWarning("CrBltEnter failed, rc %d", rc); 368 return rc; 369 } 370 371 VBoxVrCompositorVisit(&pPresenter->Compositor, crPtPresentCb, pBlitter); 372 373 CrBltLeave(pBlitter); 374 375 if (!RT_SUCCESS(rc)) 376 { 377 crWarning("pfnDraw failed, rc %d", rc); 378 return rc; 379 } 380 381 return VINF_SUCCESS; 382 } 383 384 int CrPtEntryRegionsAdd(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 302 385 { 303 386 crPtEntryPositionSet(pPresenter, pEntry, pPos); … … 310 393 } 311 394 312 if (!pEntry) 313 return VINF_SUCCESS; 314 315 rc = CrBltEnter(pBlitter, cr_server.currentCtxInfo, cr_server.currentMural); 316 if (!RT_SUCCESS(rc)) 317 { 318 crWarning("CrBltEnter failed, rc %d", rc); 319 return rc; 320 } 321 322 rc = pPresenter->pfnDrawEntry(pPresenter, pEntry, pBlitter); 323 324 CrBltLeave(pBlitter); 325 326 if (!RT_SUCCESS(rc)) 327 { 328 crWarning("pfnDrawEntry failed, rc %d", rc); 329 return rc; 330 } 395 return VINF_SUCCESS; 396 } 397 398 int CrPtEntryRegionsSet(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 399 { 400 crPtEntryPositionSet(pPresenter, pEntry, pPos); 401 402 int rc = crPtEntryRegionsSet(pPresenter, pEntry, cRegions, paRegions, NULL); 403 if (!RT_SUCCESS(rc)) 404 { 405 crWarning("crPtEntryRegionsAdd failed, rc %d", rc); 406 return rc; 407 } 408 331 409 return VINF_SUCCESS; 332 410 } … … 429 507 int CrDpInit(PCR_DISPLAY pDisplay) 430 508 { 431 const GLint visBits = CR_RGB_BIT ;432 int rc = CrPtInit(&pDisplay->Presenter, crDpCbRegionsChanged, CrPtCbDrawEntry Single, crDpCbDrawTextureWindow);509 const GLint visBits = CR_RGB_BIT | CR_DOUBLE_BIT; 510 int rc = CrPtInit(&pDisplay->Presenter, crDpCbRegionsChanged, CrPtCbDrawEntryAll, crDpCbDrawTextureWindow); 433 511 if (RT_SUCCESS(rc)) 434 512 { … … 455 533 } 456 534 457 bool CrDpBlitterTest(PCR_DISPLAY pDisplay, PCR_BLITTER pBlitter)458 { 459 CrBltMuralSetCurrent(pBlitter, &pDisplay->Mural);535 int CrDpBlitterTestWithMural(PCR_BLITTER pBlitter, CRMuralInfo *pMural) 536 { 537 CrBltMuralSetCurrent(pBlitter, pMural); 460 538 /* try to enter to make sure the blitter is initialized completely and to make sure we actually can do that */ 461 539 int rc = CrBltEnter(pBlitter, cr_server.currentCtxInfo, cr_server.currentMural); … … 463 541 { 464 542 CrBltLeave(pBlitter); 465 return true;543 return VINF_SUCCESS; 466 544 } 467 545 else … … 469 547 crWarning("CrBltEnter failed, rc %d", rc); 470 548 } 471 return false; 549 return rc; 550 } 551 552 int CrDpBlitterTest(PCR_DISPLAY pDisplay, PCR_BLITTER pBlitter) 553 { 554 return CrDpBlitterTestWithMural(pBlitter, &pDisplay->Mural); 472 555 } 473 556 … … 482 565 } 483 566 484 int CrDpPresentTexture(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 485 { 486 return CrPtEntryPresent(&pDisplay->Presenter, &pEntry->Pe, pPos, cRegions, paRegions, pDisplay->pBlitter); 567 int CrDpEntryRegionsSet(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 568 { 569 return CrPtEntryRegionsSet(&pDisplay->Presenter, &pEntry->Pe, pPos, cRegions, paRegions); 570 } 571 572 int CrDpEntryRegionsAdd(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions) 573 { 574 return CrPtEntryRegionsAdd(&pDisplay->Presenter, &pEntry->Pe, pPos, cRegions, paRegions); 575 } 576 577 int CrDpPresentEntry(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry) 578 { 579 return CrPtPresentEntry(&pDisplay->Presenter, &pEntry->Pe, pDisplay->pBlitter); 487 580 } 488 581 … … 582 675 #define CR_PRESENT_GET_FLAGS(_cfg) ((_cfg) >> CR_PRESENT_FLAGS_OFFSET) 583 676 584 static uint8_t crServerCheckInitDisplayBlitter() 677 int crServerBlitterInit(PCR_BLITTER pBlitter, CRMuralInfo*pMural) 678 { 679 int rc = CrBltInit(pBlitter, pMural); 680 if (RT_SUCCESS(rc)) 681 { 682 rc = CrDpBlitterTestWithMural(pBlitter, pMural); 683 if (RT_SUCCESS(rc)) 684 return VINF_SUCCESS; 685 else 686 crWarning("CrDpBlitterTestWithMural failed, rc %d", rc); 687 CrBltTerm(pBlitter); 688 } 689 else 690 crWarning("CrBltInit failed, rc %d", rc); 691 return rc; 692 } 693 694 PCR_BLITTER crServerGetFBOPresentBlitter(CRMuralInfo*pMural) 695 { 696 if (cr_server.fFBOModeBlitterInited > 0) 697 return &cr_server.FBOModeBlitter; 698 if (!cr_server.fFBOModeBlitterInited) 699 { 700 int rc = crServerBlitterInit(&cr_server.FBOModeBlitter, pMural); 701 if (RT_SUCCESS(rc)) 702 { 703 cr_server.fFBOModeBlitterInited = 1; 704 return &cr_server.FBOModeBlitter; 705 } 706 crWarning("crServerBlitterInit failed rc %d", rc); 707 cr_server.fFBOModeBlitterInited = -1; 708 } 709 return NULL; 710 } 711 712 static int8_t crServerCheckInitDisplayBlitter() 585 713 { 586 714 if (cr_server.fPresentBlitterInited) … … 597 725 { 598 726 CRMuralInfo*pMural = CrDpGetMural(&cr_server.aDispplays[0]); 599 CRCreateInfo_t*pCreateInfo = CrDpGetMuralCreateInfo(&cr_server.aDispplays[0]); 600 rc = CrBltInit(&cr_server.PresentBlitter, pMural, pCreateInfo->visualBits); 727 rc = crServerBlitterInit(&cr_server.PresentBlitter, pMural); 601 728 if (RT_SUCCESS(rc)) 602 729 { 603 if (CrDpBlitterTest(&cr_server.aDispplays[0], &cr_server.PresentBlitter)) 604 { 605 CrDpBlitterSet(&cr_server.aDispplays[0], &cr_server.PresentBlitter); 606 ASMBitSet(cr_server.DisplaysInitMap, 0); 607 cr_server.fPresentBlitterInited = 1; 608 return 1; 609 } 610 else 611 { 612 crWarning("CrDpBlitterTest failed"); 613 } 614 CrBltTerm(&cr_server.PresentBlitter); 730 CrDpBlitterSet(&cr_server.aDispplays[0], &cr_server.PresentBlitter); 731 CrDpResize(&cr_server.aDispplays[0], 732 cr_server.screen[0].w, cr_server.screen[0].h, 733 cr_server.screen[0].w, cr_server.screen[0].h); 734 ASMBitSet(cr_server.DisplaysInitMap, 0); 735 cr_server.fPresentBlitterInited = 1; 736 return 1; 615 737 } 616 738 else 617 739 { 618 crWarning(" CrBltInit failed, rc %d", rc);740 crWarning("crServerBlitterInit failed, rc %d", rc); 619 741 } 620 742 CrDpTerm(&cr_server.aDispplays[0]); … … 638 760 { 639 761 return crServerCheckInitDisplayBlitter() > 0; 762 } 763 764 PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen) 765 { 766 if (ASMBitTest(cr_server.DisplaysInitMap, idScreen)) 767 return &cr_server.aDispplays[idScreen]; 768 return NULL; 640 769 } 641 770 … … 662 791 { 663 792 CrDpBlitterSet(&cr_server.aDispplays[idScreen], &cr_server.PresentBlitter); 793 CrDpResize(&cr_server.aDispplays[idScreen], 794 cr_server.screen[idScreen].w, cr_server.screen[idScreen].h, 795 cr_server.screen[idScreen].w, cr_server.screen[idScreen].h); 664 796 ASMBitSet(cr_server.DisplaysInitMap, idScreen); 665 797 return &cr_server.aDispplays[idScreen]; … … 697 829 698 830 RTPOINT Point = {xPos, yPos}; 699 int rc = CrDpPresentTexture(pDisplay, pEntry, &Point, (uint32_t)cRects, (const RTRECT*)pRects); 700 if (!RT_SUCCESS(rc)) 701 { 702 crWarning("CrDpPresentTexture Failed rc %d", rc); 703 } 704 } 831 int rc = CrDpEntryRegionsAdd(pDisplay, pEntry, &Point, (uint32_t)cRects, (const RTRECT*)pRects); 832 if (!RT_SUCCESS(rc)) 833 { 834 crWarning("CrDpEntrySetRegions Failed rc %d", rc); 835 return; 836 } 837 838 rc = CrDpPresentEntry(pDisplay, pEntry); 839 if (!RT_SUCCESS(rc)) 840 { 841 crWarning("CrDpEntrySetRegions Failed rc %d", rc); 842 return; 843 } 844 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py
r41258 r43932 76 76 CRASSERT(tablesize/sizeof(%s)==1); 77 77 fboid = crStateFBOHWIDtoID((GLuint) *get_values); 78 if (cr_server.curClient->currentMural->bUseFBO 79 && crServerIsRedirectedToFBO() 78 if (crServerIsRedirectedToFBO() 80 79 && fboid==cr_server.curClient->currentMural->idFBO) 81 80 { … … 86 85 else if (GL_READ_BUFFER==pname) 87 86 { 88 if (cr _server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()87 if (crServerIsRedirectedToFBO() 89 88 && cr_server.curClient->currentMural->idFBO 90 89 && !crStateGetCurrent()->framebufferobject.readFB) … … 95 94 else if (GL_DRAW_BUFFER==pname) 96 95 { 97 if (cr _server.curClient->currentMural->bUseFBO && crServerIsRedirectedToFBO()96 if (crServerIsRedirectedToFBO() 98 97 && cr_server.curClient->currentMural->idFBO 99 98 && !crStateGetCurrent()->framebufferobject.drawFB) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r43888 r43932 44 44 mural->screenId = 0; 45 45 mural->bVisible = GL_FALSE; 46 mural-> bUseFBO = GL_FALSE;46 mural->fUseFBO = CR_SERVER_REDIR_NONE; 47 47 48 48 mural->cVisibleRects = 0; … … 58 58 windowID = preloadWinID<0 ? crServerGenerateID(&cr_server.idsPool.freeWindowID) : preloadWinID; 59 59 60 mural->CreateInfo.visualBits = visBits; 61 mural->CreateInfo.externalID = windowID; 62 mural->CreateInfo.pszDpyName = dpyName ? crStrdup(dpyName) : NULL; 63 60 64 crServerSetupOutputRedirect(mural); 61 65 … … 68 72 CRMuralInfo *mural; 69 73 GLint windowID = -1; 70 CRCreateInfo_t *pCreateInfo;71 74 72 75 if (cr_server.sharedWindows) { … … 119 122 crHashtableAdd(cr_server.muralTable, windowID, mural); 120 123 121 pCreateInfo = (CRCreateInfo_t *) crAlloc(sizeof(CRCreateInfo_t));122 pCreateInfo->pszDpyName = dpyName ? crStrdup(dpyName) : NULL;123 pCreateInfo->visualBits = visBits;124 crHashtableAdd(cr_server.pWindowCreateInfoTable, windowID, pCreateInfo);125 126 124 crDebug("CRServer: client %p created new window %d (SPU window %d)", 127 125 cr_server.curClient, windowID, mural->spuWindow); … … 165 163 } 166 164 167 crServerRedirMuralFBO(mural, GL_FALSE);165 crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE); 168 166 crServerDeleteMuralFBO(mural); 169 167 … … 270 268 } 271 269 272 crHashtableDelete(cr_server.pWindowCreateInfoTable, window, crServerCreateInfoDeleteCB); 270 if (mural->CreateInfo.pszDpyName) 271 crFree(mural->CreateInfo.pszDpyName); 273 272 274 273 crHashtableDelete(cr_server.muralTable, window, crFree); … … 389 388 } 390 389 391 if ( !mural->bUseFBO)390 if (mural->fUseFBO != CR_SERVER_REDIR_FBO_RAM) 392 391 { 393 392 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state);
Note:
See TracChangeset
for help on using the changeset viewer.