VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h@ 31713

Last change on this file since 31713 was 30973, checked in by vboxsync, 14 years ago

wddm/2d: bugfixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1/*
2 * Copyright (C) 2010 Oracle Corporation
3 *
4 * This file is part of VirtualBox Open Source Edition (OSE), as
5 * available from http://www.virtualbox.org. This file is free software;
6 * you can redistribute it and/or modify it under the terms of the GNU
7 * General Public License (GPL) as published by the Free Software
8 * Foundation, in version 2 as it comes in the "COPYING" file of the
9 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
10 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
11 */
12#ifndef ___VBoxVideoWddm_h___
13#define ___VBoxVideoWddm_h___
14
15#include "../VBoxVideo.h"
16
17/* one page size */
18#define VBOXWDDM_C_DMA_BUFFER_SIZE 0x1000
19#define VBOXWDDM_C_DMA_PRIVATEDATA_SIZE 0x4000
20#define VBOXWDDM_C_ALLOC_LIST_SIZE 0xc00
21#define VBOXWDDM_C_PATH_LOCATION_LIST_SIZE 0xc00
22
23#define VBOXWDDM_C_POINTER_MAX_WIDTH 64
24#define VBOXWDDM_C_POINTER_MAX_HEIGHT 64
25
26#define VBOXWDDM_C_VDMA_BUFFER_SIZE (64*_1K)
27
28#ifdef VBOXWDDM_WITH_VBVA
29# define VBOXWDDM_RENDER_FROM_SHADOW
30#endif
31
32#ifndef DEBUG_misha
33# ifdef Assert
34# undef Assert
35# define Assert(_a) do{}while(0)
36# endif
37# ifdef AssertBreakpoint
38# undef AssertBreakpoint
39# define AssertBreakpoint() do{}while(0)
40# endif
41# ifdef AssertFailed
42# undef AssertFailed
43# define AssertFailed() do{}while(0)
44# endif
45#endif
46
47PVOID vboxWddmMemAlloc(IN SIZE_T cbSize);
48PVOID vboxWddmMemAllocZero(IN SIZE_T cbSize);
49VOID vboxWddmMemFree(PVOID pvMem);
50
51NTSTATUS vboxWddmDmaCmdNotifyCompletion(PDEVICE_EXTENSION pDevExt, struct VBOXWDDM_CONTEXT *pContext, UINT SubmissionFenceId);
52NTSTATUS vboxWddmCallIsr(PDEVICE_EXTENSION pDevExt);
53
54/* allocation */
55//#define VBOXWDDM_ALLOCATIONINDEX_VOID (~0U)
56typedef struct VBOXWDDM_ALLOCATION
57{
58 VBOXWDDM_ALLOC_TYPE enmType;
59// VBOXWDDM_ALLOCUSAGE_TYPE enmCurrentUsage;
60 D3DDDI_RESOURCEFLAGS fRcFlags;
61 UINT SegmentId;
62 VBOXVIDEOOFFSET offVram;
63#ifdef VBOX_WITH_VIDEOHWACCEL
64 VBOXVHWA_SURFHANDLE hHostHandle;
65#endif
66 BOOLEAN bVisible;
67 BOOLEAN bAssigned;
68 VBOXWDDM_SURFACE_DESC SurfDesc;
69 struct VBOXWDDM_RESOURCE *pResource;
70 /* to return to the Runtime on DxgkDdiCreateAllocation */
71 DXGK_ALLOCATIONUSAGEHINT UsageHint;
72 uint32_t iIndex;
73} VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
74
75typedef struct VBOXWDDM_RESOURCE
76{
77 uint32_t fFlags;
78 VBOXWDDM_RC_DESC RcDesc;
79 uint32_t cAllocations;
80 VBOXWDDM_ALLOCATION aAllocations[1];
81} VBOXWDDM_RESOURCE, *PVBOXWDDM_RESOURCE;
82
83DECLINLINE(PVBOXWDDM_RESOURCE) vboxWddmResourceForAlloc(PVBOXWDDM_ALLOCATION pAlloc)
84{
85#if 0
86 if(pAlloc->iIndex == VBOXWDDM_ALLOCATIONINDEX_VOID)
87 return NULL;
88 PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)(((uint8_t*)pAlloc) - RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pAlloc->iIndex]));
89 return pRc;
90#else
91 return pAlloc->pResource;
92#endif
93}
94
95typedef struct VBOXWDDM_OVERLAY
96{
97 PDEVICE_EXTENSION pDevExt;
98 PVBOXWDDM_RESOURCE pResource;
99 PVBOXWDDM_ALLOCATION pCurentAlloc;
100 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
101} VBOXWDDM_OVERLAY, *PVBOXWDDM_OVERLAY;
102
103typedef enum
104{
105 VBOXWDDM_DEVICE_TYPE_UNDEFINED = 0,
106 VBOXWDDM_DEVICE_TYPE_SYSTEM
107} VBOXWDDM_DEVICE_TYPE;
108
109typedef struct VBOXWDDM_DEVICE
110{
111 struct _DEVICE_EXTENSION * pAdapter; /* Adapder info */
112 HANDLE hDevice; /* handle passed to CreateDevice */
113 VBOXWDDM_DEVICE_TYPE enmType; /* device creation flags passed to DxgkDdiCreateDevice, not sure we need it */
114} VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE;
115
116typedef enum
117{
118 VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0,
119 VBOXWDDM_CONTEXT_TYPE_SYSTEM,
120 VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D,
121 VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D
122} VBOXWDDM_CONTEXT_TYPE;
123
124typedef struct VBOXWDDM_CONTEXT
125{
126 LIST_ENTRY ListEntry;
127 struct VBOXWDDM_DEVICE * pDevice;
128 HANDLE hContext;
129 VBOXWDDM_CONTEXT_TYPE enmType;
130 UINT NodeOrdinal;
131 UINT EngineAffinity;
132 UINT uLastCompletedCmdFenceId;
133 RECT ViewRect;
134 PVBOXVIDEOCM_CMD_RECTS pLastReportedRects;
135 VBOXVIDEOCM_CTX CmContext;
136} VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
137
138#define VBOXWDDMENTRY_2_CONTEXT(_pE) ((PVBOXWDDM_CONTEXT)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_CONTEXT, ListEntry)))
139
140typedef struct VBOXWDDM_DMA_ALLOCINFO
141{
142 PVBOXWDDM_ALLOCATION pAlloc;
143 VBOXVIDEOOFFSET offAlloc;
144 UINT segmentIdAlloc;
145 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
146} VBOXWDDM_DMA_ALLOCINFO, *PVBOXWDDM_DMA_ALLOCINFO;
147
148typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLAFS
149{
150 union
151 {
152 struct
153 {
154 UINT bCmdInDmaBuffer : 1;
155 UINT bReserved : 31;
156 };
157 uint32_t Value;
158 };
159} VBOXWDDM_DMA_PRIVATEDATA_FLAFS, *PVBOXWDDM_DMA_PRIVATEDATA_FLAFS;
160
161typedef struct VBOXWDDM_DMA_PRIVATEDATA_HDR
162{
163 PVBOXWDDM_CONTEXT pContext;
164 VBOXWDDM_DMA_PRIVATEDATA_FLAFS fFlags;
165 VBOXVDMACMD_TYPE enmCmd;
166 VBOXWDDM_DMA_ALLOCINFO SrcAllocInfo;
167 VBOXWDDM_DMA_ALLOCINFO DstAllocInfo;
168}VBOXWDDM_DMA_PRIVATEDATA_HDR, *PVBOXWDDM_DMA_PRIVATEDATA_HDR;
169
170#ifdef VBOXWDDM_RENDER_FROM_SHADOW
171
172typedef struct VBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW
173{
174 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
175 RECT rect;
176} VBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW, *PVBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW;
177
178#endif
179
180typedef struct VBOXWDDM_DMA_PRESENT_BLT
181{
182 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
183 RECT SrcRect;
184 VBOXVDMAPIPE_RECTS DstRects;
185}VBOXWDDM_DMA_PRESENT_BLT, *PVBOXWDDM_DMA_PRESENT_BLT;
186
187typedef struct VBOXVDMACMD_DMA_PRESENT_FLIP
188{
189 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
190} VBOXVDMACMD_DMA_PRESENT_FLIP, *PVBOXVDMACMD_DMA_PRESENT_FLIP;
191
192typedef struct VBOXWDDM_DMA_PRESENT_CLRFILL
193{
194 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
195 UINT Color;
196 VBOXWDDM_RECTS_INFO Rects;
197} VBOXWDDM_DMA_PRESENT_CLRFILL, *PVBOXWDDM_DMA_PRESENT_CLRFILL;
198
199typedef struct VBOXWDDM_OPENALLOCATION
200{
201 D3DKMT_HANDLE hAllocation;
202} VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION;
203
204#ifdef VBOXWDDM_RENDER_FROM_SHADOW
205# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pShadowAllocation)
206#else
207# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pPrimaryAllocation)
208#endif
209
210//DECLINLINE(VBOXVIDEOOFFSET) vboxWddmOffsetFromPhAddress(PHYSICAL_ADDRESS phAddr)
211//{
212// return (VBOXVIDEOOFFSET)(phAddr.QuadPart ? phAddr.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS : VBOXVIDEOOFFSET_VOID);
213//}
214
215#endif /* #ifndef ___VBoxVideoWddm_h___ */
Note: See TracBrowser for help on using the repository browser.

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