Changeset 45132 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Mar 21, 2013 4:11:28 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84435
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r44528 r45132 1074 1074 Assert(sizeof(RTRECT)==4*sizeof(GLint)); 1075 1075 1076 rc = crVBoxServerSetRootVisibleRegion(paParms[1].u.uint32, ( GLint*)paParms[0].u.pointer.addr);1076 rc = crVBoxServerSetRootVisibleRegion(paParms[1].u.uint32, (const RTRECT*)paParms[0].u.pointer.addr); 1077 1077 break; 1078 1078 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r45066 r45132 116 116 void crServerMuralTerm(CRMuralInfo *mural); 117 117 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height); 118 int crServerMuralSynchRootVr(CRMuralInfo *mural, uint32_t *pcRects, const RTRECT **ppRects); 118 119 119 120 GLint crServerGenerateID(GLint *pCounter); … … 150 151 && mural->width 151 152 && mural->height 152 && CrVrScrCompositorEntryIsInList(&mural->CEntry);153 && !mural->fRootVrOn ? CrVrScrCompositorEntryIsInList(&mural->CEntry) : CrVrScrCompositorEntryIsInList(&mural->RootVrCEntry); 153 154 } 154 155 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r45096 r45132 349 349 cr_server.dummyMuralTable = crAllocHashtable(); 350 350 351 cr_server.fRootVrOn = GL_FALSE; 352 VBoxVrListInit(&cr_server.RootVr); 353 crMemset(&cr_server.RootVrCurPoint, 0, sizeof (cr_server.RootVrCurPoint)); 354 351 355 crServerInitDispatch(); 352 356 crStateDiffAPI( &(cr_server.head_spu->dispatch_table) ); … … 433 437 434 438 cr_server.dummyMuralTable = crAllocHashtable(); 439 440 cr_server.fRootVrOn = GL_FALSE; 441 VBoxVrListInit(&cr_server.RootVr); 442 crMemset(&cr_server.RootVrCurPoint, 0, sizeof (cr_server.RootVrCurPoint)); 435 443 436 444 crServerSetVBoxConfigurationHGCM(); … … 2328 2336 } 2329 2337 2330 DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, GLint *pRects) 2331 { 2332 renderspuSetRootVisibleRegion(cRects, pRects); 2338 static int crVBoxServerUpdateMuralRootVisibleRegion(CRMuralInfo *pMI) 2339 { 2340 GLboolean fForcePresent; 2341 uint32_t cRects; 2342 const RTRECT *pRects; 2343 int rc; 2344 2345 fForcePresent = crServerVBoxCompositionPresentNeeded(pMI); 2346 2347 crServerVBoxCompositionDisable(pMI); 2348 2349 if (cr_server.fRootVrOn) 2350 { 2351 if (!pMI->fRootVrOn) 2352 { 2353 VBOXVR_TEXTURE Tex = {0}; 2354 2355 rc = CrVrScrCompositorInit(&pMI->RootVrCompositor); 2356 if (!RT_SUCCESS(rc)) 2357 { 2358 crWarning("CrVrScrCompositorInit failed, rc %d", rc); 2359 return rc; 2360 } 2361 2362 2363 Tex.width = pMI->width; 2364 Tex.height = pMI->height; 2365 Tex.target = GL_TEXTURE_2D; 2366 Tex.hwid = 0; 2367 CrVrScrCompositorEntryInit(&pMI->RootVrCEntry, &Tex); 2368 } 2369 2370 rc = crServerMuralSynchRootVr(pMI, &cRects, &pRects); 2371 if (!RT_SUCCESS(rc)) 2372 { 2373 crWarning("crServerMuralSynchRootVr failed, rc %d", rc); 2374 return rc; 2375 } 2376 2377 if (!pMI->fRootVrOn) 2378 CrVrScrCompositorEntryTexUpdate(&pMI->RootVrCEntry, CrVrScrCompositorEntryTexGet(&pMI->CEntry)); 2379 } 2380 else 2381 { 2382 CrVrScrCompositorTerm(&pMI->RootVrCompositor); 2383 rc = CrVrScrCompositorEntryRegionsGet(&pMI->Compositor, &pMI->CEntry, &cRects, NULL, &pRects); 2384 if (!RT_SUCCESS(rc)) 2385 { 2386 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 2387 return rc; 2388 } 2389 2390 /* CEntry should always be in sync */ 2391 // CrVrScrCompositorEntryTexUpdate(&pMI->CEntry, CrVrScrCompositorEntryTexGet(&pMI->RootVrCEntry)); 2392 } 2393 2394 cr_server.head_spu->dispatch_table.WindowVisibleRegion(pMI->spuWindow, cRects, pRects); 2395 2396 if (pMI->pvOutputRedirectInstance) 2397 { 2398 /* @todo the code assumes that RTRECT == four GLInts. */ 2399 cr_server.outputRedirect.CRORVisibleRegion(pMI->pvOutputRedirectInstance, 2400 cRects, pRects); 2401 } 2402 2403 pMI->fRootVrOn = cr_server.fRootVrOn; 2404 2405 crServerVBoxCompositionReenable(pMI, fForcePresent); 2406 2407 return rc; 2408 } 2409 2410 static void crVBoxServerSetRootVisibleRegionCB(unsigned long key, void *data1, void *data2) 2411 { 2412 CRMuralInfo *pMI = (CRMuralInfo*) data1; 2413 2414 if (!pMI->CreateInfo.externalID) 2415 return; 2416 (void) data2; 2417 2418 crVBoxServerUpdateMuralRootVisibleRegion(pMI); 2419 } 2420 2421 DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, const RTRECT *pRects) 2422 { 2423 int32_t rc = VINF_SUCCESS; 2424 2425 /* non-zero rects pointer indicate rects are present and switched on 2426 * i.e. cRects==0 and pRects!=NULL means root visible regioning is ON and there are no visible regions, 2427 * while pRects==NULL means root visible regioning is OFF, i.e. everything is visible */ 2428 if (pRects) 2429 { 2430 crMemset(&cr_server.RootVrCurPoint, 0, sizeof (cr_server.RootVrCurPoint)); 2431 rc = VBoxVrListRectsSet(&cr_server.RootVr, cRects, pRects, NULL); 2432 if (!RT_SUCCESS(rc)) 2433 { 2434 crWarning("VBoxVrListRectsSet failed! rc %d", rc); 2435 return rc; 2436 } 2437 2438 cr_server.fRootVrOn = GL_TRUE; 2439 } 2440 else 2441 { 2442 if (!cr_server.fRootVrOn) 2443 return VINF_SUCCESS; 2444 2445 VBoxVrListClear(&cr_server.RootVr); 2446 2447 cr_server.fRootVrOn = GL_FALSE; 2448 } 2449 2450 crHashtableWalk(cr_server.muralTable, crVBoxServerSetRootVisibleRegionCB, NULL); 2333 2451 2334 2452 return VINF_SUCCESS; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r45066 r45132 325 325 SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table; 326 326 CRContextInfo *pMuralContextInfo; 327 VBOXVR_TEXTURE Tex; 327 328 328 329 CRASSERT(mural->aidFBOs[0]==0); … … 429 430 430 431 CRASSERT(mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 431 CrVrScrCompositorEntryTexNameUpdate(&mural->CEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 432 433 Tex.width = mural->width; 434 Tex.height = mural->height; 435 Tex.target = GL_TEXTURE_2D; 436 Tex.hwid = mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]; 437 438 CrVrScrCompositorEntryTexUpdate(&mural->CEntry, &Tex); 439 440 if (mural->fRootVrOn) 441 CrVrScrCompositorEntryTexUpdate(&mural->RootVrCEntry, &Tex); 432 442 } 433 443 … … 538 548 crStateSwitchPrepare(NULL, curCtx, idDrawFBO, idReadFBO); 539 549 540 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry); 550 if (!mural->fRootVrOn) 551 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->Compositor, &mural->CEntry); 552 else 553 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mural->spuWindow, &mural->RootVrCompositor, &mural->RootVrCEntry); 541 554 542 555 crStateSwitchPostprocess(curCtx, NULL, idDrawFBO, idReadFBO); … … 677 690 GLboolean crServerIsRedirectedToFBO() 678 691 { 692 #ifdef DEBUG_misha 693 Assert(cr_server.curClient); 694 if (cr_server.curClient) 695 { 696 Assert(cr_server.curClient->currentMural == cr_server.currentMural); 697 Assert(cr_server.curClient->currentCtxInfo == cr_server.currentCtxInfo); 698 } 699 #endif 679 700 return cr_server.curClient 680 701 && cr_server.curClient->currentMural … … 711 732 Assert(mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 712 733 CrVrScrCompositorEntryTexNameUpdate(&mural->CEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 713 } 734 if (mural->fRootVrOn) 735 CrVrScrCompositorEntryTexNameUpdate(&mural->RootVrCEntry, mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); 736 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r44766 r45132 107 107 { 108 108 CrVrScrCompositorLock(&pDisplay->Compositor); 109 int rc = CrVrScrCompositorEntryRegionsSet(&pDisplay->Compositor, &pEntry->CEntry, pPos, cRegions, paRegions );109 int rc = CrVrScrCompositorEntryRegionsSet(&pDisplay->Compositor, &pEntry->CEntry, pPos, cRegions, paRegions, NULL); 110 110 CrVrScrCompositorUnlock(&pDisplay->Compositor); 111 111 return rc; … … 115 115 { 116 116 CrVrScrCompositorLock(&pDisplay->Compositor); 117 int rc = CrVrScrCompositorEntryRegionsAdd(&pDisplay->Compositor, &pEntry->CEntry, pPos, cRegions, paRegions );117 int rc = CrVrScrCompositorEntryRegionsAdd(&pDisplay->Compositor, &pEntry->CEntry, pPos, cRegions, paRegions, NULL); 118 118 CrVrScrCompositorUnlock(&pDisplay->Compositor); 119 119 return rc; … … 141 141 } 142 142 143 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const PVBOXVR_TEXTUREpTextureData)143 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData) 144 144 { 145 145 CrVrScrCompositorEntryInit(&pEntry->CEntry, pTextureData); … … 317 317 318 318 GLuint uid = pTObj->hwid; 319 CRASSERT(uid); 319 320 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, uid); 320 321 } … … 363 364 364 365 GLuint uid = pTObj->hwid; 366 CRASSERT(uid); 365 367 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, uid); 366 368 } … … 385 387 386 388 void SERVER_DISPATCH_APIENTRY 387 crServerDispatchVBoxTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, GLint *pRects)389 crServerDispatchVBoxTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, const GLint *pRects) 388 390 { 389 391 uint32_t idScreen = CR_PRESENT_GET_SCREEN(cfg); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r45066 r45132 24 24 GLint spuWindow; 25 25 VBOXVR_TEXTURE Tex = {0}; 26 27 int rc = CrVrScrCompositorInit(&mural->Compositor); 26 RTRECT Rect; 27 int rc; 28 29 crMemset(mural, 0, sizeof (*mural)); 30 31 rc = CrVrScrCompositorInit(&mural->Compositor); 28 32 if (!RT_SUCCESS(rc)) 29 33 { 30 34 crWarning("CrVrScrCompositorInit failed, rc %d", rc); 31 35 return -1; 36 } 37 38 if (cr_server.fRootVrOn) 39 { 40 rc = CrVrScrCompositorInit(&mural->RootVrCompositor); 41 if (!RT_SUCCESS(rc)) 42 { 43 crWarning("CrVrScrCompositorInit failed, rc %d", rc); 44 return -1; 45 } 32 46 } 33 47 … … 38 52 if (spuWindow < 0) { 39 53 CrVrScrCompositorTerm(&mural->Compositor); 54 if (cr_server.fRootVrOn) 55 CrVrScrCompositorTerm(&mural->RootVrCompositor); 40 56 return spuWindow; 41 57 } … … 49 65 Tex.hwid = 0; 50 66 CrVrScrCompositorEntryInit(&mural->CEntry, &Tex); 67 68 if (cr_server.fRootVrOn) 69 { 70 CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex); 71 mural->fRootVrOn = GL_TRUE; 72 } 51 73 52 74 defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0); … … 83 105 84 106 crServerSetupOutputRedirect(mural); 107 108 Rect.xLeft = 0; 109 Rect.xRight = mural->width; 110 Rect.yTop = 0; 111 Rect.yBottom = mural->height; 112 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL); 113 if (!RT_SUCCESS(rc)) 114 { 115 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 116 return -1; 117 } 118 119 if (mural->fRootVrOn) 120 { 121 uint32_t cRects; 122 const RTRECT *pRects; 123 int rc = crServerMuralSynchRootVr(mural, &cRects, &pRects); 124 if (RT_SUCCESS(rc)) 125 { 126 if (cRects != 1 127 || pRects[0].xLeft != 0 || pRects[0].yTop != 0 128 || pRects[0].xRight != mural->width || pRects[0].yBottom != mural->height) 129 { 130 /* do visible rects only ig they differ from the default */ 131 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects); 132 133 if (mural->pvOutputRedirectInstance) 134 { 135 /* @todo the code assumes that RTRECT == four GLInts. */ 136 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, 137 cRects, pRects); 138 } 139 } 140 } 141 } 85 142 86 143 return windowID; … … 165 222 } 166 223 224 static bool crServerVBoxTranslateIntersectRect(CRMuralInfo *mural, const RTRECT *pSrcRect, PRTRECT pDstRect) 225 { 226 int32_t xLeft = RT_MAX(mural->gX, pSrcRect->xRight); 227 int32_t yTop = RT_MAX(mural->gY, pSrcRect->yBottom); 228 int32_t xRight = RT_MIN(mural->gX + mural->width, pSrcRect->xLeft); 229 int32_t yBottom = RT_MIN(mural->gY + mural->height, pSrcRect->yTop); 230 231 if (xLeft < xRight && yTop < yBottom) 232 { 233 pDstRect->xLeft = xLeft; 234 pDstRect->yTop = yTop; 235 pDstRect->xRight = xRight; 236 pDstRect->yBottom = yBottom; 237 return true; 238 } 239 240 return false; 241 } 242 243 static void crServerVBoxRootVrTranslateForMural(CRMuralInfo *mural) 244 { 245 int32_t dx = cr_server.RootVrCurPoint.x - mural->gX; 246 int32_t dy = cr_server.RootVrCurPoint.y - mural->gY; 247 248 VBoxVrListTranslate(&cr_server.RootVr, dx, dy); 249 } 250 167 251 static int crServerRemoveClientWindow(CRClient *pClient, GLint window) 168 252 { … … 316 400 CrVrScrCompositorTerm(&mural->Compositor); 317 401 402 if (mural->fRootVrOn) 403 CrVrScrCompositorTerm(&mural->RootVrCompositor); 404 318 405 crHashtableDelete(cr_server.muralTable, window, crFree); 319 406 } 320 407 408 int crServerMuralSynchRootVr(CRMuralInfo *mural, uint32_t *pcRects, const RTRECT **ppRects) 409 { 410 int rc; 411 412 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, pcRects, NULL, ppRects); 413 if (!RT_SUCCESS(rc)) 414 { 415 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 416 return rc; 417 } 418 419 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, *pcRects, *ppRects, NULL); 420 if (!RT_SUCCESS(rc)) 421 { 422 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 423 return rc; 424 } 425 426 crServerVBoxRootVrTranslateForMural(mural); 427 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL); 428 if (!RT_SUCCESS(rc)) 429 { 430 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 431 return rc; 432 } 433 434 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, pcRects, NULL, ppRects); 435 if (!RT_SUCCESS(rc)) 436 { 437 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 438 return rc; 439 } 440 441 return VINF_SUCCESS; 442 } 443 321 444 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height) 322 445 { 323 446 if (mural->width != width || mural->height != height) 324 447 { 448 uint32_t cRects; 449 const RTRECT *pRects; 325 450 RTRECT Rect; 326 451 VBOXVR_TEXTURE Tex; 452 int rc = VINF_SUCCESS; 327 453 Tex.width = width; 328 454 Tex.height = height; … … 346 472 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 347 473 /* CrVrScrCompositorLock(&mural->Compositor); */ 348 CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry); 474 rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry); 475 if (!RT_SUCCESS(rc)) 476 { 477 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc); 478 return; 479 } 349 480 CrVrScrCompositorEntryInit(&mural->CEntry, &Tex); 350 481 /* initially set regions to all visible since this is what some guest assume … … 354 485 Rect.yTop = 0; 355 486 Rect.yBottom = height; 356 CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect); 487 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL); 488 if (!RT_SUCCESS(rc)) 489 { 490 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 491 return; 492 } 357 493 /* CrVrScrCompositorUnlock(&mural->Compositor); */ 358 494 mural->width = width; … … 365 501 } 366 502 503 if (mural->fRootVrOn) 504 { 505 rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry); 506 if (!RT_SUCCESS(rc)) 507 { 508 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc); 509 return; 510 } 511 CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex); 512 /* initially set regions to all visible since this is what some guest assume 513 * and will not post any more visible regions command */ 514 Rect.xLeft = 0; 515 Rect.xRight = width; 516 Rect.yTop = 0; 517 Rect.yBottom = height; 518 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, 1, &Rect, NULL); 519 if (!RT_SUCCESS(rc)) 520 { 521 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 522 return; 523 } 524 525 crServerVBoxRootVrTranslateForMural(mural); 526 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL); 527 if (!RT_SUCCESS(rc)) 528 { 529 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 530 return; 531 } 532 533 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects); 534 if (!RT_SUCCESS(rc)) 535 { 536 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 537 return; 538 } 539 } 540 else 541 { 542 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects); 543 if (!RT_SUCCESS(rc)) 544 { 545 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 546 return; 547 } 548 } 549 367 550 crServerCheckMuralGeometry(mural); 368 551 369 552 cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height); 553 554 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects); 555 556 if (mural->pvOutputRedirectInstance) 557 { 558 /* @todo the code assumes that RTRECT == four GLInts. */ 559 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, 560 cRects, (RTRECT *)pRects); 561 } 370 562 371 563 /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */ … … 404 596 { 405 597 CRMuralInfo *mural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, window); 406 RTPOINT Pos;598 GLboolean fForcePresent = GL_FALSE; 407 599 /* crDebug("CRServer: Window %d pos %d, %d", window, x, y);*/ 408 600 if (!mural) { … … 427 619 /* 2. do necessary modifications (see above comment) */ 428 620 /* NOTE: we can do it even if mural->fUseFBO == CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */ 429 Pos.x = x; 430 Pos.y = y; 431 432 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 433 /* CrVrScrCompositorLock(&mural->Compositor); */ 434 /* no need to set position because the position is relative to window */ 435 /*CrVrScrCompositorEntryPosSet(&mural->Compositor, &mural->CEntry, &Pos);*/ 436 /*CrVrScrCompositorUnlock(&mural->Compositor);*/ 437 438 mural->gX = x; 439 mural->gY = y; 621 622 if (mural->gX != x || mural->gY != y) 623 { 624 if (mural->fRootVrOn) 625 { 626 fForcePresent = crServerVBoxCompositionPresentNeeded(mural); 627 } 628 629 mural->gX = x; 630 mural->gY = y; 631 632 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 633 /* CrVrScrCompositorLock(&mural->Compositor); */ 634 /* no need to set position because the position is relative to window */ 635 /*CrVrScrCompositorEntryPosSet(&mural->Compositor, &mural->CEntry, &Pos);*/ 636 /*CrVrScrCompositorUnlock(&mural->Compositor);*/ 637 638 if (mural->fRootVrOn) 639 { 640 uint32_t cRects; 641 const RTRECT *pRects; 642 int rc = crServerMuralSynchRootVr(mural, &cRects, &pRects); 643 644 if (RT_SUCCESS(rc)) 645 { 646 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects); 647 648 if (mural->pvOutputRedirectInstance) 649 { 650 /* @todo the code assumes that RTRECT == four GLInts. */ 651 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, 652 cRects, pRects); 653 } 654 } 655 else 656 { 657 crWarning("crServerMuralSynchRootVr failed, rc %d", rc); 658 } 659 } 660 } 440 661 441 662 crServerCheckMuralGeometry(mural); 442 663 443 664 /* 3. re-set the compositor (see above comment) */ 444 crServerVBoxCompositionReenable(mural, GL_FALSE);665 crServerVBoxCompositionReenable(mural, fForcePresent); 445 666 } 446 667 } 447 668 448 669 void SERVER_DISPATCH_APIENTRY 449 crServerDispatchWindowVisibleRegion( GLint window, GLint cRects, GLint *pRects )670 crServerDispatchWindowVisibleRegion( GLint window, GLint cRects, const GLint *pRects ) 450 671 { 451 672 CRMuralInfo *mural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, window); 452 673 GLboolean fForcePresent = crServerVBoxCompositionPresentNeeded(mural); 674 bool fRegionsChanged = false; 675 int rc = VINF_SUCCESS; 453 676 if (!mural) { 454 677 #if EXTRA_WARN … … 470 693 471 694 /* 2. do necessary modifications (see above comment) */ 695 if (mural->pVisibleRects) 696 { 697 crFree(mural->pVisibleRects); 698 mural->pVisibleRects = NULL; 699 } 700 701 mural->cVisibleRects = cRects; 702 mural->bReceivedRects = GL_TRUE; 703 if (cRects) 704 { 705 mural->pVisibleRects = (GLint*) crAlloc(4*sizeof(GLint)*cRects); 706 if (!mural->pVisibleRects) 707 { 708 crError("Out of memory in crServerDispatchWindowVisibleRegion"); 709 } 710 crMemcpy(mural->pVisibleRects, pRects, 4*sizeof(GLint)*cRects); 711 } 712 472 713 /* NOTE: we can do it even if mural->fUseFBO = CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */ 473 714 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 474 715 /* CrVrScrCompositorLock(&mural->Compositor); */ 475 CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, cRects, (const RTRECT *)pRects);716 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, cRects, (const RTRECT *)pRects, &fRegionsChanged); 476 717 /*CrVrScrCompositorUnlock(&mural->Compositor);*/ 477 478 if (mural->pVisibleRects) 479 { 480 crFree(mural->pVisibleRects); 481 mural->pVisibleRects = NULL; 482 } 483 484 mural->cVisibleRects = cRects; 485 mural->bReceivedRects = GL_TRUE; 486 if (cRects) 487 { 488 mural->pVisibleRects = (GLint*) crAlloc(4*sizeof(GLint)*cRects); 489 if (!mural->pVisibleRects) 490 { 491 crError("Out of memory in crServerDispatchWindowVisibleRegion"); 492 } 493 crMemcpy(mural->pVisibleRects, pRects, 4*sizeof(GLint)*cRects); 494 } 495 496 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects); 497 498 if (mural->pvOutputRedirectInstance) 499 { 500 /* @todo the code assumes that RTRECT == four GLInts. */ 501 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, 502 cRects, (RTRECT *)pRects); 718 if (!RT_SUCCESS(rc)) 719 { 720 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 721 return; 722 } 723 724 if (fRegionsChanged) 725 { 726 if (mural->fRootVrOn) 727 { 728 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, cRects, (const RTRECT *)pRects, NULL); 729 if (!RT_SUCCESS(rc)) 730 { 731 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 732 return; 733 } 734 735 crServerVBoxRootVrTranslateForMural(mural); 736 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL); 737 if (!RT_SUCCESS(rc)) 738 { 739 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 740 return; 741 } 742 743 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, (const RTRECT **)&pRects); 744 if (!RT_SUCCESS(rc)) 745 { 746 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 747 return; 748 } 749 } 750 else 751 { 752 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, (const RTRECT **)&pRects); 753 if (!RT_SUCCESS(rc)) 754 { 755 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 756 return; 757 } 758 } 759 760 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects); 761 762 if (mural->pvOutputRedirectInstance) 763 { 764 /* @todo the code assumes that RTRECT == four GLInts. */ 765 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, 766 cRects, (RTRECT *)pRects); 767 } 503 768 } 504 769 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r45066 r45132 597 597 598 598 static void RENDER_APIENTRY 599 renderspuWindowVisibleRegion(GLint win, GLint cRects, GLint *pRects)599 renderspuWindowVisibleRegion(GLint win, GLint cRects, const GLint *pRects) 600 600 { 601 601 WindowInfo *window; -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
r45066 r45132 378 378 extern void renderspu_SystemGetMaxWindowSize( WindowInfo *window, GLint *w, GLint *h ); 379 379 extern void renderspu_SystemWindowPosition( WindowInfo *window, GLint x, GLint y ); 380 extern void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, GLint* pRects); 381 extern void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window); 382 #ifdef RT_OS_DARWIN 383 extern void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects); 384 #endif 380 extern void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects); 385 381 386 382 #ifdef GLX … … 428 424 #endif 429 425 DECLEXPORT(void) renderspuSetWindowId(uint64_t winId); 430 DECLEXPORT(void) renderspuSetRootVisibleRegion(GLint cRects, GLint *pRects);431 426 DECLEXPORT(void) renderspuReparentWindow(GLint window); 432 427 #ifdef __cplusplus -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c
r45036 r45132 65 65 DEBUG_MSG_RESULT(result, text); \ 66 66 } 67 68 static void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window); 69 static void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects); 67 70 68 71 /* In some case (like compiz which doesn't provide us with clipping regions) we … … 701 704 } 702 705 703 void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, GLint* pRects)706 void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects) 704 707 { 705 708 CRASSERT(window); … … 736 739 } 737 740 738 void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects)741 static void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects) 739 742 { 740 743 /* Remember the visible region of the root window if there is one */ … … 763 766 764 767 /*Assumes that all regions are in the guest coordinates system*/ 765 void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window)768 static void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window) 766 769 { 767 770 ContextInfo *c = renderspuGetWindowContext(window); -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c
r45066 r45132 177 177 } 178 178 179 void renderspu_SystemWindowVisibleRegion(WindowInfo *pWinInfo, GLint cRects, GLint* paRects)179 void renderspu_SystemWindowVisibleRegion(WindowInfo *pWinInfo, GLint cRects, const GLint* paRects) 180 180 { 181 181 CRASSERT(pWinInfo); … … 184 184 } 185 185 186 void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *paRects)187 {188 }189 190 186 void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *pWinInfo) 191 187 { -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h
r45066 r45132 46 46 47 47 void cocoaViewMakeCurrentContext(NativeNSViewRef pView, NativeNSOpenGLContextRef pCtx); 48 void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, GLint* paRects);48 void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, const GLint* paRects); 49 49 void cocoaViewPresentComposition(NativeNSViewRef pView, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry); 50 50 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r45066 r45132 349 349 350 350 - (void)clearVisibleRegions; 351 - (void)setVisibleRegions:(GLint)cRects paRects:( GLint*)paRects;351 - (void)setVisibleRegions:(GLint)cRects paRects:(const GLint*)paRects; 352 352 353 353 - (NSView*)dockTileScreen; … … 1380 1380 } 1381 1381 1382 - (void)setVisibleRegions:(GLint)cRects paRects:( GLint*)paRects1382 - (void)setVisibleRegions:(GLint)cRects paRects:(const GLint*)paRects 1383 1383 { 1384 1384 GLint cOldRects = m_cClipRects; … … 1729 1729 } 1730 1730 1731 void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, GLint* paRects)1731 void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, const GLint* paRects) 1732 1732 { 1733 1733 NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init]; -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
r45066 r45132 1893 1893 1894 1894 void 1895 renderspu_SystemWindowVisibleRegion( WindowInfo *window, GLint cRects, GLint *pRects )1895 renderspu_SystemWindowVisibleRegion( WindowInfo *window, GLint cRects, const GLint *pRects ) 1896 1896 { 1897 1897 #ifdef USE_OSMESA -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
r44913 r45132 538 538 render_spu_parent_window_id = winId; 539 539 } 540 541 #ifdef RT_OS_DARWIN542 static void renderspuWindowVisibleRegionCB(unsigned long key, void *data1, void *data2)543 {544 WindowInfo *window = (WindowInfo *) data1;545 CRASSERT(window);546 547 renderspu_SystemWindowApplyVisibleRegion(window);548 }549 #endif550 551 DECLEXPORT(void) renderspuSetRootVisibleRegion(GLint cRects, GLint *pRects)552 {553 #ifdef RT_OS_DARWIN554 renderspu_SystemSetRootVisibleRegion(cRects, pRects);555 556 crHashtableWalk(render_spu.windowTable, renderspuWindowVisibleRegionCB, NULL);557 #endif558 }559 560 #ifndef RT_OS_DARWIN561 void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window)562 {563 }564 #endif -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c
r45066 r45132 1552 1552 } 1553 1553 1554 void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, GLint* pRects)1554 void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects) 1555 1555 { 1556 1556 GLint i;
Note:
See TracChangeset
for help on using the changeset viewer.