VirtualBox

Ignore:
Timestamp:
Oct 1, 2010 10:51:28 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: basics for chromium over hgsmi

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Miniport
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Makefile.kmk

    r32823 r32877  
    9090  endif
    9191 endif
     92 ifdef VBOXVDMA_WITH_VDMA
     93  VBoxVideoWddm_DEFS     += VBOXVDMA_WITH_VDMA
     94 endif
    9295 ifdef DEBUG_misha
    9396  VBoxVideoWddm_DEFS       += LOG_ENABLED
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r32876 r32877  
    959959        ULONG ulSize;
    960960        ULONG offset;
    961 #ifdef VBOXVDMA
     961#ifdef VBOX_WITH_VDMA
    962962        ulSize = ulAvailable / 2;
    963963        if (ulSize > VBOXWDDM_C_VDMA_BUFFER_SIZE)
     
    973973#endif
    974974        rc = vboxVdmaCreate (PrimaryExtension, &PrimaryExtension->u.primary.Vdma
    975 #ifdef VBOXVDMA
     975#ifdef VBOX_WITH_VDMA
    976976                , offset, ulSize
    977977#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h

    r32580 r32877  
    2424#include <VBox/VBoxVideo.h>
    2525#include "../../../include/VBoxDisplay.h"
     26#include "VBoxUhgsmi.h"
    2627
    2728#include <iprt/assert.h>
     
    2930
    3031/* One would increase this whenever definitions in this file are changed */
    31 #define VBOXVIDEOIF_VERSION 5
     32#define VBOXVIDEOIF_VERSION 6
    3233
    3334/* create allocation func */
     
    4243    /* custom allocation types requested from user-mode d3d module will go here */
    4344    , VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC
     45    , VBOXWDDM_ALLOC_TYPE_UMD_HGSMI_BUFFER
    4446} VBOXWDDM_ALLOC_TYPE;
    4547
     
    6971{
    7072    VBOXWDDM_ALLOC_TYPE enmType;
    71     D3DDDI_RESOURCEFLAGS fFlags;
    72     HANDLE hSharedHandle;
    73     VBOXWDDM_SURFACE_DESC SurfDesc;
     73    union
     74    {
     75        struct
     76        {
     77            D3DDDI_RESOURCEFLAGS fFlags;
     78            HANDLE hSharedHandle;
     79            VBOXWDDM_SURFACE_DESC SurfDesc;
     80        };
     81
     82        struct
     83        {
     84            uint32_t cbBuffer;
     85            HANDLE hSynch;
     86            VBOXUHGSMI_SYNCHOBJECT_TYPE enmSynchType;
     87        };
     88    };
    7489} VBOXWDDM_ALLOCINFO, *PVBOXWDDM_ALLOCINFO;
    7590
     
    100115//    VBOXWDDM_ALLOCINFO aAllocInfos[1];
    101116} VBOXWDDM_RCINFO, *PVBOXWDDM_RCINFO;
     117
     118typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLAFS
     119{
     120    union
     121    {
     122        struct
     123        {
     124            UINT bCmdInDmaBuffer : 1;
     125            UINT bReserved : 31;
     126        };
     127        uint32_t Value;
     128    };
     129} VBOXWDDM_DMA_PRIVATEDATA_FLAFS, *PVBOXWDDM_DMA_PRIVATEDATA_FLAFS;
     130
     131typedef struct VBOXWDDM_DMA_PRIVATEDATA_BASEHDR
     132{
     133    VBOXVDMACMD_TYPE enmCmd;
     134    union
     135    {
     136        VBOXWDDM_DMA_PRIVATEDATA_FLAFS fFlags;
     137        uint32_t u32CmdReserved;
     138    };
     139} VBOXWDDM_DMA_PRIVATEDATA_BASEHDR, *PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR;
     140
     141typedef struct VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO
     142{
     143    VBOXUHGSMI_BUFFER_SUBMIT_FLAGS fSubFlags;
     144    uint32_t offData;
     145    uint32_t cbData;
     146} VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO, *PVBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO;
     147
     148typedef struct VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD
     149{
     150    VBOXWDDM_DMA_PRIVATEDATA_BASEHDR Base;
     151    VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO aBufInfos[1];
     152} VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD, *PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD;
    102153
    103154#define VBOXVHWA_F_ENABLED  0x00000001
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp

    r32823 r32877  
    717717    PVBOXWDDM_CONTEXT pContext = pDmaCmd->DdiCmd.pContext;
    718718    NTSTATUS Status = STATUS_SUCCESS;
     719    DXGK_INTERRUPT_TYPE enmComplType = DXGK_INTERRUPT_DMA_COMPLETED;
    719720    switch (pDmaCmd->enmCmd)
    720721    {
     
    869870    }
    870871
    871     Status = vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, &pDmaCmd->DdiCmd);
     872    Status = vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, &pDmaCmd->DdiCmd, enmComplType);
    872873    Assert(Status == STATUS_SUCCESS);
    873874
     
    974975/* end */
    975976
    976 #ifdef VBOXVDMA
     977#ifdef VBOX_WITH_VDMA
    977978/*
    978979 * This is currently used by VDMA. It is invisible for Vdma API clients since
     
    10631064/* create a DMACommand buffer */
    10641065int vboxVdmaCreate(PDEVICE_EXTENSION pDevExt, VBOXVDMAINFO *pInfo
    1065 #ifdef VBOXVDMA
     1066#ifdef VBOX_WITH_VDMA
    10661067        , ULONG offBuffer, ULONG cbBuffer
    10671068#endif
     
    10711072    pInfo->fEnabled           = FALSE;
    10721073
    1073 #ifdef VBOXVDMA
     1074#ifdef VBOX_WITH_VDMA
    10741075    Assert((offBuffer & 0xfff) == 0);
    10751076    Assert((cbBuffer & 0xfff) == 0);
     
    11101111            rc = VERR_GENERAL_FAILURE;
    11111112        }
    1112 #ifdef VBOXVDMA
     1113#ifdef VBOX_WITH_VDMA
    11131114        else
    11141115            drprintf((__FUNCTION__": HGSMIHeapSetup failed rc = 0x%x\n", rc));
     
    11321133    /* ensure nothing else is submitted */
    11331134    pInfo->fEnabled        = FALSE;
    1134 #ifdef VBOXVDMA
     1135#ifdef VBOX_WITH_VDMA
    11351136    int rc = vboxVdmaInformHost (pDevExt, pInfo, VBOXVDMA_CTL_TYPE_DISABLE);
    11361137    AssertRC(rc);
     
    11481149    if (pInfo->fEnabled)
    11491150        return VINF_ALREADY_INITIALIZED;
    1150 #ifdef VBOXVDMA
     1151#ifdef VBOX_WITH_VDMA
    11511152    int rc = vboxVdmaInformHost (pDevExt, pInfo, VBOXVDMA_CTL_TYPE_ENABLE);
    11521153    Assert(RT_SUCCESS(rc));
     
    11601161}
    11611162
    1162 #ifdef VBOXVDMA
     1163#ifdef VBOX_WITH_VDMA
    11631164int vboxVdmaFlush (PDEVICE_EXTENSION pDevExt, PVBOXVDMAINFO pInfo)
    11641165{
     
    11861187        if (pInfo->fEnabled)
    11871188            rc = vboxVdmaDisable (pDevExt, pInfo);
    1188 #ifdef VBOXVDMA
     1189#ifdef VBOX_WITH_VDMA
    11891190        VBoxUnmapAdapterMemory (pDevExt, (void**)&pInfo->CmdHeap.area.pu8Base, pInfo->CmdHeap.area.cbArea);
    11901191#endif
     
    11951196}
    11961197
    1197 #ifdef VBOXVDMA
     1198#ifdef VBOX_WITH_VDMA
    11981199void vboxVdmaCBufDrFree (PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr)
    11991200{
     
    12271228    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)pvContext;
    12281229    PVBOXVDMAINFO pVdma = &pDevExt->u.primary.Vdma;
    1229     DXGKARGCB_NOTIFY_INTERRUPT_DATA notify;
    12301230    PVBOXVDMACBUF_DR pDr = (PVBOXVDMACBUF_DR)pvCmd;
    12311231
    1232     memset(&notify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA));
    1233 
    1234     PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pDr->u64GuestContext;
     1232    DXGK_INTERRUPT_TYPE enmComplType;
    12351233
    12361234    if (RT_SUCCESS(pDr->rc))
    12371235    {
    1238         notify.InterruptType = DXGK_INTERRUPT_DMA_COMPLETED;
    1239         notify.DmaCompleted.SubmissionFenceId = pDr->u32FenceId;
    1240         if (pContext)
    1241         {
    1242             notify.DmaCompleted.NodeOrdinal = pContext->NodeOrdinal;
    1243             notify.DmaCompleted.EngineOrdinal = 0;
    1244             pContext->uLastCompletedCmdFenceId = pDr->u32FenceId;
    1245         }
    1246         else
    1247             pVdma->uLastCompletedPagingBufferCmdFenceId = pDr->u32FenceId;
    1248         pDevExt->bSetNotifyDxDpc = TRUE;
     1236        enmComplType = DXGK_INTERRUPT_DMA_COMPLETED;
    12491237    }
    12501238    else if (pDr->rc == VERR_INTERRUPTED)
    12511239    {
    1252         notify.InterruptType = DXGK_INTERRUPT_DMA_PREEMPTED;
    1253         notify.DmaPreempted.PreemptionFenceId = pDr->u32FenceId;
    1254         if (pContext)
    1255         {
    1256             notify.DmaPreempted.LastCompletedFenceId = pContext->uLastCompletedCmdFenceId;
    1257             notify.DmaPreempted.NodeOrdinal = pContext->NodeOrdinal;
    1258             notify.DmaPreempted.EngineOrdinal = 0;
    1259         }
    1260         else
    1261             notify.DmaPreempted.LastCompletedFenceId = pVdma->uLastCompletedPagingBufferCmdFenceId;
    1262 
    1263         pDevExt->bSetNotifyDxDpc = TRUE;
     1240        Assert(0);
     1241        enmComplType = DXGK_INTERRUPT_DMA_PREEMPTED;
    12641242    }
    12651243    else
    12661244    {
    1267         AssertBreakpoint();
    1268         notify.InterruptType = DXGK_INTERRUPT_DMA_FAULTED;
    1269         notify.DmaFaulted.FaultedFenceId = pDr->u32FenceId;
    1270         notify.DmaFaulted.Status = STATUS_UNSUCCESSFUL; /* @todo: better status ? */
    1271         if (pContext)
    1272         {
    1273             notify.DmaFaulted.NodeOrdinal = pContext->NodeOrdinal;
    1274             notify.DmaFaulted.EngineOrdinal = 0;
    1275         }
    1276         pDevExt->bSetNotifyDxDpc = TRUE;
    1277     }
    1278 
    1279     pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, &notify);
    1280 
    1281     /* inform SHGSMI we want to be called at DPC later */
    1282     *ppfnCompletion = vboxVdmaCBufDrCompletion;
    1283     *ppvCompletion = pvContext;
     1245        Assert(0);
     1246        enmComplType = DXGK_INTERRUPT_DMA_FAULTED;
     1247    }
     1248
     1249    vboxVdmaDdiCmdCompletedIrq(pDevExt, &pDevExt->DdiCmdQueue, VBOXVDMADDI_CMD_FROM_BUF_DR(pDr), enmComplType);
     1250
     1251    /* inform SHGSMI we DO NOT want to be called at DPC later */
     1252    *ppfnCompletion = NULL;
     1253//    *ppvCompletion = pvContext;
    12841254}
    12851255
     
    13301300}
    13311301
    1332 static VOID vboxVdmaDdiCmdNotifyCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd)
     1302static VOID vboxVdmaDdiCmdNotifyCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType)
    13331303{
    13341304    DXGKARGCB_NOTIFY_INTERRUPT_DATA notify;
    13351305    memset(&notify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA));
    1336     notify.InterruptType = DXGK_INTERRUPT_DMA_COMPLETED;
    1337     notify.DmaCompleted.SubmissionFenceId = pCmd->u32FenceId;
    1338     notify.DmaCompleted.NodeOrdinal = pCmd->pContext->NodeOrdinal;
    1339     notify.DmaCompleted.EngineOrdinal = 0;
    1340     pCmd->pContext->uLastCompletedCmdFenceId = pCmd->u32FenceId;
     1306    switch (enmComplType)
     1307    {
     1308        case DXGK_INTERRUPT_DMA_COMPLETED:
     1309            notify.InterruptType = DXGK_INTERRUPT_DMA_COMPLETED;
     1310            notify.DmaCompleted.SubmissionFenceId = pCmd->u32FenceId;
     1311            if (pCmd->pContext)
     1312            {
     1313                notify.DmaCompleted.NodeOrdinal = pCmd->pContext->NodeOrdinal;
     1314                pCmd->pContext->uLastCompletedCmdFenceId = pCmd->u32FenceId;
     1315            }
     1316            else
     1317            {
     1318                pDevExt->u.primary.Vdma.uLastCompletedPagingBufferCmdFenceId = pCmd->u32FenceId;
     1319            }
     1320
     1321            InsertTailList(&pQueue->DpcCmdQueue, &pCmd->QueueEntry);
     1322
     1323            break;
     1324        case DXGK_INTERRUPT_DMA_PREEMPTED:
     1325            Assert(0);
     1326            notify.InterruptType = DXGK_INTERRUPT_DMA_PREEMPTED;
     1327            notify.DmaPreempted.PreemptionFenceId = pCmd->u32FenceId;
     1328            if (pCmd->pContext)
     1329            {
     1330                notify.DmaPreempted.LastCompletedFenceId = pCmd->pContext->uLastCompletedCmdFenceId;
     1331                notify.DmaPreempted.NodeOrdinal = pCmd->pContext->NodeOrdinal;
     1332            }
     1333            else
     1334            {
     1335                notify.DmaPreempted.LastCompletedFenceId = pDevExt->u.primary.Vdma.uLastCompletedPagingBufferCmdFenceId;
     1336            }
     1337            break;
     1338
     1339        case DXGK_INTERRUPT_DMA_FAULTED:
     1340            Assert(0);
     1341            notify.InterruptType = DXGK_INTERRUPT_DMA_FAULTED;
     1342            notify.DmaFaulted.FaultedFenceId = pCmd->u32FenceId;
     1343            notify.DmaFaulted.Status = STATUS_UNSUCCESSFUL; /* @todo: better status ? */
     1344            if (pCmd->pContext)
     1345            {
     1346                notify.DmaFaulted.NodeOrdinal = pCmd->pContext->NodeOrdinal;
     1347            }
     1348            break;
     1349        default:
     1350            Assert(0);
     1351            break;
     1352    }
    13411353
    13421354    pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, &notify);
    1343 
    1344     InsertTailList(&pQueue->DpcCmdQueue, &pCmd->QueueEntry);
    13451355}
    13461356
     
    13641374}
    13651375
    1366 BOOLEAN vboxVdmaDdiCmdCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd)
     1376BOOLEAN vboxVdmaDdiCmdCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType)
    13671377{
    13681378    BOOLEAN bQueued = pCmd->enmState > VBOXVDMADDI_STATE_NOT_QUEUED;
     
    13901400    if (bComplete)
    13911401    {
    1392         vboxVdmaDdiCmdNotifyCompletedIrq(pDevExt, pQueue, pCmd);
     1402        vboxVdmaDdiCmdNotifyCompletedIrq(pDevExt, pQueue, pCmd, enmComplType);
    13931403
    13941404        while (!IsListEmpty(&pQueue->CmdQueue))
     
    13981408            {
    13991409                vboxVdmaDdiCmdDequeueIrq(pQueue, pCmd);
    1400                 vboxVdmaDdiCmdNotifyCompletedIrq(pDevExt, pQueue, pCmd);
     1410                vboxVdmaDdiCmdNotifyCompletedIrq(pDevExt, pQueue, pCmd, pCmd->enmComplType);
    14011411            }
    14021412            else
     
    14071417    {
    14081418        pCmd->enmState = VBOXVDMADDI_STATE_COMPLETED;
     1419        pCmd->enmComplType = enmComplType;
    14091420    }
    14101421
     
    14261437    PVBOXVDMADDI_CMD_QUEUE pQueue;
    14271438    PVBOXVDMADDI_CMD pCmd;
     1439    DXGK_INTERRUPT_TYPE enmComplType;
    14281440} VBOXVDMADDI_CMD_COMPLETED_CB, *PVBOXVDMADDI_CMD_COMPLETED_CB;
    14291441
     
    14311443{
    14321444    PVBOXVDMADDI_CMD_COMPLETED_CB pdc = (PVBOXVDMADDI_CMD_COMPLETED_CB)Context;
    1433     BOOLEAN bNeedDps = vboxVdmaDdiCmdCompletedIrq(pdc->pDevExt, pdc->pQueue, pdc->pCmd);
     1445    BOOLEAN bNeedDps = vboxVdmaDdiCmdCompletedIrq(pdc->pDevExt, pdc->pQueue, pdc->pCmd, pdc->enmComplType);
    14341446    pdc->pDevExt->bNotifyDxDpc |= bNeedDps;
    14351447
     
    14371449}
    14381450
    1439 NTSTATUS vboxVdmaDdiCmdCompleted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd)
     1451NTSTATUS vboxVdmaDdiCmdCompleted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType)
    14401452{
    14411453    VBOXVDMADDI_CMD_COMPLETED_CB context;
     
    14431455    context.pQueue = pQueue;
    14441456    context.pCmd = pCmd;
     1457    context.enmComplType = enmComplType;
    14451458    BOOLEAN bNeedDps;
    14461459    NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution(
     
    15351548}
    15361549
    1537 NTSTATUS vboxVdmaDdiCmdFenceComplete(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId)
     1550NTSTATUS vboxVdmaDdiCmdFenceComplete(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId, DXGK_INTERRUPT_TYPE enmComplType)
    15381551{
    15391552    if (vboxVdmaDdiCmdCanComplete(&pDevExt->DdiCmdQueue))
     
    15451558    {
    15461559        vboxVdmaDdiCmdInit(pCmd, u32FenceId, pContext, vboxVdmaDdiCmdCompletionCbFree, NULL);
    1547         NTSTATUS Status = vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, pCmd);
     1560        NTSTATUS Status = vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, pCmd, enmComplType);
    15481561        Assert(Status == STATUS_SUCCESS);
    15491562        if (Status == STATUS_SUCCESS)
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h

    r32823 r32877  
    3737    VBOXVDMADDI_STATE enmState;
    3838    uint32_t u32FenceId;
     39    DXGK_INTERRUPT_TYPE enmComplType;
    3940    PVBOXWDDM_CONTEXT pContext;
    4041    PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete;
     
    5051
    5152VOID vboxVdmaDdiQueueInit(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue);
    52 BOOLEAN vboxVdmaDdiCmdCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
     53BOOLEAN vboxVdmaDdiCmdCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType);
    5354VOID vboxVdmaDdiCmdSubmittedIrq(PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
    5455
    55 NTSTATUS vboxVdmaDdiCmdCompleted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
     56NTSTATUS vboxVdmaDdiCmdCompleted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd, DXGK_INTERRUPT_TYPE enmComplType);
    5657NTSTATUS vboxVdmaDdiCmdSubmitted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
    5758
     
    6970}
    7071
    71 NTSTATUS vboxVdmaDdiCmdFenceComplete(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId);
     72NTSTATUS vboxVdmaDdiCmdFenceComplete(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId, DXGK_INTERRUPT_TYPE enmComplType);
    7273
    7374DECLCALLBACK(VOID) vboxVdmaDdiCmdCompletionCbFree(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext);
     
    247248typedef struct VBOXVDMAINFO
    248249{
    249 #ifdef VBOXVDMA
     250#ifdef VBOX_WITH_VDMA
    250251    HGSMIHEAP CmdHeap;
    251252#endif
     
    260261
    261262int vboxVdmaCreate (struct _DEVICE_EXTENSION* pDevExt, VBOXVDMAINFO *pInfo
    262 #ifdef VBOXVDMA
     263#ifdef VBOX_WITH_VDMA
    263264        , ULONG offBuffer, ULONG cbBuffer
    264265#endif
     
    271272int vboxVdmaDestroy (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo);
    272273
    273 #ifdef VBOXVDMA
     274#ifdef VBOX_WITH_VDMA
    274275int vboxVdmaFlush (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo);
    275276int vboxVdmaCBufDrSubmit (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr);
     
    280281#define VBOXVDMACBUF_DR_SIZE(_cbData) (VBOXVDMACBUF_DR_DATA_OFFSET() + (_cbData))
    281282#define VBOXVDMACBUF_DR_DATA(_pDr) ( ((uint8_t*)(_pDr)) + VBOXVDMACBUF_DR_DATA_OFFSET() )
     283
     284AssertCompile(sizeof (VBOXVDMADDI_CMD) <= RT_SIZEOFMEMB(VBOXVDMACBUF_DR, aGuestData));
     285#define VBOXVDMADDI_CMD_FROM_BUF_DR(_pDr) ((PVBOXVDMADDI_CMD)(_pDr)->aGuestData)
     286#define VBOXVDMACBUF_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMACBUF_DR)(((uint_8*)(_pCmd)) - RT_OFFSETOF(VBOXVDMACBUF_DR, aGuestData)))
     287
    282288#endif
    283289NTSTATUS vboxVdmaGgCmdSubmit(PVBOXVDMAGG pVdma, PVBOXVDMAPIPE_CMD_DR pCmd);
     
    287293#define VBOXVDMAPIPE_CMD_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMAPIPE_CMD_DR)(((uint8_t*)(_pCmd)) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_DR, DdiCmd)))
    288294DECLCALLBACK(VOID) vboxVdmaGgDdiCmdDestroy(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext);
    289 
    290295#endif /* #ifndef ___VBoxVideoVdma_h___ */
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r32876 r32877  
    4747    GhData.Flags.Value = 0;
    4848    return (PVBOXWDDM_ALLOCATION)pDevExt->u.primary.DxgkInterface.DxgkCbGetHandleData(&GhData);
     49}
     50
     51DECLINLINE(PVBOXWDDM_ALLOCATION) vboxWddmGetAllocationFromAllocList(PDEVICE_EXTENSION pDevExt, DXGK_ALLOCATIONLIST *pAllocList)
     52{
     53    return vboxWddmGetAllocationFromOpenData(pDevExt, (PVBOXWDDM_OPENALLOCATION)pAllocList->hDeviceSpecificAllocation);
     54}
     55
     56static void vboxWddmPopulateDmaAllocInfo(PVBOXWDDM_DMA_ALLOCINFO pInfo, PVBOXWDDM_ALLOCATION pAlloc, DXGK_ALLOCATIONLIST *pDmaAlloc)
     57{
     58    pInfo->pAlloc = pAlloc;
     59    if (pDmaAlloc->SegmentId)
     60    {
     61        pInfo->offAlloc = (VBOXVIDEOOFFSET)pDmaAlloc->PhysicalAddress.QuadPart;
     62        pInfo->segmentIdAlloc = pDmaAlloc->SegmentId;
     63    }
     64    else
     65        pInfo->segmentIdAlloc = 0;
     66    pInfo->srcId = pAlloc->SurfDesc.VidPnSourceId;
    4967}
    5068
     
    246264HGSMIHEAP* vboxWddmHgsmiGetHeapFromCmdOffset(PDEVICE_EXTENSION pDevExt, HGSMIOFFSET offCmd)
    247265{
    248 #ifdef VBOXVDMA
     266#ifdef VBOX_WITH_VDMA
    249267    if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.area, offCmd))
    250268        return &pDevExt->u.primary.Vdma.CmdHeap;
     
    259277    VBOXWDDM_HGSMICMD_TYPE_UNDEFINED = 0,
    260278    VBOXWDDM_HGSMICMD_TYPE_CTL       = 1,
    261 #ifdef VBOXVDMA
     279#ifdef VBOX_WITH_VDMA
    262280    VBOXWDDM_HGSMICMD_TYPE_DMACMD    = 2
    263281#endif
     
    266284VBOXWDDM_HGSMICMD_TYPE vboxWddmHgsmiGetCmdTypeFromOffset(PDEVICE_EXTENSION pDevExt, HGSMIOFFSET offCmd)
    267285{
    268 #ifdef VBOXVDMA
     286#ifdef VBOX_WITH_VDMA
    269287    if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.area, offCmd))
    270288        return VBOXWDDM_HGSMICMD_TYPE_DMACMD;
     
    764782    {
    765783        VBOXSHGSMILIST CtlList;
    766 #ifdef VBOXVDMA
     784#ifdef VBOX_WITH_VDMA
    767785        VBOXSHGSMILIST DmaCmdList;
    768786#endif
    769787        vboxSHGSMIListInit(&CtlList);
    770 #ifdef VBOXVDMA
     788#ifdef VBOX_WITH_VDMA
    771789        vboxSHGSMIListInit(&DmaCmdList);
    772790#endif
     
    793811                    switch (enmType)
    794812                    {
    795 #ifdef VBOXVDMA
     813#ifdef VBOX_WITH_VDMA
    796814                        case VBOXWDDM_HGSMICMD_TYPE_DMACMD:
    797815                            pList = &DmaCmdList;
     
    816834                            switch (chInfo)
    817835                            {
    818 #ifdef VBOXVDMA
     836#ifdef VBOX_WITH_VDMA
    819837                                case VBVA_VDMA_CMD:
    820838                                case VBVA_VDMA_CTL:
     
    855873            bNeedDpc = TRUE;
    856874        }
    857 #ifdef VBOXVDMA
     875#ifdef VBOX_WITH_VDMA
    858876        if (!vboxSHGSMIListIsEmpty(&DmaCmdList))
    859877        {
     
    904922{
    905923    VBOXSHGSMILIST CtlList;
    906 #ifdef VBOXVDMA
     924#ifdef VBOX_WITH_VDMA
    907925    VBOXSHGSMILIST DmaCmdList;
    908926#endif
     
    925943
    926944    vboxSHGSMIListDetach2List(&pdc->pDevExt->CtlList, &pdc->data.CtlList);
    927 #ifdef VBOXVDMA
     945#ifdef VBOX_WITH_VDMA
    928946    vboxSHGSMIListDetach2List(&pdc->pDevExt->DmaCmdList, &pdc->data.DmaCmdList);
    929947#endif
     
    967985        AssertRC(rc);
    968986    }
    969 #ifdef VBOXVDMA
     987#ifdef VBOX_WITH_VDMA
    970988    if (!vboxSHGSMIListIsEmpty(&context.data.DmaCmdList))
    971989    {
     
    19641982            case VBOXVDMACMD_TYPE_DMA_NOP:
    19651983                break;
     1984            case VBOXVDMACMD_TYPE_CHROMIUM_CMD:
     1985            {
     1986                uint8_t * pPrivateBuf = (uint8_t*)pPrivateDataBase;
     1987                for (UINT i = pPatch->PatchLocationListSubmissionStart; i < pPatch->PatchLocationListSubmissionLength; ++i)
     1988                {
     1989                    const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[i];
     1990                    Assert(pPatchList->AllocationIndex < pPatch->AllocationListSize);
     1991                    const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex];
     1992                    Assert(pAllocationList->SegmentId);
     1993                    if (pAllocationList->SegmentId)
     1994                    {
     1995                        DXGK_ALLOCATIONLIST *pAllocation2Patch = (DXGK_ALLOCATIONLIST*)pPrivateBuf + pPatchList->PatchOffset;
     1996                        pAllocation2Patch->SegmentId = pAllocationList->SegmentId;
     1997                        pAllocation2Patch->PhysicalAddress = pAllocationList->PhysicalAddress;
     1998                    }
     1999                }
     2000                break;
     2001            }
    19662002            default:
    19672003            {
     
    20512087                Assert(cNew < UINT32_MAX/2);
    20522088            }
    2053             vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, &pCmd->DdiCmd);
     2089            vboxVdmaDdiCmdCompleted(pDevExt, &pDevExt->DdiCmdQueue, &pCmd->DdiCmd, DXGK_INTERRUPT_DMA_FAULTED);
    20542090        }
    20552091    }
     
    20792115    else
    20802116    {
    2081         Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, u32FenceId);
     2117        Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, u32FenceId, DXGK_INTERRUPT_DMA_FAULTED);
    20822118    }
    20832119
     
    20852121}
    20862122
     2123#ifdef VBOX_WITH_VDMA
     2124DECLCALLBACK(VOID) vboxWddmDmaCompleteChromiumCmd(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext)
     2125{
     2126    PVBOXVDMACBUF_DR pDr = (pDr)pvContext;
     2127    PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD);
     2128    UINT cBufs = pHdr->u32CmdSpecific;
     2129    VBOXVDMACMD_CHROMIUM_CMD *pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHROMIUM_CMD);
     2130    for (UINT i = 0; i < cBufs; ++i)
     2131    {
     2132        VBOXVDMACMD_CHROMIUM_BUFFER *pBufCmd = &pBody->aBuffers[i];
     2133        if (!pBufCmd->u32GuesData)
     2134        {
     2135            /* signal completion */
     2136            PVBOXWDDM_ALLOCATION pAlloc = (PVBOXWDDM_ALLOCATION)pBufCmd->u64GuesData;
     2137            switch (pAlloc->enmSynchType)
     2138            {
     2139                case VBOXUHGSMI_SYNCHOBJECT_TYPE_EVENT:
     2140                    KeSetEvent(pAlloc->pSynchEvent, 3, FALSE);
     2141                    break;
     2142                case VBOXUHGSMI_SYNCHOBJECT_TYPE_SEMAPHORE:
     2143                    KeReleaseSemaphore(pAlloc->pSynchSemaphore,
     2144                        3,
     2145                        1,
     2146                        FALSE);
     2147                    break;
     2148                default:
     2149                    Assert(0);
     2150            }
     2151        }
     2152    }
     2153
     2154    vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDr);
     2155}
     2156
     2157#endif
    20872158NTSTATUS
    20882159APIENTRY
     
    21402211            /* get DPC data at IRQL */
    21412212
    2142             Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId);
     2213            Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);
    21432214            break;
    21442215        }
     
    22512322            if (bComplete)
    22522323            {
    2253                 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId);
     2324                Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);
    22542325            }
    22552326            break;
     2327        }
     2328        case VBOXVDMACMD_TYPE_CHROMIUM_CMD:
     2329        {
     2330#ifdef VBOX_WITH_VDMA
     2331            VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD *pChromiumCmd = (VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD*)pPrivateDataBase;
     2332            UINT cbCmd = VBOXVDMACMD_SIZE_FROMBODYSIZE(RT_OFFSETOF(VBOXVDMACMD_CHROMIUM_CMD, aBuffers[pChromiumCmd->Base.u32CmdReserved]));
     2333
     2334            PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate (&pDevExt->u.primary.Vdma, cbCmd);
     2335            if (!pDr)
     2336            {
     2337                /* @todo: try flushing.. */
     2338                drprintf((__FUNCTION__": vboxVdmaCBufDrCreate returned NULL\n"));
     2339                return STATUS_INSUFFICIENT_RESOURCES;
     2340            }
     2341            // vboxVdmaCBufDrCreate zero initializes the pDr
     2342            pDr->fFlags = VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR;
     2343            pDr->cbBuf = cbCmd;
     2344            pDr->u32FenceId = pSubmitCommand->SubmissionFenceId;
     2345            pDr->rc = VERR_NOT_IMPLEMENTED;
     2346            pDr->u64GuestContext = (uint64_t)pContext;
     2347
     2348            PVBOXVDMACMD pHdr = VBOXVDMACBUF_DR_TAIL(pDr, VBOXVDMACMD);
     2349            pHdr->enmType = VBOXVDMACMD_TYPE_CHROMIUM_CMD;
     2350            pHdr->u32CmdSpecific = pChromiumCmd->Base.u32CmdReserved;
     2351            VBOXVDMACMD_CHROMIUM_CMD *pBody = VBOXVDMACMD_BODY(pHdr, VBOXVDMACMD_CHROMIUM_CMD);
     2352            for (UINT i = 0; i < pChromiumCmd->Base.u32CmdReserved; ++i)
     2353            {
     2354                VBOXVDMACMD_CHROMIUM_BUFFER *pBufCmd = &pBody->aBuffers[i];
     2355                VBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO *pBufInfo = &pChromiumCmd->aBufInfos[i];
     2356
     2357                pBufCmd->offBuffer = pBufInfo->Alloc.offAlloc;
     2358                pBufCmd->cbBuffer = pBufInfo->cbData;
     2359                pBufCmd->u32GuesData = pBufInfo->bDoNotSignalCompletion;
     2360                pBufCmd->u64GuesData = (uint64_t)pBufInfo->Alloc.pAlloc;
     2361            }
     2362
     2363            PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr);
     2364            vboxVdmaDdiCmdInit(pDdiCmd, pSubmitCommand->SubmissionFenceId, pContext, vboxWddmDmaCompleteChromiumCmd, pDr);
     2365            NTSTATUS Status = vboxVdmaDdiCmdSubmitted(pDevExt, &pDevExt->DdiCmdQueue, &pCmd->DdiCmd);
     2366            Assert(Status == STATUS_SUCCESS);
     2367            if (Status == STATUS_SUCCESS)
     2368            {
     2369                int rc = vboxVdmaCBufDrSubmit(pDevExt, &pDevExt->u.primary.Vdma, pDr);
     2370                Assert(rc == VINF_SUCCESS);
     2371            }
     2372            else
     2373            {
     2374                vboxVdmaCBufDrFree(&pDevExt->u.primary.Vdma, pDr);
     2375            }
     2376#else
     2377            Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);
     2378            Assert(Status == STATUS_SUCCESS);
     2379#endif
    22562380        }
    22572381        case VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP:
     
    22752399            else
    22762400            {
    2277                 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId);
     2401                Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_FAULTED);
    22782402                Assert(Status == STATUS_SUCCESS);
    22792403            }
     
    23032427            else
    23042428            {
    2305                 Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId);
     2429                Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_FAULTED);
    23062430                Assert(Status == STATUS_SUCCESS);
    23072431            }
     
    23112435        case VBOXVDMACMD_TYPE_DMA_NOP:
    23122436        {
    2313             Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId);
     2437            Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext, pSubmitCommand->SubmissionFenceId, DXGK_INTERRUPT_DMA_COMPLETED);
    23142438            Assert(Status == STATUS_SUCCESS);
    23152439            break;
     
    23182442        {
    23192443            AssertBreakpoint();
    2320 #ifdef VBOXVDMA
     2444#ifdef VBOX_WITH_VDMA
    23212445            VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR *pPrivateData = (VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR*)pPrivateDataBase;
    23222446            PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate (&pDevExt->u.primary.Vdma, 0);
     
    33843508                    }
    33853509                }
    3386 #ifdef VBOXVDMA
     3510#ifdef VBOX_WITH_VDMA
    33873511                else
    33883512                {
     
    38353959        return STATUS_INVALID_PARAMETER;
    38363960    }
    3837 
     3961    if (pRender->CommandLength < sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))
     3962    {
     3963        Assert(0);
     3964        drprintf((__FUNCTION__": Present->DmaBufferPrivateDataSize(%d) < sizeof VBOXWDDM_DMA_PRIVATEDATA_BASEHDR (%d)\n",
     3965                pRender->DmaBufferPrivateDataSize , sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR)));
     3966        /* @todo: can this actually happen? what status to return? */
     3967        return STATUS_INVALID_PARAMETER;
     3968    }
     3969
     3970    PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR pInputHdr = (PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR)pRender->pCommand;
    38383971    NTSTATUS Status = STATUS_SUCCESS;
    3839     PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR pPrivateData = (PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR)pRender->pDmaBufferPrivateData;
    3840     pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_NOP;
    3841 
    3842     pRender->pDmaBufferPrivateData = (uint8_t*)pRender->pDmaBufferPrivateData + sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR);
    3843     pRender->pDmaBuffer = ((uint8_t*)pRender->pDmaBuffer) + pRender->CommandLength;
    3844     Assert(pRender->DmaSize >= pRender->CommandLength);
    3845     Assert(pRender->PatchLocationListOutSize >= pRender->PatchLocationListInSize);
    3846     UINT cbPLL = pRender->PatchLocationListInSize * sizeof (pRender->pPatchLocationListOut[0]);
    3847     memcpy(pRender->pPatchLocationListOut, pRender->pPatchLocationListIn, cbPLL);
    3848     pRender->pPatchLocationListOut += pRender->PatchLocationListInSize;
     3972    switch (pInputHdr->enmCmd)
     3973    {
     3974        case VBOXVDMACMD_TYPE_CHROMIUM_CMD:
     3975        {
     3976            if (pRender->CommandLength != RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD, aBufInfos[pInputHdr->u32CmdReserved]))
     3977            {
     3978                Assert(0);
     3979                return STATUS_INVALID_PARAMETER;
     3980            }
     3981            PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD pUmCmd = (PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD)pInputHdr;
     3982            PVBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD pChromiumCmd = (PVBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD)pRender->pDmaBufferPrivateData;
     3983            const uint32_t cbDma = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD, aBufInfos[pInputHdr->u32CmdReserved]);
     3984            if (pRender->DmaBufferPrivateDataSize < cbDma)
     3985            {
     3986                Assert(0);
     3987                return STATUS_INVALID_PARAMETER;
     3988            }
     3989            if (pRender->DmaSize < cbDma)
     3990            {
     3991                Assert(0);
     3992                return STATUS_INVALID_PARAMETER;
     3993            }
     3994
     3995            if (pRender->PatchLocationListOutSize < pInputHdr->u32CmdReserved)
     3996            {
     3997                Assert(0);
     3998                return STATUS_INVALID_PARAMETER;
     3999            }
     4000
     4001            PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext;
     4002            PVBOXWDDM_DEVICE pDevice = pContext->pDevice;
     4003            PDEVICE_EXTENSION pDevExt = pDevice->pAdapter;
     4004
     4005            pChromiumCmd->Base.enmCmd = VBOXVDMACMD_TYPE_CHROMIUM_CMD;
     4006            pChromiumCmd->Base.u32CmdReserved = pInputHdr->u32CmdReserved;
     4007            pRender->pDmaBufferPrivateData = (uint8_t*)pRender->pDmaBufferPrivateData + cbDma;
     4008            pRender->pDmaBuffer = ((uint8_t*)pRender->pDmaBuffer) + cbDma;
     4009            D3DDDI_PATCHLOCATIONLIST* pPLL = pRender->pPatchLocationListOut;
     4010            memset(pPLL, 0, sizeof (*pPLL) * pChromiumCmd->Base.u32CmdReserved);
     4011            pRender->pPatchLocationListOut += pInputHdr->u32CmdReserved;
     4012            PVBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO pSubmInfo = pChromiumCmd->aBufInfos;
     4013            PVBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO pSubmUmInfo = pUmCmd->aBufInfos;
     4014            DXGK_ALLOCATIONLIST *pAllocationList = pRender->pAllocationList;
     4015            for (UINT i = 0; i < pChromiumCmd->Base.u32CmdReserved; ++i)
     4016            {
     4017                PVBOXWDDM_ALLOCATION pAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pAllocationList);
     4018                vboxWddmPopulateDmaAllocInfo(&pSubmInfo->Alloc, pAlloc, pAllocationList);
     4019
     4020                pSubmInfo->cbData = pSubmUmInfo->cbData;
     4021                pSubmInfo->bDoNotSignalCompletion = pSubmUmInfo->fSubFlags.bDoNotSignalCompletion;
     4022
     4023                pPLL->AllocationIndex = i;
     4024                pPLL->PatchOffset = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD, aBufInfos[i].Alloc);
     4025                pPLL->AllocationOffset = pSubmUmInfo->offData;
     4026
     4027                ++pPLL;
     4028                ++pSubmInfo;
     4029                ++pSubmUmInfo;
     4030                ++pAllocationList;
     4031            }
     4032
     4033            break;
     4034        }
     4035        case VBOXVDMACMD_TYPE_DMA_NOP:
     4036        {
     4037            PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR pPrivateData = (PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR)pRender->pDmaBufferPrivateData;
     4038            pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_NOP;
     4039
     4040            pRender->pDmaBufferPrivateData = (uint8_t*)pRender->pDmaBufferPrivateData + sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR);
     4041            pRender->pDmaBuffer = ((uint8_t*)pRender->pDmaBuffer) + pRender->CommandLength;
     4042            Assert(pRender->DmaSize >= pRender->CommandLength);
     4043            Assert(pRender->PatchLocationListOutSize >= pRender->PatchLocationListInSize);
     4044            UINT cbPLL = pRender->PatchLocationListInSize * sizeof (pRender->pPatchLocationListOut[0]);
     4045            memcpy(pRender->pPatchLocationListOut, pRender->pPatchLocationListIn, cbPLL);
     4046            pRender->pPatchLocationListOut += pRender->PatchLocationListInSize;
     4047            break;
     4048        }
     4049        default:
     4050            return STATUS_INVALID_PARAMETER;
     4051    }
    38494052
    38504053    drprintf(("<== "__FUNCTION__ ", hContext(0x%x)\n", hContext));
     
    38564059#define VBOXVDMACMD_DMA_PRESENT_BLT_SIZE(_c) (VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, aDstSubRects[_c]))
    38574060
    3858 DECLINLINE(PVBOXWDDM_ALLOCATION) vboxWddmGetAllocationFromAllocList(PDEVICE_EXTENSION pDevExt, DXGK_ALLOCATIONLIST *pAllocList)
    3859 {
    3860     return vboxWddmGetAllocationFromOpenData(pDevExt, (PVBOXWDDM_OPENALLOCATION)pAllocList->hDeviceSpecificAllocation);
    3861 }
    3862 
    3863 #ifdef VBOXVDMA
     4061#ifdef VBOX_WITH_VDMA
    38644062DECLINLINE(VOID) vboxWddmRectlFromRect(const RECT *pRect, PVBOXVDMA_RECTL pRectl)
    38654063{
     
    39164114#endif
    39174115
    3918 static void vboxWddmPopulateDmaAllocInfo(PVBOXWDDM_DMA_ALLOCINFO pInfo, PVBOXWDDM_ALLOCATION pAlloc, DXGK_ALLOCATIONLIST *pDmaAlloc)
    3919 {
    3920     pInfo->pAlloc = pAlloc;
    3921     if (pDmaAlloc->SegmentId)
    3922     {
    3923         pInfo->offAlloc = (VBOXVIDEOOFFSET)pDmaAlloc->PhysicalAddress.QuadPart;
    3924         pInfo->segmentIdAlloc = pDmaAlloc->SegmentId;
    3925     }
    3926     else
    3927         pInfo->segmentIdAlloc = 0;
    3928     pInfo->srcId = pAlloc->SurfDesc.VidPnSourceId;
    3929 }
    39304116/**
    39314117 * DxgkDdiPresent
     
    41094295
    41104296                    break;
    4111 #ifdef VBOXVDMA
     4297#ifdef VBOX_WITH_VDMA
    41124298                    cbCmd = pPresent->DmaSize;
    41134299
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h

    r32823 r32877  
    2424#define VBOXWDDM_C_POINTER_MAX_HEIGHT 64
    2525
    26 #ifdef VBOXVDMA
     26#ifdef VBOX_WITH_VDMA
    2727#define VBOXWDDM_C_VDMA_BUFFER_SIZE   (64*_1K)
    2828#endif
    2929
    3030#ifndef VBOXWDDM_RENDER_FROM_SHADOW
    31 # ifndef VBOXVDMA
    32 #  error "VBOXVDMA must be defined!!!"
     31# ifndef VBOX_WITH_VDMA
     32#  error "VBOX_WITH_VDMA must be defined!!!"
    3333# endif
    3434#endif
     
    7676    DXGK_ALLOCATIONUSAGEHINT UsageHint;
    7777    uint32_t iIndex;
     78    VBOXUHGSMI_SYNCHOBJECT_TYPE enmSynchType;
     79    union
     80    {
     81        PKEVENT pSynchEvent;
     82        PRKSEMAPHORE pSynchSemaphore;
     83    };
    7884} VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
    7985
     
    164170#define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry)))
    165171
    166 typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLAFS
    167 {
    168     union
    169     {
    170         struct
    171         {
    172             UINT bCmdInDmaBuffer : 1;
    173             UINT bReserved : 31;
    174         };
    175         uint32_t Value;
    176     };
    177 } VBOXWDDM_DMA_PRIVATEDATA_FLAFS, *PVBOXWDDM_DMA_PRIVATEDATA_FLAFS;
    178 
    179 typedef struct VBOXWDDM_DMA_PRIVATEDATA_BASEHDR
    180 {
    181     VBOXVDMACMD_TYPE enmCmd;
    182     union
    183     {
    184         VBOXWDDM_DMA_PRIVATEDATA_FLAFS fFlags;
    185         uint32_t u32CmdReserved;
    186     };
    187 }VBOXWDDM_DMA_PRIVATEDATA_BASEHDR, *PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR;
    188 
    189172typedef struct VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR
    190173{
     
    219202    VBOXVDMA_CLRFILL ClrFill;
    220203} VBOXWDDM_DMA_PRIVATEDATA_CLRFILL, *PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL;
     204
     205typedef struct VBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO
     206{
     207    VBOXWDDM_DMA_ALLOCINFO Alloc;
     208    uint32_t cbData;
     209    uint32_t bDoNotSignalCompletion;
     210} VBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO, *PVBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO;
     211
     212typedef struct VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD
     213{
     214    VBOXWDDM_DMA_PRIVATEDATA_BASEHDR Base;
     215    VBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO aBufInfos[1];
     216} VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD, *PVBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD;
    221217
    222218typedef struct VBOXWDDM_OPENALLOCATION
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