VirtualBox

Ignore:
Timestamp:
May 5, 2025 6:17:33 PM (4 days ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168723
Message:

WDDM: Miniport: unify handling of guest backing memory for surfaces, object tables, etc. bugref:10885

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp

    r106061 r109165  
    55
    66/*
    7  * Copyright (C) 2016-2024 Oracle and/or its affiliates.
     7 * Copyright (C) 2016-2025 Oracle and/or its affiliates.
    88 *
    99 * This file is part of VirtualBox base platform packages, as
     
    183183    AssertReturn(pSvgaContext, STATUS_INSUFFICIENT_RESOURCES);
    184184
     185    pSvgaContext->u32Cid = SVGA3D_INVALID_ID;
     186    for (unsigned i = 0; i < RT_ELEMENTS(pSvgaContext->aCOT); ++i)
     187        pSvgaContext->aCOT[i].mobid = SVGA3D_INVALID_ID;
    185188    pSvgaContext->fDXContext = RT_BOOL(pInfo->u.vmsvga.u32Flags & VBOXWDDM_F_GA_CONTEXT_VGPU10);
    186189
     
    236239        {
    237240            PVMSVGACOT pCOT = &pSvgaContext->aCOT[i];
    238             if (pCOT->pMob)
     241            if (pCOT->mobid != SVGA3D_INVALID_ID)
    239242            {
    240243                void *pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_DX_SET_COTABLE, sizeof(SVGA3dCmdDXSetCOTable), SVGA3D_INVALID_ID);
     
    257260
    258261                uint32_t cbRequired = 0;
    259                 SvgaMobDestroy(pSvga, pCOT->pMob, NULL, 0, &cbRequired);
     262                SvgaMobDestroy(pSvga, SVGA3D_INVALID_ID, NULL, 0, &cbRequired);
    260263                pvCmd = SvgaCmdBufReserve(pSvga, cbRequired, SVGA3D_INVALID_ID);
    261264                if (pvCmd)
    262265                {
    263                     SvgaMobDestroy(pSvga, pCOT->pMob, pvCmd, cbRequired, &cbRequired);
     266                    SvgaMobDestroy(pSvga, pCOT->mobid, pvCmd, cbRequired, &cbRequired);
    264267                    SvgaCmdBufCommit(pSvga, cbRequired);
    265268                }
    266269
    267                 pCOT->pMob = NULL;
     270                pCOT->mobid = SVGA3D_INVALID_ID;
    268271            }
    269272        }
     
    15631566
    15641567    PVBOXWDDM_EXT_VMSVGA pSvga = (PVBOXWDDM_EXT_VMSVGA)Context;
    1565     if (pSvga->pMiniportMobData)
    1566     {
    1567         uint64_t const u64MobFence = ASMAtomicReadU64(&pSvga->pMiniportMobData->u64MobFence);
    1568 
    1569         /* Move mobs which were deleted by the host to the local list under the lock. */
    1570         RTLISTANCHOR listDestroyedMobs;
    1571         RTListInit(&listDestroyedMobs);
    1572 
    1573         KIRQL OldIrql;
    1574         SvgaHostObjectsLock(pSvga, &OldIrql);
    1575 
    1576         PVMSVGAMOB pIter, pNext;
    1577         RTListForEachSafe(&pSvga->listMobDeferredDestruction, pIter, pNext, VMSVGAMOB, node)
    1578         {
    1579             if (gaFenceCmp64(pIter->u64MobFence, u64MobFence) <= 0)
    1580             {
    1581                 RTListNodeRemove(&pIter->node);
    1582                 RTListAppend(&listDestroyedMobs, &pIter->node);
    1583             }
    1584         }
    1585 
    1586         SvgaHostObjectsUnlock(pSvga, OldIrql);
    1587 
    1588         RTListForEachSafe(&listDestroyedMobs, pIter, pNext, VMSVGAMOB, node)
    1589         {
    1590             /* Delete the data. SvgaMobFree deallocates pIter. */
    1591             RTListNodeRemove(&pIter->node);
    1592             SvgaMobFree(pSvga, pIter);
    1593         }
    1594     }
     1568    SvgaDeferredMobDestruction(pSvga);
     1569
     1570    ASMAtomicDecS32(&pSvga->cQueuedWorkItems);
    15951571}
    15961572
     
    16921668        PIO_WORKITEM pWorkItem = IoAllocateWorkItem(pDevExt->pPDO);
    16931669        if (pWorkItem)
     1670        {
     1671            ASMAtomicIncS32(&pSvga->cQueuedWorkItems);
    16941672            IoQueueWorkItemEx(pWorkItem, dxDeferredMobDestruction, DelayedWorkQueue, pSvga);
     1673        }
    16951674    }
    16961675}
Note: See TracChangeset for help on using the changeset viewer.

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