VirtualBox

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

Last change on this file since 30462 was 30441, checked in by vboxsync, 14 years ago

wddm/3d: more visible rects support & fixes, enhances to dma command handling

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 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
51/* allocation */
52//#define VBOXWDDM_ALLOCATIONINDEX_VOID (~0U)
53typedef struct VBOXWDDM_ALLOCATION
54{
55 VBOXWDDM_ALLOC_TYPE enmType;
56// D3DDDI_RESOURCEFLAGS fRcFlags;
57 UINT SegmentId;
58 VBOXVIDEOOFFSET offVram;
59#ifdef VBOX_WITH_VIDEOHWACCEL
60 VBOXVHWA_SURFHANDLE hHostHandle;
61#endif
62 BOOLEAN bVisible;
63 BOOLEAN bAssigned;
64 VBOXWDDM_SURFACE_DESC SurfDesc;
65 struct VBOXWDDM_RESOURCE *pResource;
66 /* to return to the Runtime on DxgkDdiCreateAllocation */
67 DXGK_ALLOCATIONUSAGEHINT UsageHint;
68 uint32_t iIndex;
69} VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
70
71typedef struct VBOXWDDM_RESOURCE
72{
73 uint32_t fFlags;
74 VBOXWDDM_RC_DESC RcDesc;
75 uint32_t cAllocations;
76 VBOXWDDM_ALLOCATION aAllocations[1];
77} VBOXWDDM_RESOURCE, *PVBOXWDDM_RESOURCE;
78
79DECLINLINE(PVBOXWDDM_RESOURCE) vboxWddmResourceForAlloc(PVBOXWDDM_ALLOCATION pAlloc)
80{
81#if 0
82 if(pAlloc->iIndex == VBOXWDDM_ALLOCATIONINDEX_VOID)
83 return NULL;
84 PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)(((uint8_t*)pAlloc) - RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pAlloc->iIndex]));
85 return pRc;
86#else
87 return pAlloc->pResource;
88#endif
89}
90
91typedef struct VBOXWDDM_OVERLAY
92{
93 PDEVICE_EXTENSION pDevExt;
94 PVBOXWDDM_RESOURCE pResource;
95 PVBOXWDDM_ALLOCATION pCurentAlloc;
96 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
97} VBOXWDDM_OVERLAY, *PVBOXWDDM_OVERLAY;
98
99typedef enum
100{
101 VBOXWDDM_DEVICE_TYPE_UNDEFINED = 0,
102 VBOXWDDM_DEVICE_TYPE_SYSTEM
103} VBOXWDDM_DEVICE_TYPE;
104
105typedef struct VBOXWDDM_DEVICE
106{
107 struct _DEVICE_EXTENSION * pAdapter; /* Adapder info */
108 HANDLE hDevice; /* handle passed to CreateDevice */
109 VBOXWDDM_DEVICE_TYPE enmType; /* device creation flags passed to DxgkDdiCreateDevice, not sure we need it */
110} VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE;
111
112typedef enum
113{
114 VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0,
115 VBOXWDDM_CONTEXT_TYPE_SYSTEM,
116 VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D,
117 VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D
118} VBOXWDDM_CONTEXT_TYPE;
119
120typedef struct VBOXWDDM_CONTEXT
121{
122 LIST_ENTRY ListEntry;
123 struct VBOXWDDM_DEVICE * pDevice;
124 HANDLE hContext;
125 VBOXWDDM_CONTEXT_TYPE enmType;
126 UINT NodeOrdinal;
127 UINT EngineAffinity;
128 UINT uLastCompletedCmdFenceId;
129 RECT ViewRect;
130 VBOXVIDEOCM_CTX CmContext;
131} VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
132
133#define VBOXWDDMENTRY_2_CONTEXT(_pE) ((PVBOXWDDM_CONTEXT)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_CONTEXT, ListEntry)))
134
135typedef struct VBOXWDDM_DMA_ALLOCINFO
136{
137 PVBOXWDDM_ALLOCATION pAlloc;
138 VBOXVIDEOOFFSET offAlloc;
139 UINT segmentIdAlloc;
140 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
141} VBOXWDDM_DMA_ALLOCINFO, *PVBOXWDDM_DMA_ALLOCINFO;
142
143typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLAFS
144{
145 union
146 {
147 struct
148 {
149 UINT bCmdInDmaBuffer : 1;
150 UINT bShadow2PrimaryUpdate : 1;
151 UINT bSrcAllocValid : 1;
152 UINT bDstAllocValid : 1;
153 UINT bReserved : 28;
154 };
155 uint32_t Value;
156 };
157} VBOXWDDM_DMA_PRIVATEDATA_FLAFS, *PVBOXWDDM_DMA_PRIVATEDATA_FLAFS;
158
159typedef struct VBOXWDDM_DMA_PRIVATEDATA_HDR
160{
161 PVBOXWDDM_CONTEXT pContext;
162 VBOXWDDM_DMA_PRIVATEDATA_FLAFS fFlags;
163 VBOXVDMACMD_TYPE enmCmd;
164 VBOXWDDM_DMA_ALLOCINFO SrcAllocInfo;
165 VBOXWDDM_DMA_ALLOCINFO DstAllocInfo;
166}VBOXWDDM_DMA_PRIVATEDATA_HDR, *PVBOXWDDM_DMA_PRIVATEDATA_HDR;
167
168#ifdef VBOXWDDM_RENDER_FROM_SHADOW
169
170typedef struct VBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW
171{
172 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
173 RECT rect;
174} VBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW, *PVBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW;
175
176#endif
177
178typedef struct VBOXWDDM_DMA_PRESENT_BLT
179{
180 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
181 RECT SrcRect;
182 VBOXWDDM_RECTS_INFO DstRects;
183}VBOXWDDM_DMA_PRESENT_BLT, *PVBOXWDDM_DMA_PRESENT_BLT;
184
185
186typedef struct VBOXWDDM_OPENALLOCATION
187{
188 D3DKMT_HANDLE hAllocation;
189} VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION;
190
191#ifdef VBOXWDDM_RENDER_FROM_SHADOW
192# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pShadowAllocation)
193#else
194# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pPrimaryAllocation)
195#endif
196
197//DECLINLINE(VBOXVIDEOOFFSET) vboxWddmOffsetFromPhAddress(PHYSICAL_ADDRESS phAddr)
198//{
199// return (VBOXVIDEOOFFSET)(phAddr.QuadPart ? phAddr.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS : VBOXVIDEOOFFSET_VOID);
200//}
201
202#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