VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h@ 32697

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

wddm/3d: make winsat more happy

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.1 KB
Line 
1/** @file
2 *
3 * VBoxVideo Display D3D User mode dll
4 *
5 * Copyright (C) 2010 Oracle Corporation
6 *
7 * This file is part of VirtualBox Open Source Edition (OSE), as
8 * available from http://www.virtualbox.org. This file is free software;
9 * you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License (GPL) as published by the Free Software
11 * Foundation, in version 2 as it comes in the "COPYING" file of the
12 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14 */
15#ifndef ___VBoxDispD3D_h___
16#define ___VBoxDispD3D_h___
17
18#include "VBoxDispD3DIf.h"
19#include "../../Miniport/wddm/VBoxVideoIf.h"
20
21#include <iprt/cdefs.h>
22#include <iprt/list.h>
23
24#define VBOXWDDMDISP_MAX_VERTEX_STREAMS 16
25#define VBOXWDDMDISP_MAX_SWAPCHAIN_SIZE 16
26
27#ifdef VBOX_WITH_VIDEOHWACCEL
28typedef struct VBOXDISPVHWA_INFO
29{
30 VBOXVHWA_INFO Settings;
31}VBOXDISPVHWA_INFO;
32
33/* represents settings secific to
34 * display device (head) on the multiple-head graphics card
35 * currently used for 2D (overlay) only since in theory its settings
36 * can differ per each frontend's framebuffer. */
37typedef struct VBOXWDDMDISP_HEAD
38{
39 VBOXDISPVHWA_INFO Vhwa;
40} VBOXWDDMDISP_HEAD;
41#endif
42
43typedef struct VBOXWDDMDISP_ADAPTER
44{
45 HANDLE hAdapter;
46 UINT uIfVersion;
47 UINT uRtVersion;
48 VBOXDISPD3D D3D;
49 VBOXDISPWORKER WndWorker;
50 IDirect3D9Ex * pD3D9If;
51 D3DDDI_ADAPTERCALLBACKS RtCallbacks;
52 uint32_t cFormstOps;
53 FORMATOP *paFormstOps;
54 uint32_t cSurfDescs;
55 DDSURFACEDESC *paSurfDescs;
56 UINT cMaxSimRTs;
57#ifdef VBOX_WITH_VIDEOHWACCEL
58 uint32_t cHeads;
59 VBOXWDDMDISP_HEAD aHeads[1];
60#endif
61} VBOXWDDMDISP_ADAPTER, *PVBOXWDDMDISP_ADAPTER;
62
63typedef struct VBOXWDDMDISP_CONTEXT
64{
65 RTLISTNODE ListNode;
66 struct VBOXWDDMDISP_DEVICE *pDevice;
67 D3DDDICB_CREATECONTEXT ContextInfo;
68} VBOXWDDMDISP_CONTEXT, *PVBOXWDDMDISP_CONTEXT;
69
70typedef struct VBOXWDDMDISP_STREAMSOURCEUM
71{
72 CONST VOID* pvBuffer;
73 UINT cbStride;
74} VBOXWDDMDISP_STREAMSOURCEUM, *PVBOXWDDMDISP_STREAMSOURCEUM;
75
76typedef struct VBOXWDDMDISP_INDICIESUM
77{
78 CONST VOID* pvBuffer;
79 UINT cbSize;
80} VBOXWDDMDISP_INDICIESUM, *PVBOXWDDMDISP_INDICIESUM;
81
82struct VBOXWDDMDISP_ALLOCATION;
83
84typedef struct VBOXWDDMDISP_STREAM_SOURCE_INFO
85{
86 UINT uiOffset;
87 UINT uiStride;
88} VBOXWDDMDISP_STREAM_SOURCE_INFO;
89
90typedef struct VBOXWDDMDISP_INDICES_INFO
91{
92 UINT uiStride;
93} VBOXWDDMDISP_INDICES_INFO;
94
95typedef struct VBOXWDDMDISP_RENDERTGT_FLAGS
96{
97 union
98 {
99 struct
100 {
101 UINT bAdded : 1;
102 UINT bRemoved : 1;
103 UINT Reserved : 30;
104 };
105 uint32_t Value;
106 };
107}VBOXWDDMDISP_RENDERTGT_FLAGS;
108
109typedef struct VBOXWDDMDISP_RENDERTGT
110{
111 struct VBOXWDDMDISP_ALLOCATION *pAlloc;
112 UINT cNumFlips;
113 VBOXWDDMDISP_RENDERTGT_FLAGS fFlags;
114} VBOXWDDMDISP_RENDERTGT, *PVBOXWDDMDISP_RENDERTGT;
115
116#define VBOXWDDMDISP_INDEX_UNDEFINED (~0)
117typedef struct VBOXWDDMDISP_SWAPCHAIN_FLAGS
118{
119 union
120 {
121 struct
122 {
123 UINT bChanged : 1;
124 UINT Reserved : 31;
125 };
126 uint32_t Value;
127 };
128}VBOXWDDMDISP_SWAPCHAIN_FLAGS;
129
130typedef struct VBOXWDDMDISP_SWAPCHAIN
131{
132 RTLISTNODE ListEntry;
133 UINT iBB; /* Backbuffer index */
134 UINT cRTs; /* Number of render targets in the swapchain */
135 VBOXWDDMDISP_SWAPCHAIN_FLAGS fFlags;
136#ifndef VBOXWDDM_WITH_VISIBLE_FB
137 IDirect3DSurface9 *pRenderTargetFbCopy;
138#endif
139 IDirect3DSwapChain9 *pSwapChainIf;
140 HWND hWnd;
141 VBOXDISP_KMHANDLE hSwapchainKm;
142 VBOXWDDMDISP_RENDERTGT aRTs[VBOXWDDMDISP_MAX_SWAPCHAIN_SIZE];
143} VBOXWDDMDISP_SWAPCHAIN, *PVBOXWDDMDISP_SWAPCHAIN;
144
145
146//typedef struct VBOXWDDMDISP_SCREEN
147//{
148// RTLISTNODE SwapchainList;
149// IDirect3DDevice9 *pDevice9If;
150//// struct VBOXWDDMDISP_RESOURCE *pDstSharedRc;
151// uint32_t iRenderTargetFrontBuf;
152// HWND hWnd;
153//} VBOXWDDMDISP_SCREEN, *PVBOXWDDMDISP_SCREEN;
154
155typedef struct VBOXWDDMDISP_DEVICE
156{
157 HANDLE hDevice;
158 PVBOXWDDMDISP_ADAPTER pAdapter;
159 IDirect3DDevice9 *pDevice9If;
160 RTLISTNODE SwapchainList;
161 UINT u32IfVersion;
162 UINT uRtVersion;
163 D3DDDI_DEVICECALLBACKS RtCallbacks;
164 VOID *pvCmdBuffer;
165 UINT cbCmdBuffer;
166 D3DDDI_CREATEDEVICEFLAGS fFlags;
167 /* number of StreamSources set */
168 UINT cStreamSources;
169 VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
170 struct VBOXWDDMDISP_ALLOCATION *aStreamSource[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
171 VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
172 VBOXWDDMDISP_INDICIESUM IndiciesUm;
173 struct VBOXWDDMDISP_ALLOCATION *pIndicesAlloc;
174 VBOXWDDMDISP_INDICES_INFO IndiciesInfo;
175 /* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
176 * is split into two calls : SetViewport & SetZRange */
177 D3DVIEWPORT9 ViewPort;
178 VBOXWDDMDISP_CONTEXT DefaultContext;
179
180 CRITICAL_SECTION DirtyAllocListLock;
181 RTLISTNODE DirtyAllocList;
182 UINT cRTs;
183 struct VBOXWDDMDISP_ALLOCATION * apRTs[1];
184} VBOXWDDMDISP_DEVICE, *PVBOXWDDMDISP_DEVICE;
185
186typedef struct VBOXWDDMDISP_LOCKINFO
187{
188 uint32_t cLocks;
189 union {
190 D3DDDIRANGE Range;
191 RECT Area;
192 D3DDDIBOX Box;
193 };
194 D3DDDI_LOCKFLAGS fFlags;
195 D3DLOCKED_RECT LockedRect;
196} VBOXWDDMDISP_LOCKINFO;
197
198typedef enum
199{
200 VBOXDISP_D3DIFTYPE_UNDEFINED = 0,
201 VBOXDISP_D3DIFTYPE_SURFACE,
202 VBOXDISP_D3DIFTYPE_TEXTURE,
203 VBOXDISP_D3DIFTYPE_VERTEXBUFFER,
204 VBOXDISP_D3DIFTYPE_INDEXBUFFER
205} VBOXDISP_D3DIFTYPE;
206
207typedef struct VBOXWDDMDISP_ALLOCATION
208{
209 D3DKMT_HANDLE hAllocation;
210 VBOXWDDM_ALLOC_TYPE enmType;
211 UINT iAlloc;
212 struct VBOXWDDMDISP_RESOURCE *pRc;
213 void* pvMem;
214 UINT D3DWidth;
215 /* object type is defined by enmD3DIfType enum */
216 IUnknown *pD3DIf;
217 IUnknown *pSecondaryOpenedD3DIf;
218 VBOXDISP_D3DIFTYPE enmD3DIfType;
219 RTLISTNODE DirtyAllocListEntry;
220 HANDLE hSharedHandle;
221 VBOXWDDMDISP_LOCKINFO LockInfo;
222 VBOXWDDM_DIRTYREGION DirtyRegion; /* <- dirty region to notify host about */
223 VBOXWDDM_SURFACE_DESC SurfDesc;
224 PVBOXWDDMDISP_SWAPCHAIN pSwapchain;
225} VBOXWDDMDISP_ALLOCATION, *PVBOXWDDMDISP_ALLOCATION;
226
227typedef struct VBOXWDDMDISP_RESOURCE
228{
229 HANDLE hResource;
230 D3DKMT_HANDLE hKMResource;
231 PVBOXWDDMDISP_DEVICE pDevice;
232 uint32_t fFlags;
233 VBOXWDDM_RC_DESC RcDesc;
234 UINT cAllocations;
235 VBOXWDDMDISP_ALLOCATION aAllocations[1];
236} VBOXWDDMDISP_RESOURCE, *PVBOXWDDMDISP_RESOURCE;
237
238typedef struct VBOXWDDMDISP_QUERY
239{
240 D3DDDIQUERYTYPE enmType;
241 D3DDDI_ISSUEQUERYFLAGS fQueryState;
242 union
243 {
244 BOOL bData;
245 UINT u32Data;
246 } data ;
247} VBOXWDDMDISP_QUERY, *PVBOXWDDMDISP_QUERY;
248
249typedef struct VBOXWDDMDISP_TSS_LOOKUP
250{
251 BOOL bSamplerState;
252 DWORD dType;
253} VBOXWDDMDISP_TSS_LOOKUP;
254
255typedef struct VBOXWDDMDISP_OVERLAY
256{
257 D3DKMT_HANDLE hOverlay;
258 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
259 PVBOXWDDMDISP_RESOURCE *pResource;
260} VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY;
261
262#define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If))
263#ifdef VBOXDISP_EARLYCREATEDEVICE
264#define VBOXDISP_D3DEV(_p) (_p)->pDevice9If
265#else
266#define VBOXDISP_D3DEV(_p) vboxWddmD3DDeviceGet(_p)
267#endif
268
269#endif /* #ifndef ___VBoxDispD3D_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