VirtualBox

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

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

wddm/3d: chromium over hgsmi transport fixing & perf measurement

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