Changeset 32823 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h
- Timestamp:
- Sep 29, 2010 4:50:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h
r32496 r32823 14 14 15 15 #include <iprt/cdefs.h> 16 #include <iprt/asm.h> 16 17 #include <VBox/VBoxVideo.h> 17 18 #include "../VBoxVideo.h" 19 20 /* ddi dma command queue handling */ 21 typedef 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 30 typedef struct VBOXVDMADDI_CMD *PVBOXVDMADDI_CMD; 31 typedef DECLCALLBACK(VOID) FNVBOXVDMADDICMDCOMPLETE_DPC(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext); 32 typedef FNVBOXVDMADDICMDCOMPLETE_DPC *PFNVBOXVDMADDICMDCOMPLETE_DPC; 33 34 typedef 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 44 typedef 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 51 VOID vboxVdmaDdiQueueInit(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue); 52 BOOLEAN vboxVdmaDdiCmdCompletedIrq(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd); 53 VOID vboxVdmaDdiCmdSubmittedIrq(PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd); 54 55 NTSTATUS vboxVdmaDdiCmdCompleted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd); 56 NTSTATUS vboxVdmaDdiCmdSubmitted(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD_QUEUE pQueue, PVBOXVDMADDI_CMD pCmd); 57 58 DECLINLINE(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 71 NTSTATUS vboxVdmaDdiCmdFenceComplete(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, uint32_t u32FenceId); 72 73 DECLCALLBACK(VOID) vboxVdmaDdiCmdCompletionCbFree(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext); 74 75 DECLINLINE(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 82 DECLINLINE(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 95 NTSTATUS vboxVdmaHlpUpdatePrimary(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, RECT* pRect); 96 #endif 18 97 19 98 #if 0 … … 57 136 { 58 137 VBOXVDMAPIPE_CMD_TYPE_UNDEFINED = 0, 59 VBOXVDMAPIPE_CMD_TYPE_RECTSINFO = 1,60 VBOXVDMAPIPE_CMD_TYPE_DMACMD _CLRFILL = 2138 VBOXVDMAPIPE_CMD_TYPE_RECTSINFO, 139 VBOXVDMAPIPE_CMD_TYPE_DMACMD 61 140 } VBOXVDMAPIPE_CMD_TYPE; 62 141 … … 69 148 #define VBOXVDMAPIPE_CMD_DR_FROM_ENTRY(_pE) ( (PVBOXVDMAPIPE_CMD_DR)VBOXVDMAPIPE_CMD_HDR_FROM_ENTRY(_pE) ) 70 149 150 typedef 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 71 158 typedef struct VBOXVDMAPIPE_RECTS 72 159 { … … 78 165 { 79 166 VBOXVDMAPIPE_CMD_DR Hdr; 80 struct VBOXWDDM_CONTEXT *pContext;167 VBOXVDMADDI_CMD DdiCmd; 81 168 struct VBOXWDDM_SWAPCHAIN *pSwapchain; 82 169 VBOXVDMAPIPE_RECTS ContextsRects; 83 170 } VBOXVDMAPIPE_CMD_RECTSINFO, *PVBOXVDMAPIPE_CMD_RECTSINFO; 84 171 85 typedef struct VBOXVDMAPIPE_CMD_DMACMD_CLRFILL 172 typedef 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; 186 typedef struct VBOXVDMAPIPE_CMD_DMACMD 86 187 { 87 188 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 195 typedef struct VBOXVDMA_CLRFILL 196 { 197 VBOXWDDM_DMA_ALLOCINFO Alloc; 92 198 UINT Color; 93 199 VBOXWDDM_RECTS_INFO Rects; 200 } VBOXVDMA_CLRFILL, *PVBOXVDMA_CLRFILL; 201 202 typedef struct VBOXVDMAPIPE_CMD_DMACMD_CLRFILL 203 { 204 VBOXVDMAPIPE_CMD_DMACMD Hdr; 205 VBOXVDMA_CLRFILL ClrFill; 94 206 } VBOXVDMAPIPE_CMD_DMACMD_CLRFILL, *PVBOXVDMAPIPE_CMD_DMACMD_CLRFILL; 207 208 typedef 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 216 typedef 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 222 typedef struct VBOXVDMA_FLIP 223 { 224 VBOXWDDM_DMA_ALLOCINFO Alloc; 225 } VBOXVDMA_FLIP, *PVBOXVDMA_FLIP; 226 227 typedef 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 233 typedef struct VBOXVDMA_SHADOW2PRIMARY 234 { 235 VBOXWDDM_DMA_ALLOCINFO ShadowAlloc; 236 RECT SrcRect; 237 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 238 } VBOXVDMA_SHADOW2PRIMARY, *PVBOXVDMA_SHADOW2PRIMARY; 95 239 96 240 typedef struct VBOXVDMAGG … … 141 285 void vboxVdmaGgCmdDestroy(PVBOXVDMAPIPE_CMD_DR pDr); 142 286 287 #define VBOXVDMAPIPE_CMD_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMAPIPE_CMD_DR)(((uint8_t*)(_pCmd)) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_DR, DdiCmd))) 288 DECLCALLBACK(VOID) vboxVdmaGgDdiCmdDestroy(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext); 289 143 290 #endif /* #ifndef ___VBoxVideoVdma_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.