VirtualBox

Changeset 46966 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Jul 4, 2013 6:08:11 AM (12 years ago)
Author:
vboxsync
Message:

wddm/crOpenGL: some bugfixes, more TexPresent fixes

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r46885 r46966  
    140140}
    141141
    142 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData)
    143 {
    144     CrVrScrCompositorEntryInit(&pEntry->CEntry, pTextureData);
     142#define PCR_DISPLAY_ENTRY_FROM_CENTRY(_pe) ((PCR_DISPLAY_ENTRY)((uint8_t*)(_pe) - RT_OFFSETOF(CR_DISPLAY_ENTRY, CEntry)))
     143static DECLCALLBACK(void) crDpEntryCEntryReleaseCB(const struct VBOXVR_SCR_COMPOSITOR *pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacingEntry)
     144{
     145    PCR_DISPLAY_ENTRY pCEntry = PCR_DISPLAY_ENTRY_FROM_CENTRY(pEntry);
     146    CrDemEntryRelease(pCEntry);
     147}
     148
     149void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData, void *pvUserData1, void *pvUserData2)
     150{
     151    CrVrScrCompositorEntryInit(&pEntry->CEntry, pTextureData, crDpEntryCEntryReleaseCB);
    145152    CrVrScrCompositorEntryFlagsSet(&pEntry->CEntry, CRBLT_F_INVERT_SRC_YCOORDS);
    146     CrVrScrCompositorEntryInit(&pEntry->RootVrCEntry, pTextureData);
     153    CrVrScrCompositorEntryInit(&pEntry->RootVrCEntry, pTextureData, NULL);
    147154    CrVrScrCompositorEntryFlagsSet(&pEntry->RootVrCEntry, CRBLT_F_INVERT_SRC_YCOORDS);
     155    pEntry->pvUserData1 = pvUserData1;
     156    pEntry->pvUserData2 = pvUserData2;
    148157}
    149158
     
    175184}
    176185
     186void crDemEntryRelease(PCR_DISPLAY_ENTRY_MAP pMap, PCR_DISPLAY_ENTRY pEntry, bool fForceDelete)
     187{
     188    CRTextureObj *pTobj = (CRTextureObj *)pEntry->pvUserData2;
     189    if (!pTobj)
     190    {
     191        crWarning("Trying to release entry that does not have tobj specified");
     192        return;
     193    }
     194
     195    CR_STATE_SHAREDOBJ_USAGE_CLEAR(pTobj, cr_server.MainContextInfo.pContext);
     196
     197    bool fDeleteEntry = fForceDelete;
     198    GLuint idTexture = pTobj->id;
     199
     200    if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pTobj))
     201    {
     202        CRSharedState *pShared = crStateGlobalSharedAcquire();
     203
     204        CRASSERT(pShared);
     205        /* on the host side, we need to delete an ogl texture object here as well, which crStateDeleteTextureCallback will do
     206         * in addition to calling crStateDeleteTextureObject to delete a state object */
     207        crHashtableDelete(pShared->textureTable, idTexture, crStateDeleteTextureCallback);
     208
     209        crStateGlobalSharedRelease();
     210
     211        fDeleteEntry = true;
     212    }
     213    else
     214    {
     215        /* this is something we would not generally expect */
     216        CRASSERT(!fForceDelete);
     217    }
     218
     219    if (fDeleteEntry)
     220    {
     221        if (pMap)
     222            crHashtableDelete(pMap->pTextureMap, idTexture, crFree);
     223        else
     224            crFree(pEntry); /* <- when called from crDemTermEntryCb */
     225
     226        crStateGlobalSharedRelease();
     227    }
     228}
     229
     230void crDemTermEntryCb(void *pvEntry)
     231{
     232    crDemEntryRelease(NULL, (PCR_DISPLAY_ENTRY)pvEntry, true);
     233}
     234
    177235void CrDemTerm(PCR_DISPLAY_ENTRY_MAP pMap)
    178236{
    179     crFreeHashtable(pMap->pTextureMap, crFree);
    180 }
    181 
    182 PCR_DISPLAY_ENTRY CrDemEntryGetCreate(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture, CRContextInfo *pCtxInfo)
     237    crFreeHashtable(pMap->pTextureMap, crDemTermEntryCb);
     238}
     239
     240void CrDemEntryRelease(PCR_DISPLAY_ENTRY pEntry)
     241{
     242    PCR_DISPLAY_ENTRY_MAP pMap = (PCR_DISPLAY_ENTRY_MAP)pEntry->pvUserData1;
     243    Assert(pMap);
     244    crDemEntryRelease(pMap, pEntry, false);
     245}
     246
     247PCR_DISPLAY_ENTRY CrDemEntryAcquire(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture)
    183248{
    184249    PCR_DISPLAY_ENTRY pEntry = (PCR_DISPLAY_ENTRY)crHashtableSearch(pMap->pTextureMap, idTexture);
     
    186251        return pEntry;
    187252
    188     CRContext *pContext = pCtxInfo->pContext;
    189     if (!pContext)
    190     {
    191         crWarning("pContext is null!");
     253    CRSharedState *pShared = crStateGlobalSharedAcquire();
     254    if (!pShared)
     255    {
     256        crWarning("pShared is null!");
    192257        return NULL;
    193258    }
    194259
    195     CRTextureObj *pTobj = (CRTextureObj*)crHashtableSearch(pContext->shared->textureTable, idTexture);
     260    CRTextureObj *pTobj = (CRTextureObj*)crHashtableSearch(pShared->textureTable, idTexture);
    196261    if (!pTobj)
    197262    {
    198263        crWarning("pTobj is null!");
     264        crStateGlobalSharedRelease();
    199265        return NULL;
    200266    }
     267
     268    Assert(pTobj->id == idTexture);
    201269
    202270    GLuint hwId = crStateGetTextureObjHWID(pTobj);
     
    204272    {
    205273        crWarning("hwId is null!");
     274        crStateGlobalSharedRelease();
    206275        return NULL;
    207276    }
     
    217286    {
    218287        crWarning("crAlloc failed allocating CR_DISPLAY_ENTRY");
     288        crStateGlobalSharedRelease();
    219289        return NULL;
    220290    }
    221291
    222     CrDpEntryInit(pEntry, &TextureData);
     292    CrDpEntryInit(pEntry, &TextureData, pMap, pTobj);
     293
     294    /* just use main context info's context to hold the texture reference */
     295    CR_STATE_SHAREDOBJ_USAGE_SET(pTobj, cr_server.MainContextInfo.pContext);
    223296
    224297    crHashtableAdd(pMap->pTextureMap, idTexture, pEntry);
     
    226299
    227300}
    228 
     301#if 0
    229302void CrDemEntryDestroy(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture)
    230303{
     
    243316    crHashtableDelete(pMap->pTextureMap, idTexture, crFree);
    244317}
    245 
     318#endif
    246319PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen)
    247320{
     
    412485    if (texture)
    413486    {
    414         pEntry = CrDemEntryGetCreate(&cr_server.PresentTexturepMap, texture, cr_server.currentCtxInfo);
     487        pEntry = CrDemEntryAcquire(&cr_server.PresentTexturepMap, texture);
    415488        if (!pEntry)
    416489        {
    417             crWarning("CrDemEntryGetCreate Failed");
     490            crWarning("CrDemEntryAcquire Failed");
    418491            return;
    419492        }
     
    428501        if (!RT_SUCCESS(rc))
    429502        {
    430             crWarning("CrDpEntrySetRegions Failed rc %d", rc);
     503            crWarning("CrDpEntryRegionsAdd Failed rc %d", rc);
     504//            if (pEntry)
     505//                CrDemEntryRelease(pEntry);
    431506            return;
    432507        }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r46885 r46966  
    5555        Tex.target = GL_TEXTURE_2D;
    5656        Tex.hwid = 0;
    57         CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex);
     57        CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex, NULL);
    5858
    5959        if (cr_server.fRootVrOn)
    6060        {
    61             CrVrScrCompositorEntryInit(&mural->DefaultDEntry.RootVrCEntry, &Tex);
     61            CrVrScrCompositorEntryInit(&mural->DefaultDEntry.RootVrCEntry, &Tex, NULL);
    6262            mural->fRootVrOn = GL_TRUE;
    6363        }
     
    407407{
    408408    CR_DISPLAY_ENTRY *pDEntry = CR_DENTRY_FROM_CENTRY(pEntry);
    409     CrVrScrCompositorEntryInit(&pDEntry->RootVrCEntry, CrVrScrCompositorEntryTexGet(pEntry));
     409    CrVrScrCompositorEntryInit(&pDEntry->RootVrCEntry, CrVrScrCompositorEntryTexGet(pEntry), NULL);
    410410    return &pDEntry->RootVrCEntry;
    411411}
     
    416416
    417417    crServerVBoxRootVrTranslateForMural(mural);
     418
     419    /* ensure the rootvr compositor does not hold any data,
     420     * i.e. cleanup all rootvr entries data */
     421    CrVrScrCompositorClear(&mural->RootVrCompositor);
    418422
    419423    rc = CrVrScrCompositorIntersectedList(&mural->Compositor, &cr_server.RootVr, &mural->RootVrCompositor, crServerMuralGetRootVrCEntry, NULL, NULL);
     
    468472                goto end;
    469473            }
    470             CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex);
     474            CrVrScrCompositorEntryInit(&mural->DefaultDEntry.CEntry, &Tex, NULL);
    471475            /* initially set regions to all visible since this is what some guest assume
    472476             * and will not post any more visible regions command */
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