VirtualBox

Ignore:
Timestamp:
Sep 29, 2010 4:50:53 PM (14 years ago)
Author:
vboxsync
Message:

wddm/2d: 2D video accel support fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h

    r32496 r32823  
    1414
    1515#include <iprt/cdefs.h>
     16#include <iprt/asm.h>
    1617#include <VBox/VBoxVideo.h>
    1718#include "../VBoxVideo.h"
     19
     20/* ddi dma command queue handling */
     21typedef enum
     22{
     23    VBOXVDMADDI_STATE_UNCKNOWN = 0,
     24    VBOXVDMADDI_STATE_NOT_QUEUED,
     25    VBOXVDMADDI_STATE_PENDING,
     26    VBOXVDMADDI_STATE_SUBMITTED,
     27    VBOXVDMADDI_STATE_COMPLETED
     28} VBOXVDMADDI_STATE;
     29
     30typedef struct VBOXVDMADDI_CMD *PVBOXVDMADDI_CMD;
     31typedef DECLCALLBACK(VOID) FNVBOXVDMADDICMDCOMPLETE_DPC(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext);
     32typedef FNVBOXVDMADDICMDCOMPLETE_DPC *PFNVBOXVDMADDICMDCOMPLETE_DPC;
     33
     34typedef struct VBOXVDMADDI_CMD
     35{
     36    LIST_ENTRY QueueEntry;
     37    VBOXVDMADDI_STATE enmState;
     38    uint32_t u32FenceId;
     39    PVBOXWDDM_CONTEXT pContext;
     40    PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete;
     41    PVOID pvComplete;
     42} VBOXVDMADDI_CMD, *PVBOXVDMADDI_CMD;
     43
     44typedef struct VBOXVDMADDI_CMD_QUEUE
     45{
     46    volatile uint32_t cQueuedCmds;
     47    LIST_ENTRY CmdQueue;
     48    LIST_ENTRY DpcCmdQueue;
     49} VBOXVDMADDI_CMD_QUEUE, *PVBOXVDMADDI_CMD_QUEUE;
     50
     51VOID vboxVdmaDdiQueueInit(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue);
     52BOOLEAN vboxVdmaDdiCmdCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
     53VOID vboxVdmaDdiCmdSubmittedIrq(PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
     54
     55NTSTATUS vboxVdmaDdiCmdCompleted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
     56NTSTATUS vboxVdmaDdiCmdSubmitted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd);
     57
     58DECLINLINE(VOID) vboxVdmaDdiCmdInit(PVBOXVDMADDI_CMD pCmd,
     59        uint32_t u32FenceId, PVBOXWDDM_CONTEXT pContext,
     60        PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete)
     61{
     62    pCmd->QueueEntry.Blink = NULL;
     63    pCmd->QueueEntry.Flink = NULL;
     64    pCmd->enmState = VBOXVDMADDI_STATE_NOT_QUEUED;
     65    pCmd->u32FenceId = u32FenceId;
     66    pCmd->pContext = pContext;
     67    pCmd->pfnComplete = pfnComplete;
     68    pCmd->pvComplete = pvComplete;
     69}
     70
     71NTSTATUS vboxVdmaDdiCmdFenceComplete(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId);
     72
     73DECLCALLBACK(VOID) vboxVdmaDdiCmdCompletionCbFree(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext);
     74
     75DECLINLINE(VOID) vboxVdmaDdiCmdGetCompletedListIsr(PVBOXVDMADDI_CMD_QUEUE pQueue, LIST_ENTRY *pList)
     76{
     77    vboxVideoLeDetach(&pQueue->DpcCmdQueue, pList);
     78}
     79
     80#define VBOXVDMADDI_CMD_FROM_ENTRY(_pEntry) ((PVBOXVDMADDI_CMD)(((uint8_t*)(_pEntry)) - RT_OFFSETOF(VBOXVDMADDI_CMD, QueueEntry)))
     81
     82DECLINLINE(VOID) vboxVdmaDdiCmdHandleCompletedList(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, LIST_ENTRY *pList)
     83{
     84    LIST_ENTRY *pEntry = pList->Flink;
     85    while (pEntry != pList)
     86    {
     87        PVBOXVDMADDI_CMD pCmd = VBOXVDMADDI_CMD_FROM_ENTRY(pEntry);
     88        pEntry = pEntry->Flink;
     89        if (pCmd->pfnComplete)
     90            pCmd->pfnComplete(pDevExt, pCmd, pCmd->pvComplete);
     91    }
     92}
     93
     94#ifdef VBOXWDDM_RENDER_FROM_SHADOW
     95NTSTATUS vboxVdmaHlpUpdatePrimary(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, RECT* pRect);
     96#endif
    1897
    1998#if 0
     
    57136{
    58137    VBOXVDMAPIPE_CMD_TYPE_UNDEFINED = 0,
    59     VBOXVDMAPIPE_CMD_TYPE_RECTSINFO = 1,
    60     VBOXVDMAPIPE_CMD_TYPE_DMACMD_CLRFILL    = 2
     138    VBOXVDMAPIPE_CMD_TYPE_RECTSINFO,
     139    VBOXVDMAPIPE_CMD_TYPE_DMACMD
    61140} VBOXVDMAPIPE_CMD_TYPE;
    62141
     
    69148#define VBOXVDMAPIPE_CMD_DR_FROM_ENTRY(_pE)  ( (PVBOXVDMAPIPE_CMD_DR)VBOXVDMAPIPE_CMD_HDR_FROM_ENTRY(_pE) )
    70149
     150typedef struct VBOXWDDM_DMA_ALLOCINFO
     151{
     152    PVBOXWDDM_ALLOCATION pAlloc;
     153    VBOXVIDEOOFFSET offAlloc;
     154    UINT segmentIdAlloc;
     155    D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
     156} VBOXWDDM_DMA_ALLOCINFO, *PVBOXWDDM_DMA_ALLOCINFO;
     157
    71158typedef struct VBOXVDMAPIPE_RECTS
    72159{
     
    78165{
    79166    VBOXVDMAPIPE_CMD_DR Hdr;
    80     struct VBOXWDDM_CONTEXT *pContext;
     167    VBOXVDMADDI_CMD DdiCmd;
    81168    struct VBOXWDDM_SWAPCHAIN *pSwapchain;
    82169    VBOXVDMAPIPE_RECTS ContextsRects;
    83170} VBOXVDMAPIPE_CMD_RECTSINFO, *PVBOXVDMAPIPE_CMD_RECTSINFO;
    84171
    85 typedef struct VBOXVDMAPIPE_CMD_DMACMD_CLRFILL
     172typedef struct VBOXVDMAPIPE_FLAGS_DMACMD
     173{
     174    union
     175    {
     176        struct
     177        {
     178            UINT b2DRelated     : 1;
     179            UINT b3DRelated     : 1;
     180            UINT bDecVBVAUnlock : 1;
     181            UINT Reserved       : 29;
     182        };
     183        UINT Value;
     184    };
     185} VBOXVDMAPIPE_FLAGS_DMACMD, *PVBOXVDMAPIPE_FLAGS_DMACMD;
     186typedef struct VBOXVDMAPIPE_CMD_DMACMD
    86187{
    87188    VBOXVDMAPIPE_CMD_DR Hdr;
    88     struct VBOXWDDM_CONTEXT *pContext;
    89     struct VBOXWDDM_ALLOCATION *pAllocation;
    90     UINT SubmissionFenceId;
    91     D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
     189    VBOXVDMADDI_CMD DdiCmd;
     190    PDEVICE_EXTENSION pDevExt;
     191    VBOXVDMACMD_TYPE enmCmd;
     192    VBOXVDMAPIPE_FLAGS_DMACMD fFlags;
     193} VBOXVDMAPIPE_CMD_DMACMD, *PVBOXVDMAPIPE_CMD_DMACMD;
     194
     195typedef struct VBOXVDMA_CLRFILL
     196{
     197    VBOXWDDM_DMA_ALLOCINFO Alloc;
    92198    UINT Color;
    93199    VBOXWDDM_RECTS_INFO Rects;
     200} VBOXVDMA_CLRFILL, *PVBOXVDMA_CLRFILL;
     201
     202typedef struct VBOXVDMAPIPE_CMD_DMACMD_CLRFILL
     203{
     204    VBOXVDMAPIPE_CMD_DMACMD Hdr;
     205    VBOXVDMA_CLRFILL ClrFill;
    94206} VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, *PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL;
     207
     208typedef struct VBOXVDMA_BLT
     209{
     210    VBOXWDDM_DMA_ALLOCINFO SrcAlloc;
     211    VBOXWDDM_DMA_ALLOCINFO DstAlloc;
     212    RECT SrcRect;
     213    VBOXVDMAPIPE_RECTS DstRects;
     214} VBOXVDMA_BLT, *PVBOXVDMA_BLT;
     215
     216typedef struct VBOXVDMAPIPE_CMD_DMACMD_BLT
     217{
     218    VBOXVDMAPIPE_CMD_DMACMD Hdr;
     219    VBOXVDMA_BLT Blt;
     220} VBOXVDMAPIPE_CMD_DMACMD_BLT, *PVBOXVDMAPIPE_CMD_DMACMD_BLT;
     221
     222typedef struct VBOXVDMA_FLIP
     223{
     224    VBOXWDDM_DMA_ALLOCINFO Alloc;
     225} VBOXVDMA_FLIP, *PVBOXVDMA_FLIP;
     226
     227typedef struct VBOXVDMAPIPE_CMD_DMACMD_FLIP
     228{
     229    VBOXVDMAPIPE_CMD_DMACMD Hdr;
     230    VBOXVDMA_FLIP Flip;
     231} VBOXVDMAPIPE_CMD_DMACMD_FLIP, *PVBOXVDMAPIPE_CMD_DMACMD_FLIP;
     232
     233typedef struct VBOXVDMA_SHADOW2PRIMARY
     234{
     235    VBOXWDDM_DMA_ALLOCINFO ShadowAlloc;
     236    RECT SrcRect;
     237    D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
     238} VBOXVDMA_SHADOW2PRIMARY, *PVBOXVDMA_SHADOW2PRIMARY;
    95239
    96240typedef struct VBOXVDMAGG
     
    141285void vboxVdmaGgCmdDestroy(PVBOXVDMAPIPE_CMD_DR pDr);
    142286
     287#define VBOXVDMAPIPE_CMD_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMAPIPE_CMD_DR)(((uint8_t*)(_pCmd)) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_DR, DdiCmd)))
     288DECLCALLBACK(VOID) vboxVdmaGgDdiCmdDestroy(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext);
     289
    143290#endif /* #ifndef ___VBoxVideoVdma_h___ */
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