VirtualBox

Ignore:
Timestamp:
Aug 7, 2013 6:02:07 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: more TexPresent fixes & saved state impl

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r47577 r47599  
    115115GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fUseDefaultDEntry);
    116116void crServerMuralTerm(CRMuralInfo *mural);
    117 void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height);
    118 void crServerMutalPosition(CRMuralInfo *mural, GLint x, GLint y);
     117GLboolean crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height);
     118void crServerMuralPosition(CRMuralInfo *mural, GLint x, GLint y, GLboolean fSkipCheckGeometry);
    119119void crServerMuralVisibleRegion( CRMuralInfo *mural, GLint cRects, const GLint *pRects );
    120120void crServerMuralShow( CRMuralInfo *mural, GLint state );
     
    141141void crServerWindowShow(CRMuralInfo *pMural);
    142142void crServerWindowVisibleRegion(CRMuralInfo *pMural);
     143void crServerWindowReparent(CRMuralInfo *pMural);
    143144
    144145void crServerWindowSetIsVisible(CRMuralInfo *pMural, GLboolean fIsVisible);
     
    415416int CrDpLoadState(PCR_DISPLAY pDisplay, PSSMHANDLE pSSM, uint32_t version);
    416417
     418void CrDpReparent(PCR_DISPLAY pDisplay, CRScreenInfo *pScreen);
     419
    417420void CrDpResize(PCR_DISPLAY pDisplay, int32_t xPos, int32_t yPos, uint32_t width, uint32_t height);
    418421void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r47577 r47599  
    27012701    if (pMI->screenId == *sIndex)
    27022702    {
    2703         crServerVBoxCompositionDisableEnter(pMI);
    2704 
    2705         pMI->fHasParentWindow = !!cr_server.screen[pMI->screenId].winID;
    2706 
    2707         renderspuReparentWindow(pMI->spuWindow);
    2708 
    2709         crServerVBoxCompositionDisableLeave(pMI, GL_FALSE);
     2703        crServerWindowReparent(pMI);
    27102704    }
    27112705}
     
    27532747    if (MAPPED(SCREEN(sIndex)))
    27542748    {
     2749        PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex);
     2750
    27552751        SCREEN(sIndex).winID = 0;
    27562752        renderspuSetWindowId(0);
     
    27592755
    27602756        crHashtableWalk(cr_server.dummyMuralTable, crVBoxServerReparentMuralCB, &sIndex);
     2757
     2758        if (pDisplay)
     2759            CrDpReparent(pDisplay, &SCREEN(sIndex));
    27612760    }
    27622761
     
    28312830        PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex);
    28322831        if (pDisplay)
    2833             CrDpResize(pDisplay, x, y, w, h);
     2832            CrDpReparent(pDisplay, &SCREEN(sIndex));
    28342833    }
    28352834
     
    30363035
    30373036        /* no need to do anything here actually */
     3037    }
     3038
     3039    if (fPosChanged || fSizeChanged)
     3040    {
     3041        PCR_DISPLAY pDisplay = crServerDisplayGetInitialized(sIndex);
     3042        if (pDisplay)
     3043            CrDpResize(pDisplay, SCREEN(sIndex).x, SCREEN(sIndex).y, SCREEN(sIndex).w, SCREEN(sIndex).h);
    30383044    }
    30393045    return VINF_SUCCESS;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r47577 r47599  
    762762void crServerVBoxCompositionDisableLeave(CRMuralInfo *mural, GLboolean fForcePresentOnEnabled)
    763763{
    764     mural->fForcePresentState = fForcePresentOnEnabled;
     764    mural->fForcePresentState |= fForcePresentOnEnabled;
    765765    --mural->cDisabled;
    766766    Assert(mural->cDisabled < UINT32_MAX/2);
     
    788788DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable)
    789789{
     790    int i;
     791
    790792    crHashtableWalk(cr_server.muralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)(uintptr_t)fEnable);
    791793
    792794    crHashtableWalk(cr_server.dummyMuralTable, crServerVBoxCompositionSetEnableStateGlobalCB, (void*)(uintptr_t)fEnable);
     795
     796    for (i = 0; i < cr_server.screenCount; ++i)
     797    {
     798        PCR_DISPLAY pDisplay = crServerDisplayGetInitialized((uint32_t)i);
     799        if (!pDisplay)
     800            continue;
     801
     802        if (!fEnable)
     803            CrDpEnter(pDisplay);
     804        else
     805            CrDpLeave(pDisplay);
     806    }
    793807}
    794808
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r47566 r47599  
    3434#include <iprt/memcache.h>
    3535
     36#include "render/renderspu.h"
    3637
    3738/* DISPLAY */
     
    7071        return VERR_GENERAL_FAILURE;
    7172    }
     73
     74    crServerMuralVisibleRegion(&pDisplay->Mural, 0, NULL);
     75    crServerMuralShow(&pDisplay->Mural, GL_TRUE);
     76
    7277    pDisplay->fForcePresent = GL_FALSE;
    7378    return VINF_SUCCESS;
     
    8186void CrDpResize(PCR_DISPLAY pDisplay, int32_t xPos, int32_t yPos, uint32_t width, uint32_t height)
    8287{
    83     crServerMuralVisibleRegion(&pDisplay->Mural, 0, NULL);
    84     crServerMutalPosition(&pDisplay->Mural, xPos, yPos);
    85     crServerMuralSize(&pDisplay->Mural, width, height);
    86     crServerMuralShow(&pDisplay->Mural, GL_TRUE);
    87     CrVrScrCompositorSetStretching(&pDisplay->Mural.Compositor, 1., 1.);
    88 }
     88    if (xPos != pDisplay->Mural.gX
     89            || yPos != pDisplay->Mural.gY
     90            || width != pDisplay->Mural.width
     91            || height != pDisplay->Mural.height)
     92    {
     93        crServerMuralPosition(&pDisplay->Mural, xPos, yPos, GL_TRUE);
     94        if (!crServerMuralSize(&pDisplay->Mural, width, height))
     95            crServerCheckMuralGeometry(&pDisplay->Mural);
     96    }
     97    else
     98        crServerCheckMuralGeometry(&pDisplay->Mural);
     99}
     100
     101void CrDpReparent(PCR_DISPLAY pDisplay, CRScreenInfo *pScreen)
     102{
     103    renderspuSetWindowId(pScreen->winID);
     104    crServerWindowReparent(&pDisplay->Mural);
     105    renderspuSetWindowId(cr_server.screen[0].winID);
     106
     107    CrDpResize(pDisplay, pScreen->x, pScreen->y, pScreen->w, pScreen->h);
     108}
     109
    89110
    90111int CrDpSaveState(PCR_DISPLAY pDisplay, PSSMHANDLE pSSM)
     
    270291void CrDpEnter(PCR_DISPLAY pDisplay)
    271292{
    272     pDisplay->fForcePresent = crServerVBoxCompositionPresentNeeded(&pDisplay->Mural);
     293    pDisplay->fForcePresent |= crServerVBoxCompositionPresentNeeded(&pDisplay->Mural);
    273294    crServerVBoxCompositionDisableEnter(&pDisplay->Mural);
    274295}
     
    278299    pDisplay->Mural.fDataPresented = GL_TRUE;
    279300    crServerVBoxCompositionDisableLeave(&pDisplay->Mural, pDisplay->fForcePresent);
     301    pDisplay->fForcePresent = GL_FALSE;
    280302}
    281303
     
    503525PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen)
    504526{
    505     if (ASMBitTest(cr_server.DisplaysInitMap, idScreen))
    506         return &cr_server.aDispplays[idScreen];
    507     return NULL;
    508 }
    509 
    510 static PCR_DISPLAY crServerDisplayGet(uint32_t idScreen)
    511 {
    512527    if (idScreen >= CR_MAX_GUEST_MONITORS)
    513528    {
     
    517532
    518533    if (ASMBitTest(cr_server.DisplaysInitMap, idScreen))
     534    {
     535        Assert(cr_server.aDispplays[idScreen].Mural.screenId == idScreen);
    519536        return &cr_server.aDispplays[idScreen];
     537    }
     538    return NULL;
     539}
     540
     541static PCR_DISPLAY crServerDisplayGet(uint32_t idScreen)
     542{
     543    if (idScreen >= CR_MAX_GUEST_MONITORS)
     544    {
     545        crWarning("invalid idScreen %d", idScreen);
     546        return NULL;
     547    }
     548
     549    if (ASMBitTest(cr_server.DisplaysInitMap, idScreen))
     550    {
     551        Assert(cr_server.aDispplays[idScreen].Mural.screenId == idScreen);
     552        return &cr_server.aDispplays[idScreen];
     553    }
    520554
    521555     int rc = CrDpInit(&cr_server.aDispplays[idScreen]);
     
    549583    AssertRCReturn(rc, rc);
    550584
     585    if (!cDisplays)
     586        return VINF_SUCCESS;
     587
     588    rc = SSMR3PutS32(pSSM, cr_server.screenCount);
     589    AssertRCReturn(rc, rc);
     590
     591    for (i = 0; i < cr_server.screenCount; ++i)
     592    {
     593        rc = SSMR3PutS32(pSSM, cr_server.screen[i].x);
     594        AssertRCReturn(rc, rc);
     595
     596        rc = SSMR3PutS32(pSSM, cr_server.screen[i].y);
     597        AssertRCReturn(rc, rc);
     598
     599        rc = SSMR3PutU32(pSSM, cr_server.screen[i].w);
     600        AssertRCReturn(rc, rc);
     601
     602        rc = SSMR3PutU32(pSSM, cr_server.screen[i].h);
     603        AssertRCReturn(rc, rc);
     604    }
     605
    551606    for (i = 0; i < cr_server.screenCount; ++i)
    552607    {
     
    567622{
    568623    int rc;
    569     int s32, i;
    570 
    571     rc = SSMR3GetS32(pSSM, &s32);
     624    int cDisplays, screenCount, i;
     625
     626    rc = SSMR3GetS32(pSSM, &cDisplays);
    572627    AssertRCReturn(rc, rc);
    573628
    574     for (i = 0; i < s32; ++i)
     629    if (!cDisplays)
     630        return VINF_SUCCESS;
     631
     632    rc = SSMR3GetS32(pSSM, &screenCount);
     633    AssertRCReturn(rc, rc);
     634
     635    CRASSERT(screenCount == cr_server.screenCount);
     636
     637    crServerVBoxCompositionSetEnableStateGlobal(GL_FALSE);
     638
     639    for (i = 0; i < cr_server.screenCount; ++i)
     640    {
     641        int32_t    x, y;
     642        uint32_t   w, h;
     643        rc = SSMR3GetS32(pSSM, &x);
     644        AssertRCReturn(rc, rc);
     645
     646        rc = SSMR3GetS32(pSSM, &y);
     647        AssertRCReturn(rc, rc);
     648
     649        rc = SSMR3GetU32(pSSM, &w);
     650        AssertRCReturn(rc, rc);
     651
     652        rc = SSMR3GetU32(pSSM, &h);
     653        AssertRCReturn(rc, rc);
     654
     655        rc = crVBoxServerMapScreen(i, x, y, w, h, cr_server.screen[i].winID);
     656        AssertRCReturn(rc, rc);
     657    }
     658
     659    crServerVBoxCompositionSetEnableStateGlobal(GL_TRUE);
     660
     661    for (i = 0; i < cDisplays; ++i)
    575662    {
    576663        int iScreen;
     
    716803{
    717804    uint32_t idScreen = CR_PRESENT_GET_SCREEN(cfg);
    718     PCR_DISPLAY pDisplay = crServerDisplayGet(idScreen);
    719     if (!pDisplay)
    720     {
    721         crWarning("crServerDisplayGet Failed");
     805    if (idScreen >= CR_MAX_GUEST_MONITORS)
     806    {
     807        crWarning("Invalid guest screen");
    722808        return;
    723809    }
    724810
     811    PCR_DISPLAY pDisplay;
    725812    PCR_DISPLAY_ENTRY pEntry = NULL;
     813
    726814    if (texture)
    727815    {
     
    730818        {
    731819            crWarning("CrDemEntryAcquire Failed");
     820            return;
     821        }
     822
     823        pDisplay = crServerDisplayGet(idScreen);
     824        if (!pDisplay)
     825        {
     826            crWarning("crServerDisplayGet Failed");
     827            return;
     828        }
     829    }
     830    else
     831    {
     832        pDisplay = crServerDisplayGetInitialized(idScreen);
     833        if (!pDisplay)
     834        {
     835            /* no display initialized, and nothing to present */
    732836            return;
    733837        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette