VirtualBox

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


Ignore:
Timestamp:
Jan 29, 2014 7:36:53 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: proper cleanup, more bugfixes

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

Legend:

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

    r50217 r50276  
    438438
    439439CRHTABLE_HANDLE CrFbDDataAllocSlot(HCR_FRAMEBUFFER hFb);
    440 void CrFbDDataReleaseSlot(HCR_FRAMEBUFFER hFb, CRHTABLE_HANDLE hSlot);
     440
     441typedef DECLCALLBACKPTR(void, PFNCR_FRAMEBUFFER_SLOT_RELEASE_CB)(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext);
     442
     443void CrFbDDataReleaseSlot(HCR_FRAMEBUFFER hFb, CRHTABLE_HANDLE hSlot, PFNCR_FRAMEBUFFER_SLOT_RELEASE_CB pfnReleaseCb, void *pvContext);
    441444int CrFbDDataEntryPut(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot, void *pvData);
     445void* CrFbDDataEntryClear(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot);
    442446void* CrFbDDataEntryGet(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot);
    443447
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r50258 r50276  
    7878    void *pvVram;
    7979    ICrFbDisplay *pDisplay;
     80    RTLISTNODE EntriesList;
     81    uint32_t cEntries; /* <- just for debugging */
     82    uint32_t cUpdating;
    8083    CRHTABLE SlotTable;
    81     uint32_t cUpdating;
    8284} CR_FRAMEBUFFER;
    8385
     
    120122    pFb->ScreenInfo.u32ViewIndex = idScreen;
    121123    CrVrScrCompositorInit(&pFb->Compositor, &Rect);
     124    RTListInit(&pFb->EntriesList);
    122125    CrHTableCreate(&pFb->SlotTable, 0);
    123126}
     
    226229    CrVrScrCompositorClear(&pFb->Compositor);
    227230    CrHTableDestroy(&pFb->SlotTable);
     231
     232    Assert(RTListIsEmpty(&pFb->EntriesList));
     233    Assert(!pFb->cEntries);
     234
    228235    memset(pFb, 0, sizeof (*pFb));
    229236
     
    266273{
    267274    VBOXVR_SCR_COMPOSITOR_ENTRY Entry;
     275    RTLISTNODE Node;
    268276    uint32_t cRefs;
    269277    CR_FBENTRY_FLAGS Flags;
     
    464472    CrVrScrCompositorEntryCleanup(&pEntry->Entry);
    465473    CrHTableDestroy(&pEntry->HTable);
     474    Assert(pFb->cEntries);
     475    RTListNodeRemove(&pEntry->Node);
     476    --pFb->cEntries;
    466477    crFbEntryFree(pEntry);
    467478}
     
    531542    pEntry->Flags.Value = 0;
    532543    CrHTableCreate(&pEntry->HTable, 0);
     544
     545    RTListAppend(&pFb->EntriesList, &pEntry->Node);
     546    ++pFb->cEntries;
    533547
    534548    return pEntry;
     
    798812}
    799813
    800 void CrFbDDataReleaseSlot(CR_FRAMEBUFFER *pFb, CRHTABLE_HANDLE hSlot)
    801 {
     814void CrFbDDataReleaseSlot(CR_FRAMEBUFFER *pFb, CRHTABLE_HANDLE hSlot, PFNCR_FRAMEBUFFER_SLOT_RELEASE_CB pfnReleaseCb, void *pvContext)
     815{
     816    HCR_FRAMEBUFFER_ENTRY hEntry, hNext;
     817    RTListForEachSafeCpp(&pFb->EntriesList, hEntry, hNext, CR_FRAMEBUFFER_ENTRY, Node)
     818    {
     819        if (CrFbDDataEntryGet(hEntry, hSlot))
     820        {
     821            pfnReleaseCb(pFb, hEntry, pvContext);
     822            CrFbDDataEntryClear(hEntry, hSlot);
     823        }
     824    }
     825
    802826    CrHTableRemove(&pFb->SlotTable, hSlot);
    803827}
     
    806830{
    807831    return CrHTablePutToSlot(&hEntry->HTable, hSlot, pvData);
     832}
     833
     834void* CrFbDDataEntryClear(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot)
     835{
     836    return CrHTableRemove(&hEntry->HTable, hSlot);
    808837}
    809838
     
    11141143    }
    11151144
     1145    static DECLCALLBACK(void) slotEntryReleaseCB(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
     1146    {
     1147        ((ICrFbDisplay*)pvContext)->EntryDestroyed(hFb, hEntry);
     1148    }
     1149
     1150    virtual void slotRelease()
     1151    {
     1152        Assert(mhSlot);
     1153        CrFbDDataReleaseSlot(mpFb, mhSlot, slotEntryReleaseCB, this);
     1154    }
     1155
    11161156    virtual int fbCleanup()
    11171157    {
    11181158        if (mhSlot)
    11191159        {
    1120             CrFbDDataReleaseSlot(mpFb, mhSlot);
     1160            slotRelease();
    11211161            mhSlot = 0;
    11221162        }
     
    24372477    virtual int clearCompositor()
    24382478    {
    2439         return fbCleanupRemoveAllEntries(true);
     2479        return fbCleanupRemoveAllEntries(false);
    24402480    }
    24412481
     
    26422682    virtual int fbCleanup()
    26432683    {
    2644         int rc = fbCleanupRemoveAllEntries(true);
     2684        int rc = fbCleanupRemoveAllEntries(false);
    26452685        if (!RT_SUCCESS(rc))
    26462686        {
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