Changeset 45248 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
- Timestamp:
- Mar 29, 2013 2:57:24 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c
r45201 r45248 83 83 mural->spuWindow = spuWindow; 84 84 mural->screenId = 0; 85 mural->fHasParentWindow = !!cr_server.screen[0].winID; 85 86 mural->bVisible = !!dims[0]; 86 mural->f UseFBO = CR_SERVER_REDIR_NONE;87 mural->fPresentMode = CR_SERVER_REDIR_F_NONE; 87 88 88 89 mural->cVisibleRects = 0; … … 266 267 } 267 268 268 crServerRedirMuralFBO(mural, CR_SERVER_REDIR_ NONE);269 crServerRedirMuralFBO(mural, CR_SERVER_REDIR_F_NONE); 269 270 crServerDeleteMuralFBO(mural); 270 271 … … 437 438 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height) 438 439 { 439 if (mural->width != width || mural->height != height) 440 { 441 uint32_t cRects; 442 const RTRECT *pRects; 443 RTRECT Rect; 444 VBOXVR_TEXTURE Tex; 445 int rc = VINF_SUCCESS; 446 Tex.width = width; 447 Tex.height = height; 448 Tex.target = GL_TEXTURE_2D; 449 Tex.hwid = 0; 450 451 452 /* since we're going to change the current compositor & the window we need to avoid 453 * renderspu fron dealing with inconsistent data, i.e. modified compositor and 454 * still unmodified window. 455 * So what we do is: 456 * 1. tell renderspu to stop using the current compositor -> renderspu would do necessary synchronization with its redraw thread to ensure compositor is no longer used 457 * 2. do necessary modifications 458 * 3. (so far not needed for resize, but in case it is in the future) re-set the compositor */ 459 460 /* 1. tell renderspu to stop using the current compositor (see above comment) */ 461 crServerVBoxCompositionDisableEnter(mural); 462 463 /* 2. do necessary modifications (see above comment) */ 464 /* NOTE: we can do it even if mural->fUseFBO == CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */ 465 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 466 /* CrVrScrCompositorLock(&mural->Compositor); */ 467 rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry); 440 uint32_t cRects; 441 const RTRECT *pRects; 442 RTRECT Rect; 443 VBOXVR_TEXTURE Tex; 444 int rc = VINF_SUCCESS; 445 Tex.width = width; 446 Tex.height = height; 447 Tex.target = GL_TEXTURE_2D; 448 Tex.hwid = 0; 449 450 if (mural->width == width && mural->height == height) 451 return; 452 453 454 /* since we're going to change the current compositor & the window we need to avoid 455 * renderspu fron dealing with inconsistent data, i.e. modified compositor and 456 * still unmodified window. 457 * So what we do is: 458 * 1. tell renderspu to stop using the current compositor -> renderspu would do necessary synchronization with its redraw thread to ensure compositor is no longer used 459 * 2. do necessary modifications 460 * 3. (so far not needed for resize, but in case it is in the future) re-set the compositor */ 461 462 /* 1. tell renderspu to stop using the current compositor (see above comment) */ 463 crServerVBoxCompositionDisableEnter(mural); 464 465 /* 2. do necessary modifications (see above comment) */ 466 /* NOTE: we can do it even if mural->fPresentMode == CR_SERVER_REDIR_F_NONE to make sure the compositor data is always up to date */ 467 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 468 /* CrVrScrCompositorLock(&mural->Compositor); */ 469 rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry); 470 if (!RT_SUCCESS(rc)) 471 { 472 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc); 473 goto end; 474 } 475 CrVrScrCompositorEntryInit(&mural->CEntry, &Tex); 476 /* initially set regions to all visible since this is what some guest assume 477 * and will not post any more visible regions command */ 478 Rect.xLeft = 0; 479 Rect.xRight = width; 480 Rect.yTop = 0; 481 Rect.yBottom = height; 482 rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL); 483 if (!RT_SUCCESS(rc)) 484 { 485 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 486 goto end; 487 } 488 /* CrVrScrCompositorUnlock(&mural->Compositor); */ 489 mural->width = width; 490 mural->height = height; 491 492 mural->fDataPresented = GL_FALSE; 493 494 if (cr_server.currentMural == mural) 495 { 496 crStateGetCurrent()->buffer.width = mural->width; 497 crStateGetCurrent()->buffer.height = mural->height; 498 } 499 500 if (mural->fRootVrOn) 501 { 502 rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry); 468 503 if (!RT_SUCCESS(rc)) 469 504 { 470 505 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc); 471 return;472 } 473 CrVrScrCompositorEntryInit(&mural-> CEntry, &Tex);506 goto end; 507 } 508 CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex); 474 509 /* initially set regions to all visible since this is what some guest assume 475 510 * and will not post any more visible regions command */ … … 478 513 Rect.yTop = 0; 479 514 Rect.yBottom = height; 480 rc = CrVrScrCompositorEntryRegionsSet(&mural-> Compositor, &mural->CEntry, NULL, 1, &Rect, NULL);515 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, 1, &Rect, NULL); 481 516 if (!RT_SUCCESS(rc)) 482 517 { 483 518 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 484 return; 485 } 486 /* CrVrScrCompositorUnlock(&mural->Compositor); */ 487 mural->width = width; 488 mural->height = height; 489 490 mural->fDataPresented = GL_FALSE; 491 492 if (cr_server.currentMural == mural) 493 { 494 crStateGetCurrent()->buffer.width = mural->width; 495 crStateGetCurrent()->buffer.height = mural->height; 496 } 497 519 goto end; 520 } 521 522 crServerVBoxRootVrTranslateForMural(mural); 523 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL); 524 if (!RT_SUCCESS(rc)) 525 { 526 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 527 goto end; 528 } 529 530 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects); 531 if (!RT_SUCCESS(rc)) 532 { 533 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 534 goto end; 535 } 536 } 537 else 538 { 539 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects); 540 if (!RT_SUCCESS(rc)) 541 { 542 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 543 goto end; 544 } 545 } 546 547 crServerCheckMuralGeometry(mural); 548 549 cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height); 550 551 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects); 552 553 if (mural->pvOutputRedirectInstance) 554 { 498 555 if (mural->fRootVrOn) 499 {500 rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry);501 if (!RT_SUCCESS(rc))502 {503 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc);504 return;505 }506 CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex);507 /* initially set regions to all visible since this is what some guest assume508 * and will not post any more visible regions command */509 Rect.xLeft = 0;510 Rect.xRight = width;511 Rect.yTop = 0;512 Rect.yBottom = height;513 rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, 1, &Rect, NULL);514 if (!RT_SUCCESS(rc))515 {516 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);517 return;518 }519 520 crServerVBoxRootVrTranslateForMural(mural);521 rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL);522 if (!RT_SUCCESS(rc))523 {524 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);525 return;526 }527 528 rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects);529 if (!RT_SUCCESS(rc))530 {531 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);532 return;533 }534 }535 else536 556 { 537 557 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects); … … 539 559 { 540 560 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 541 return; 542 } 543 } 544 545 crServerCheckMuralGeometry(mural); 546 547 cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height); 548 549 cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects); 550 551 if (mural->pvOutputRedirectInstance) 552 { 553 if (mural->fRootVrOn) 554 { 555 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects); 556 if (!RT_SUCCESS(rc)) 557 { 558 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 559 return; 560 } 561 } 562 /* @todo the code assumes that RTRECT == four GLInts. */ 563 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, 564 cRects, pRects); 565 } 566 567 /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */ 568 /* uncomment when needed */ 569 /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way 570 571 */ 572 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 573 } 561 goto end; 562 } 563 } 564 /* @todo the code assumes that RTRECT == four GLInts. */ 565 cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance, 566 cRects, pRects); 567 } 568 569 end: 570 /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */ 571 /* uncomment when needed */ 572 /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way 573 574 */ 575 crServerVBoxCompositionDisableLeave(mural, GL_FALSE); 576 574 577 } 575 578 … … 623 626 624 627 /* 2. do necessary modifications (see above comment) */ 625 /* NOTE: we can do it even if mural->fUseFBO == CR_SERVER_REDIR_NONEto make sure the compositor data is always up to date */628 /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */ 626 629 627 630 if (mural->gX != x || mural->gY != y) … … 709 712 } 710 713 711 /* NOTE: we can do it even if mural->fUseFBO = CR_SERVER_REDIR_NONEto make sure the compositor data is always up to date */714 /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */ 712 715 /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */ 713 716 /* CrVrScrCompositorLock(&mural->Compositor); */ … … 717 720 { 718 721 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 719 return;722 goto end; 720 723 } 721 724 … … 731 734 { 732 735 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 733 return;736 goto end; 734 737 } 735 738 … … 739 742 { 740 743 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc); 741 return;744 goto end; 742 745 } 743 746 … … 746 749 { 747 750 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 748 return;751 goto end; 749 752 } 750 753 } … … 755 758 { 756 759 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 757 return;760 goto end; 758 761 } 759 762 } … … 769 772 { 770 773 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc); 771 return;774 goto end; 772 775 } 773 776 } … … 776 779 } 777 780 } 778 781 end: 779 782 /* 3. re-set the compositor (see above comment) */ 780 783 crServerVBoxCompositionDisableLeave(mural, fForcePresent); … … 792 795 } 793 796 794 if (mural->f UseFBO != CR_SERVER_REDIR_FBO_RAM)797 if (mural->fPresentMode && CR_SERVER_REDIR_F_DISPLAY) 795 798 { 796 799 cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state);
Note:
See TracChangeset
for help on using the changeset viewer.