VirtualBox

Changeset 40387 in vbox for trunk


Ignore:
Timestamp:
Mar 6, 2012 8:38:49 PM (13 years ago)
Author:
vboxsync
Message:

wddm: concurrency fixes

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxVideoGuest.h

    r38207 r40387  
    4343#endif
    4444
     45#ifdef VBOX_WDDM_MINIPORT
     46# include "wddm/VBoxMPShgsmi.h"
     47 typedef VBOXSHGSMI HGSMIGUESTCMDHEAP;
     48# define HGSMIGUESTCMDHEAP_GET(_p) (&(_p)->Heap)
     49#else
     50 typedef HGSMIHEAP HGSMIGUESTCMDHEAP;
     51# define HGSMIGUESTCMDHEAP_GET(_p) (_p)
     52#endif
     53
    4554RT_C_DECLS_BEGIN
    4655
     
    5362    /** Information about the memory heap located in VRAM from which data
    5463     * structures to be sent to the host are allocated. */
    55     HGSMIHEAP heapCtx;
     64    HGSMIGUESTCMDHEAP heapCtx;
    5665    /** The I/O port used for submitting commands to the host by writing their
    5766     * offsets into the heap. */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h

    r39981 r40387  
    178178#else
    179179    /* all memory layout info should be initialized */
    180     Assert(pDevExt->u.primary.Vdma.CmdHeap.area.offBase);
     180    Assert(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase);
    181181    /* page aligned */
    182     Assert(!(pDevExt->u.primary.Vdma.CmdHeap.area.offBase & 0xfff));
    183 
    184     return pDevExt->u.primary.Vdma.CmdHeap.area.offBase & ~0xfffUL;
     182    Assert(!(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & 0xfff));
     183
     184    return pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & ~0xfffUL;
    185185#endif
    186186}
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPHGSMI.cpp

    r36867 r40387  
    154154{
    155155    VBoxMPCmnUnmapAdapterMemory(pCommon, &pCommon->pvMiniportHeap);
     156#ifdef VBOX_WDDM_MINIPORT
     157    VBoxSHGSMITerm(&pCommon->guestCtx.heapCtx);
     158#else
    156159    HGSMIHeapDestroy(&pCommon->guestCtx.heapCtx);
     160#endif
    157161
    158162    /* Unmap the adapter information needed for HGSMI IO. */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.cpp

    r39981 r40387  
    2626}
    2727
    28 void vboxSHGSMICommandFree (struct _HGSMIHEAP * pHeap, PVBOXSHGSMIHEADER pCmd)
    29 {
    30     HGSMIHeapFree (pHeap, pCmd);
    31 }
    32 
    33 DECLINLINE(void) vboxSHGSMICommandRelease (struct _HGSMIHEAP * pHeap, PVBOXSHGSMIHEADER pCmd)
     28void vboxSHGSMICommandFree (PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADER pCmd)
     29{
     30    VBoxSHGSMIHeapFree(pHeap, pCmd);
     31}
     32
     33DECLINLINE(void) vboxSHGSMICommandRelease (PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADER pCmd)
    3434{
    3535    uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs);
     
    3939}
    4040
    41 DECLCALLBACK(void) vboxSHGSMICompletionSetEvent(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext)
     41DECLCALLBACK(void) vboxSHGSMICompletionSetEvent(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)
    4242{
    4343    RTSemEventSignal((RTSEMEVENT)pvContext);
    4444}
    4545
    46 DECLCALLBACK(void) vboxSHGSMICompletionCommandRelease(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext)
     46DECLCALLBACK(void) vboxSHGSMICompletionCommandRelease(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)
    4747{
    4848    vboxSHGSMICommandRelease (pHeap, VBoxSHGSMIBufferHeader(pvCmd));
     
    5050
    5151/* do not wait for completion */
    52 DECLINLINE(const VBOXSHGSMIHEADER*) vboxSHGSMICommandPrepAsynch (struct _HGSMIHEAP * pHeap, PVBOXSHGSMIHEADER pHeader)
     52DECLINLINE(const VBOXSHGSMIHEADER*) vboxSHGSMICommandPrepAsynch (PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADER pHeader)
    5353{
    5454    /* ensure the command is not removed until we're processing it */
     
    5757}
    5858
    59 DECLINLINE(void) vboxSHGSMICommandDoneAsynch (struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader)
     59DECLINLINE(void) vboxSHGSMICommandDoneAsynch (PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
    6060{
    6161    if(!(ASMAtomicReadU32((volatile uint32_t *)&pHeader->fFlags) & VBOXSHGSMI_FLAG_HG_ASYNCH))
     
    6969}
    7070
    71 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent (struct _HGSMIHEAP * pHeap, PVOID pvBuff, RTSEMEVENT hEventSem)
     71const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent (PVBOXSHGSMI pHeap, PVOID pvBuff, RTSEMEVENT hEventSem)
    7272{
    7373    PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader (pvBuff);
     
    7979}
    8080
    81 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch (struct _HGSMIHEAP * pHeap, PVOID pCmd)
     81const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch (PVBOXSHGSMI pHeap, PVOID pCmd)
    8282{
    8383    RTSEMEVENT hEventSem;
     
    9191}
    9292
    93 void VBoxSHGSMICommandDoneAsynch (struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER * pHeader)
     93void VBoxSHGSMICommandDoneAsynch (PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER * pHeader)
    9494{
    9595    vboxSHGSMICommandDoneAsynch(pHeap, pHeader);
    9696}
    9797
    98 int VBoxSHGSMICommandDoneSynch (struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader)
     98int VBoxSHGSMICommandDoneSynch (PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
    9999{
    100100    VBoxSHGSMICommandDoneAsynch (pHeap, pHeader);
     
    107107}
    108108
    109 void VBoxSHGSMICommandCancelAsynch (struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader)
     109void VBoxSHGSMICommandCancelAsynch (PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
    110110{
    111111    vboxSHGSMICommandRelease(pHeap, (PVBOXSHGSMIHEADER)pHeader);
    112112}
    113113
    114 void VBoxSHGSMICommandCancelSynch (struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader)
     114void VBoxSHGSMICommandCancelSynch (PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
    115115{
    116116    VBoxSHGSMICommandCancelAsynch (pHeap, pHeader);
     
    119119}
    120120
    121 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch (struct _HGSMIHEAP * pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags)
     121const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch (PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags)
    122122{
    123123    fFlags &= ~VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ;
     
    130130}
    131131
    132 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchIrq (struct _HGSMIHEAP * pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags)
     132const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchIrq (PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags)
    133133{
    134134    fFlags |= VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ | VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ;
     
    142142}
    143143
    144 void* VBoxSHGSMICommandAlloc (struct _HGSMIHEAP * pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo)
     144void* VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo)
     145{
     146    KIRQL OldIrql;
     147    void* pvData;
     148    Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
     149    KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql);
     150    pvData = HGSMIHeapAlloc(&pHeap->Heap, cbData, u8Channel, u16ChannelInfo);
     151    KeReleaseSpinLock(&pHeap->HeapLock, OldIrql);
     152    if (!pvData)
     153        WARN(("HGSMIHeapAlloc failed!"));
     154    return pvData;
     155}
     156
     157void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void *pvBuffer)
     158{
     159    KIRQL OldIrql;
     160    Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
     161    KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql);
     162    HGSMIHeapFree(&pHeap->Heap, pvBuffer);
     163    KeReleaseSpinLock(&pHeap->HeapLock, OldIrql);
     164}
     165
     166int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, bool fOffsetBased)
     167{
     168    KeInitializeSpinLock(&pHeap->HeapLock);
     169    return HGSMIHeapSetup(&pHeap->Heap, pvBase, cbArea, offBase, fOffsetBased);
     170}
     171
     172void VBoxSHGSMITerm(PVBOXSHGSMI pHeap)
     173{
     174    HGSMIHeapDestroy(&pHeap->Heap);
     175}
     176
     177void* VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo)
    145178{
    146179    /* Issue the flush command. */
    147     PVBOXSHGSMIHEADER pHeader = (PVBOXSHGSMIHEADER)HGSMIHeapAlloc (pHeap, cbData + sizeof (VBOXSHGSMIHEADER), u8Channel, u16ChannelInfo);
     180    PVBOXSHGSMIHEADER pHeader = (PVBOXSHGSMIHEADER)VBoxSHGSMIHeapAlloc(pHeap, cbData + sizeof (VBOXSHGSMIHEADER), u8Channel, u16ChannelInfo);
    148181    Assert(pHeader);
    149182    if (pHeader)
     
    155188}
    156189
    157 void VBoxSHGSMICommandFree (struct _HGSMIHEAP * pHeap, void *pvBuffer)
     190void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void *pvBuffer)
    158191{
    159192    PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader(pvBuffer);
     
    161194}
    162195
    163 //int VBoxSHGSMISetup (PVBOXSHGSMIHEAP pHeap,
    164 //                void *pvBase,
    165 //                HGSMISIZE cbArea,
    166 //                HGSMIOFFSET offBase,
    167 //                bool fOffsetBased,
    168 //                PFNVBOXSHGSMINOTIFYHOST pfnNotifyHost,
    169 //                PFNVBOXSHGSMINOTIFYHOST pvNotifyHost)
    170 //{
    171 //    /* Setup a HGSMI heap within the adapter information area. */
    172 //    return HGSMIHeapSetup (&pHeap->Heap,
    173 //                         pvBuffer,
    174 //                         cbBuffer,
    175 //                         offBuffer,
    176 //                         false /*fOffsetBased*/);
    177 //}
    178 //
    179 //int VBoxSHGSMIDestroy (PVBOXSHGSMIHEAP pHeap)
    180 //{
    181 //    HGSMIHeapDestroy (pHeap);
    182 //    return VINF_SUCCESS;
    183 //}
    184 
    185196#define VBOXSHGSMI_CMD2LISTENTRY(_pCmd) ((PVBOXVTLIST_ENTRY)&(_pCmd)->pvNext)
    186197#define VBOXSHGSMI_LISTENTRY2CMD(_pEntry) ( (PVBOXSHGSMIHEADER)((uint8_t *)(_pEntry) - RT_OFFSETOF(VBOXSHGSMIHEADER, pvNext)) )
    187198
    188 int VBoxSHGSMICommandProcessCompletion (struct _HGSMIHEAP * pHeap, VBOXSHGSMIHEADER* pCur, bool bIrq, PVBOXVTLIST pPostProcessList)
     199int VBoxSHGSMICommandProcessCompletion (PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER* pCur, bool bIrq, PVBOXVTLIST pPostProcessList)
    189200{
    190201    int rc = VINF_SUCCESS;
     
    229240}
    230241
    231 int VBoxSHGSMICommandPostprocessCompletion (struct _HGSMIHEAP * pHeap, PVBOXVTLIST pPostProcessList)
     242int VBoxSHGSMICommandPostprocessCompletion (PVBOXSHGSMI pHeap, PVBOXVTLIST pPostProcessList)
    232243{
    233244    PVBOXVTLIST_ENTRY pNext, pCur;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.h

    r39981 r40387  
    2222#include <iprt/cdefs.h>
    2323#include <VBox/VBoxVideo.h>
    24 #include "../../common/VBoxVideoTools.h"
    2524
    26 typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext);
     25#include "common/VBoxMPUtils.h"
     26
     27typedef struct VBOXSHGSMI
     28{
     29    KSPIN_LOCK HeapLock;
     30    HGSMIHEAP Heap;
     31} VBOXSHGSMI, *PVBOXSHGSMI;
     32
     33typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext);
    2734typedef FNVBOXSHGSMICMDCOMPLETION *PFNVBOXSHGSMICMDCOMPLETION;
    2835
    29 typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION_IRQ(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext,
     36typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION_IRQ(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext,
    3037                                        PFNVBOXSHGSMICMDCOMPLETION *ppfnCompletion, void **ppvCompletion);
    3138typedef FNVBOXSHGSMICMDCOMPLETION_IRQ *PFNVBOXSHGSMICMDCOMPLETION_IRQ;
    3239
    3340
    34 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent(struct _HGSMIHEAP * pHeap, PVOID pvBuff, RTSEMEVENT hEventSem);
    35 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch(struct _HGSMIHEAP * pHeap, PVOID pCmd);
    36 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch(struct _HGSMIHEAP * pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags);
    37 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchIrq(struct _HGSMIHEAP * pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags);
     41const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, PVOID pvBuff, RTSEMEVENT hEventSem);
     42const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap, PVOID pCmd);
     43const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags);
     44const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags);
    3845
    39 void VBoxSHGSMICommandDoneAsynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
    40 int VBoxSHGSMICommandDoneSynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
    41 void VBoxSHGSMICommandCancelAsynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
    42 void VBoxSHGSMICommandCancelSynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
     46void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader);
     47int VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader);
     48void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader);
     49void VBoxSHGSMICommandCancelSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader);
    4350
    44 DECLINLINE(HGSMIOFFSET) VBoxSHGSMICommandOffset(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader)
     51DECLINLINE(HGSMIOFFSET) VBoxSHGSMICommandOffset(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
    4552{
    46     return HGSMIHeapBufferOffset(pHeap, (void*)pHeader);
     53    return HGSMIHeapBufferOffset(&pHeap->Heap, (void*)pHeader);
    4754}
    4855
    49 void* VBoxSHGSMICommandAlloc(struct _HGSMIHEAP * pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);
    50 void VBoxSHGSMICommandFree(struct _HGSMIHEAP * pHeap, void *pvBuffer);
    51 int VBoxSHGSMICommandProcessCompletion(struct _HGSMIHEAP * pHeap, VBOXSHGSMIHEADER* pCmd, bool bIrq, PVBOXVTLIST pPostProcessList);
    52 int VBoxSHGSMICommandPostprocessCompletion(struct _HGSMIHEAP * pHeap, PVBOXVTLIST pPostProcessList);
     56int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, bool fOffsetBased);
     57void VBoxSHGSMITerm(PVBOXSHGSMI pHeap);
     58void* VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);
     59void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void *pvBuffer);
     60void* VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);
     61void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void *pvBuffer);
     62int VBoxSHGSMICommandProcessCompletion(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER* pCmd, bool bIrq, struct VBOXVTLIST * pPostProcessList);
     63int VBoxSHGSMICommandPostprocessCompletion(PVBOXSHGSMI pHeap, struct VBOXVTLIST * pPostProcessList);
    5364
    5465#endif /* #ifndef ___VBoxMPShgsmi_h___ */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp

    r39981 r40387  
    13151315    {
    13161316        pCmd->enmCtl = enmCtl;
    1317         pCmd->u32Offset = pInfo->CmdHeap.area.offBase;
     1317        pCmd->u32Offset = pInfo->CmdHeap.Heap.area.offBase;
    13181318        pCmd->i32Result = VERR_NOT_SUPPORTED;
    13191319
     
    13721372
    13731373#ifdef VBOX_WITH_VDMA
    1374     KeInitializeSpinLock(&pInfo->HeapLock);
    13751374    Assert((offBuffer & 0xfff) == 0);
    13761375    Assert((cbBuffer & 0xfff) == 0);
     
    13961395    {
    13971396        /* Setup a HGSMI heap within the adapter information area. */
    1398         rc = HGSMIHeapSetup (&pInfo->CmdHeap,
     1397        rc = VBoxSHGSMIInit(&pInfo->CmdHeap,
    13991398                             pvBuffer,
    14001399                             cbBuffer,
     
    14881487            rc = vboxVdmaDisable (pDevExt, pInfo);
    14891488#ifdef VBOX_WITH_VDMA
    1490         VBoxMPCmnUnmapAdapterMemory(VBoxCommonFromDeviceExt(pDevExt), (void**)&pInfo->CmdHeap.area.pu8Base);
     1489        VBoxSHGSMITerm(&pInfo->CmdHeap);
     1490        VBoxMPCmnUnmapAdapterMemory(VBoxCommonFromDeviceExt(pDevExt), (void**)&pInfo->CmdHeap.Heap.area.pu8Base);
    14911491#endif
    14921492    }
     
    14991499void vboxVdmaCBufDrFree (PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr)
    15001500{
    1501     KIRQL OldIrql;
    1502     KeAcquireSpinLock(&pInfo->HeapLock, &OldIrql);
    15031501    VBoxSHGSMICommandFree (&pInfo->CmdHeap, pDr);
    1504     KeReleaseSpinLock(&pInfo->HeapLock, OldIrql);
    15051502}
    15061503
     
    15081505{
    15091506    uint32_t cbDr = VBOXVDMACBUF_DR_SIZE(cbTrailingData);
    1510     KIRQL OldIrql;
    1511     KeAcquireSpinLock(&pInfo->HeapLock, &OldIrql);
    15121507    PVBOXVDMACBUF_DR pDr = (PVBOXVDMACBUF_DR)VBoxSHGSMICommandAlloc (&pInfo->CmdHeap, cbDr, HGSMI_CH_VBVA, VBVA_VDMA_CMD);
    1513     KeReleaseSpinLock(&pInfo->HeapLock, OldIrql);
    15141508    Assert(pDr);
    15151509    if (pDr)
     
    15211515}
    15221516
    1523 static DECLCALLBACK(void) vboxVdmaCBufDrCompletion(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext)
     1517static DECLCALLBACK(void) vboxVdmaCBufDrCompletion(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)
    15241518{
    15251519    PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)pvContext;
     
    15291523}
    15301524
    1531 static DECLCALLBACK(void) vboxVdmaCBufDrCompletionIrq(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext,
     1525static DECLCALLBACK(void) vboxVdmaCBufDrCompletionIrq(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext,
    15321526                                        PFNVBOXSHGSMICMDCOMPLETION *ppfnCompletion, void **ppvCompletion)
    15331527{
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h

    r38982 r40387  
    291291{
    292292#ifdef VBOX_WITH_VDMA
    293     KSPIN_LOCK HeapLock;
    294     HGSMIHEAP CmdHeap;
     293    VBOXSHGSMI CmdHeap;
    295294#endif
    296295    UINT      uLastCompletedPagingBufferCmdFenceId;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r39981 r40387  
    288288#endif
    289289
    290 HGSMIHEAP* vboxWddmHgsmiGetHeapFromCmdOffset(PVBOXMP_DEVEXT pDevExt, HGSMIOFFSET offCmd)
     290PVBOXSHGSMI vboxWddmHgsmiGetHeapFromCmdOffset(PVBOXMP_DEVEXT pDevExt, HGSMIOFFSET offCmd)
    291291{
    292292#ifdef VBOX_WITH_VDMA
    293     if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.area, offCmd))
     293    if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.Heap.area, offCmd))
    294294        return &pDevExt->u.primary.Vdma.CmdHeap;
    295295#endif
    296     if (HGSMIAreaContainsOffset(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.area, offCmd))
     296    if (HGSMIAreaContainsOffset(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, offCmd))
    297297        return &VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx;
    298298    return NULL;
     
    311311{
    312312#ifdef VBOX_WITH_VDMA
    313     if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.area, offCmd))
     313    if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.Heap.area, offCmd))
    314314        return VBOXWDDM_HGSMICMD_TYPE_DMACMD;
    315315#endif
    316     if (HGSMIAreaContainsOffset(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.area, offCmd))
     316    if (HGSMIAreaContainsOffset(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, offCmd))
    317317        return VBOXWDDM_HGSMICMD_TYPE_CTL;
    318318    return VBOXWDDM_HGSMICMD_TYPE_UNDEFINED;
     
    11711171                    VBOXWDDM_HGSMICMD_TYPE enmType = vboxWddmHgsmiGetCmdTypeFromOffset(pDevExt, offCmd);
    11721172                    PVBOXVTLIST pList;
    1173                     HGSMIHEAP * pHeap = NULL;
     1173                    PVBOXSHGSMI pHeap = NULL;
    11741174                    switch (enmType)
    11751175                    {
     
    11911191                    {
    11921192                        uint16_t chInfo;
    1193                         uint8_t *pvCmd = HGSMIBufferDataAndChInfoFromOffset (&pHeap->area, offCmd, &chInfo);
     1193                        uint8_t *pvCmd = HGSMIBufferDataAndChInfoFromOffset (&pHeap->Heap.area, offCmd, &chInfo);
    11941194                        Assert(pvCmd);
    11951195                        if (pvCmd)
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp

    r35398 r40387  
    128128                                    uint16_t u16Op)
    129129{
    130 #ifdef VBOX_WITH_WDDM
    131     /* @todo: add synchronization */
     130#ifdef VBOX_WDDM_MINIPORT
     131    return VBoxSHGSMIHeapAlloc (&pCtx->heapCtx, cbData, u8Ch, u16Op);
     132#else
     133    return HGSMIHeapAlloc (&pCtx->heapCtx, cbData, u8Ch, u16Op);
    132134#endif
    133     return HGSMIHeapAlloc (&pCtx->heapCtx, cbData, u8Ch, u16Op);
    134135}
    135136
     
    144145                                 void *pvBuffer)
    145146{
    146 #ifdef VBOX_WITH_WDDM
    147     /* @todo: add synchronization */
     147#ifdef VBOX_WDDM_MINIPORT
     148    VBoxSHGSMIHeapFree (&pCtx->heapCtx, pvBuffer);
     149#else
     150    HGSMIHeapFree (&pCtx->heapCtx, pvBuffer);
    148151#endif
    149     HGSMIHeapFree (&pCtx->heapCtx, pvBuffer);
    150152}
    151153
     
    161163{
    162164    /* Initialize the buffer and get the offset for port IO. */
    163     HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pCtx->heapCtx, pvBuffer);
     165    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (HGSMIGUESTCMDHEAP_GET(&pCtx->heapCtx), pvBuffer);
    164166
    165167    Assert(offBuffer != HGSMIOFFSET_VOID);
     
    184186
    185187    /* Allocate the IO buffer. */
    186     p = (HGSMIBUFFERLOCATION *)HGSMIHeapAlloc(&pCtx->heapCtx,
     188    p = (HGSMIBUFFERLOCATION *)VBoxHGSMIBufferAlloc(pCtx,
    187189                                              sizeof(HGSMIBUFFERLOCATION),
    188190                                              HGSMI_CH_HGSMI,
     
    195197        rc = VBoxHGSMIBufferSubmit(pCtx, p);
    196198        /* Free the IO buffer. */
    197         HGSMIHeapFree (&pCtx->heapCtx, p);
     199        VBoxHGSMIBufferFree(pCtx, p);
    198200    }
    199201    else
     
    212214
    213215    /* Allocate the IO buffer. */
    214     pCaps = (VBVACAPS *)HGSMIHeapAlloc(&pCtx->heapCtx,
     216    pCaps = (VBVACAPS *)VBoxHGSMIBufferAlloc(pCtx,
    215217                                       sizeof(VBVACAPS), HGSMI_CH_VBVA,
    216218                                       VBVA_INFO_CAPS);
     
    228230        }
    229231        /* Free the IO buffer. */
    230         HGSMIHeapFree(&pCtx->heapCtx, pCaps);
     232        VBoxHGSMIBufferFree(pCtx, pCaps);
    231233    }
    232234    else
     
    245247
    246248    /* Allocate the IO buffer. */
    247     p = (VBVAINFOHEAP *)HGSMIHeapAlloc(&pCtx->heapCtx,
     249    p = (VBVAINFOHEAP *)VBoxHGSMIBufferAlloc(pCtx,
    248250                                       sizeof (VBVAINFOHEAP), HGSMI_CH_VBVA,
    249251                                       VBVA_INFO_HEAP);
     
    255257        rc = VBoxHGSMIBufferSubmit(pCtx, p);
    256258        /* Free the IO buffer. */
    257         HGSMIHeapFree(&pCtx->heapCtx, p);
     259        VBoxHGSMIBufferFree(pCtx, p);
    258260    }
    259261    else
     
    322324    /** @todo should we be using a fixed ISA port value here? */
    323325    pCtx->port = (RTIOPORT)VGA_PORT_HGSMI_GUEST;
     326#ifdef VBOX_WDDM_MINIPORT
     327    return VBoxSHGSMIInit(&pCtx->heapCtx, pvGuestHeapMemory,
     328                          cbGuestHeapMemory, offVRAMGuestHeapMemory,
     329                          false /*fOffsetBased*/);
     330#else
    324331    return HGSMIHeapSetup(&pCtx->heapCtx, pvGuestHeapMemory,
    325332                          cbGuestHeapMemory, offVRAMGuestHeapMemory,
    326333                          false /*fOffsetBased*/);
     334#endif
    327335}
    328336
     
    460468
    461469    /* Allocate the IO buffer. */
    462     p = (VBVACONF32 *)HGSMIHeapAlloc(&pCtx->heapCtx,
     470    p = (VBVACONF32 *)VBoxHGSMIBufferAlloc(pCtx,
    463471                                     sizeof(VBVACONF32), HGSMI_CH_VBVA,
    464472                                     VBVA_QUERY_CONF32);
     
    475483        }
    476484        /* Free the IO buffer. */
    477         HGSMIHeapFree(&pCtx->heapCtx, p);
     485        VBoxHGSMIBufferFree(pCtx, p);
    478486    }
    479487    else
     
    528536    }
    529537    /* Allocate the IO buffer. */
    530     p = (VBVAMOUSEPOINTERSHAPE *)HGSMIHeapAlloc(&pCtx->heapCtx,
     538    p = (VBVAMOUSEPOINTERSHAPE *)VBoxHGSMIBufferAlloc(pCtx,
    531539                                                  sizeof(VBVAMOUSEPOINTERSHAPE)
    532540                                                + cbData,
     
    551559            rc = p->i32Result;
    552560        /* Free the IO buffer. */
    553         HGSMIHeapFree(&pCtx->heapCtx, p);
     561        VBoxHGSMIBufferFree(pCtx, p);
    554562    }
    555563    else
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