VirtualBox

Ignore:
Timestamp:
Jun 26, 2013 1:01:07 PM (11 years ago)
Author:
vboxsync
Message:

wddm/crOpenGL: more TexPresent fixes

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

Legend:

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

    r46515 r46801  
    113113GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID);
    114114GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID);
    115 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID);
     115GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fSetVRegs);
    116116void crServerMuralTerm(CRMuralInfo *mural);
    117117void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height);
     
    131131
    132132void crVBoxServerNotifyEvent(int32_t idScreen);
     133void crServerDisplayTermAll();
    133134
    134135#define CR_SERVER_REDIR_F_NONE     0x00
     
    403404void crServerDumpDrawel(const char*pszFormat, ...);
    404405void crServerDumpDrawelv(GLuint idx, const char*pszElFormat, uint32_t cbEl, const void *pvVal, uint32_t cVal);
    405 
     406int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal);
     407void CrDpEnter(PCR_DISPLAY pDisplay);
     408void CrDpLeave(PCR_DISPLAY pDisplay);
    406409
    407410extern unsigned long g_CrDbgDumpEnabled;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c

    r45940 r46801  
    6464}
    6565
    66 static int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal)
     66int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal)
    6767{
    6868    int result = 0;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r46783 r46801  
    187187    crFreeHashtable(cr_server.muralTable, deleteMuralInfoCallback);
    188188
     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
    189194    for (i = 0; i < cr_server.numClients; i++) {
    190195        if (cr_server.clients[i]) {
     
    333338    }
    334339
     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
    335354    cr_server.firstCallCreateContext = GL_TRUE;
    336355    cr_server.firstCallMakeCurrent = GL_TRUE;
     
    362381    cr_server.dummyMuralTable = crAllocHashtable();
    363382
     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
    364387    cr_server.fRootVrOn = GL_FALSE;
    365388    VBoxVrListInit(&cr_server.RootVr);
     
    425448        crInfo("Info: using multiple contexts!");
    426449        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
    427464    }
    428465
     
    464501
    465502    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));
    466507
    467508    cr_server.fRootVrOn = GL_FALSE;
     
    9701011            return NULL;
    9711012        }
    972         id = crServerMuralInit(pMural, "", visualBits, -1);
     1013        id = crServerMuralInit(pMural, "", visualBits, -1, GL_TRUE);
    9731014        if (id < 0)
    9741015        {
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r46173 r46801  
    6262int CrDpInit(PCR_DISPLAY pDisplay)
    6363{
    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;
    8672}
    8773
    8874void CrDpTerm(PCR_DISPLAY pDisplay)
    8975{
    90     CrVrScrCompositorTerm(&pDisplay->Compositor);
    9176    crServerMuralTerm(&pDisplay->Mural);
    9277}
     
    9984    StretchY = ((float)stretchedHeight)/height;
    10085    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);
    10487}
    10588
    10689int CrDpEntryRegionsSet(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions)
    10790{
    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);
    11192    return rc;
    11293}
     
    11495int CrDpEntryRegionsAdd(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions)
    11596{
    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);
    11998    return rc;
    12099}
    121100
    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 
    143101void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData)
    144102{
     
    148106void CrDpEntryCleanup(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry)
    149107{
    150     CrVrScrCompositorLock(&pDisplay->Compositor);
    151     CrVrScrCompositorEntryRemove(&pDisplay->Compositor, &pEntry->CEntry);
    152     CrVrScrCompositorUnlock(&pDisplay->Compositor);
     108    CrVrScrCompositorEntryRemove(&pDisplay->Mural.Compositor, &pEntry->CEntry);
     109}
     110
     111void CrDpEnter(PCR_DISPLAY pDisplay)
     112{
     113    crServerVBoxCompositionDisableEnter(&pDisplay->Mural);
     114}
     115
     116void CrDpLeave(PCR_DISPLAY pDisplay)
     117{
     118    pDisplay->Mural.fDataPresented = GL_TRUE;
     119    crServerVBoxCompositionDisableLeave(&pDisplay->Mural, GL_FALSE);
    153120}
    154121
     
    278245}
    279246
     247void 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
    280260void CrHlpFreeTexImage(CRContext *pCurCtx, GLuint idPBO, void *pvData)
    281261{
     
    395375    }
    396376
    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);
    403389
    404390    RTPOINT Point = {xPos, yPos};
     
    410396    }
    411397
    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  
    1717}
    1818
    19 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID)
     19GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fSetVRegs)
    2020{
    2121    CRMuralInfo *defaultMural;
     
    2424    GLint spuWindow;
    2525    VBOXVR_TEXTURE Tex = {0};
    26     RTRECT Rect;
    2726    int rc;
    2827
     
    103102    CR_STATE_SHAREDOBJ_USAGE_INIT(mural);
    104103
    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        }
    114117    }
    115118
     
    183186    }
    184187
    185     windowID = crServerMuralInit(mural, dpyName, visBits, preloadWinID);
     188    windowID = crServerMuralInit(mural, dpyName, visBits, preloadWinID, GL_TRUE);
    186189    if (windowID < 0)
    187190    {
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