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 |
|
---|
26 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
27 | typedef struct VBOXDISPVHWA_INFO
|
---|
28 | {
|
---|
29 | VBOXVHWA_INFO Settings;
|
---|
30 | }VBOXDISPVHWA_INFO;
|
---|
31 |
|
---|
32 | /* represents settings secific to
|
---|
33 | * display device (head) on the multiple-head graphics card
|
---|
34 | * currently used for 2D (overlay) only since in theory its settings
|
---|
35 | * can differ per each frontend's framebuffer. */
|
---|
36 | typedef struct VBOXWDDMDISP_HEAD
|
---|
37 | {
|
---|
38 | VBOXDISPVHWA_INFO Vhwa;
|
---|
39 | } VBOXWDDMDISP_HEAD;
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | typedef struct VBOXWDDMDISP_ADAPTER
|
---|
43 | {
|
---|
44 | HANDLE hAdapter;
|
---|
45 | UINT uIfVersion;
|
---|
46 | UINT uRtVersion;
|
---|
47 | VBOXDISPD3D D3D;
|
---|
48 | VBOXDISPWORKER WndWorker;
|
---|
49 | IDirect3D9Ex * pD3D9If;
|
---|
50 | D3DDDI_ADAPTERCALLBACKS RtCallbacks;
|
---|
51 | uint32_t cFormstOps;
|
---|
52 | FORMATOP *paFormstOps;
|
---|
53 | uint32_t cSurfDescs;
|
---|
54 | DDSURFACEDESC *paSurfDescs;
|
---|
55 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
56 | uint32_t cHeads;
|
---|
57 | VBOXWDDMDISP_HEAD aHeads[1];
|
---|
58 | #endif
|
---|
59 | } VBOXWDDMDISP_ADAPTER, *PVBOXWDDMDISP_ADAPTER;
|
---|
60 |
|
---|
61 | typedef struct VBOXWDDMDISP_CONTEXT
|
---|
62 | {
|
---|
63 | RTLISTNODE ListNode;
|
---|
64 | struct VBOXWDDMDISP_DEVICE *pDevice;
|
---|
65 | D3DDDICB_CREATECONTEXT ContextInfo;
|
---|
66 | } VBOXWDDMDISP_CONTEXT, *PVBOXWDDMDISP_CONTEXT;
|
---|
67 |
|
---|
68 | typedef struct VBOXWDDMDISP_STREAMSOURCEUM
|
---|
69 | {
|
---|
70 | CONST VOID* pvBuffer;
|
---|
71 | UINT cbStride;
|
---|
72 | } VBOXWDDMDISP_STREAMSOURCEUM, *PVBOXWDDMDISP_STREAMSOURCEUM;
|
---|
73 |
|
---|
74 | typedef struct VBOXWDDMDISP_INDICIESUM
|
---|
75 | {
|
---|
76 | CONST VOID* pvBuffer;
|
---|
77 | UINT cbSize;
|
---|
78 | } VBOXWDDMDISP_INDICIESUM, *PVBOXWDDMDISP_INDICIESUM;
|
---|
79 |
|
---|
80 | struct VBOXWDDMDISP_ALLOCATION;
|
---|
81 |
|
---|
82 | typedef struct VBOXWDDMDISP_STREAM_SOURCE_INFO
|
---|
83 | {
|
---|
84 | UINT uiOffset;
|
---|
85 | UINT uiStride;
|
---|
86 | } VBOXWDDMDISP_STREAM_SOURCE_INFO;
|
---|
87 |
|
---|
88 | typedef struct VBOXWDDMDISP_INDICES_INFO
|
---|
89 | {
|
---|
90 | UINT uiStride;
|
---|
91 | } VBOXWDDMDISP_INDICES_INFO;
|
---|
92 |
|
---|
93 | typedef struct VBOXWDDMDISP_SCREEN
|
---|
94 | {
|
---|
95 | IDirect3DDevice9 *pDevice9If;
|
---|
96 | struct VBOXWDDMDISP_RESOURCE *pRenderTargetRc;
|
---|
97 | uint32_t iRenderTargetFrontBuf;
|
---|
98 | HWND hWnd;
|
---|
99 | } VBOXWDDMDISP_SCREEN, *PVBOXWDDMDISP_SCREEN;
|
---|
100 |
|
---|
101 | typedef struct VBOXWDDMDISP_DEVICE
|
---|
102 | {
|
---|
103 | HANDLE hDevice;
|
---|
104 | PVBOXWDDMDISP_ADAPTER pAdapter;
|
---|
105 | UINT u32IfVersion;
|
---|
106 | UINT uRtVersion;
|
---|
107 | D3DDDI_DEVICECALLBACKS RtCallbacks;
|
---|
108 | VOID *pvCmdBuffer;
|
---|
109 | UINT cbCmdBuffer;
|
---|
110 | D3DDDI_CREATEDEVICEFLAGS fFlags;
|
---|
111 | #ifndef VBOXWDDM_WITH_VISIBLE_FB
|
---|
112 | IDirect3DSurface9 *pRenderTargetFbCopy;
|
---|
113 | #endif
|
---|
114 | /* number of StreamSources set */
|
---|
115 | UINT cStreamSources;
|
---|
116 | VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
|
---|
117 | VBOXWDDMDISP_ALLOCATION *aStreamSource[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
|
---|
118 | VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
|
---|
119 | VBOXWDDMDISP_INDICIESUM IndiciesUm;
|
---|
120 | VBOXWDDMDISP_ALLOCATION *pIndicesAlloc;
|
---|
121 | VBOXWDDMDISP_INDICES_INFO IndiciesInfo;
|
---|
122 | /* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
|
---|
123 | * is split into two calls : SetViewport & SetZRange */
|
---|
124 | D3DVIEWPORT9 ViewPort;
|
---|
125 | VBOXWDDMDISP_CONTEXT DefaultContext;
|
---|
126 |
|
---|
127 | UINT iPrimaryScreen;
|
---|
128 | UINT cScreens;
|
---|
129 | VBOXWDDMDISP_SCREEN aScreens[VBOX_VIDEO_MAX_SCREENS];
|
---|
130 | } VBOXWDDMDISP_DEVICE, *PVBOXWDDMDISP_DEVICE;
|
---|
131 |
|
---|
132 | typedef struct VBOXWDDMDISP_LOCKINFO
|
---|
133 | {
|
---|
134 | uint32_t cLocks;
|
---|
135 | union {
|
---|
136 | D3DDDIRANGE Range;
|
---|
137 | RECT Area;
|
---|
138 | D3DDDIBOX Box;
|
---|
139 | };
|
---|
140 | D3DDDI_LOCKFLAGS fFlags;
|
---|
141 | D3DLOCKED_RECT LockedRect;
|
---|
142 | } VBOXWDDMDISP_LOCKINFO;
|
---|
143 |
|
---|
144 | typedef enum
|
---|
145 | {
|
---|
146 | VBOXDISP_D3DIFTYPE_UNDEFINED = 0,
|
---|
147 | VBOXDISP_D3DIFTYPE_SURFACE,
|
---|
148 | VBOXDISP_D3DIFTYPE_TEXTURE,
|
---|
149 | VBOXDISP_D3DIFTYPE_VERTEXBUFFER,
|
---|
150 | VBOXDISP_D3DIFTYPE_INDEXBUFFER
|
---|
151 | } VBOXDISP_D3DIFTYPE;
|
---|
152 |
|
---|
153 | typedef struct VBOXWDDMDISP_ALLOCATION
|
---|
154 | {
|
---|
155 | D3DKMT_HANDLE hAllocation;
|
---|
156 | VBOXWDDM_ALLOC_TYPE enmType;
|
---|
157 | void* pvMem;
|
---|
158 | /* object type is defined by enmD3DIfType enum */
|
---|
159 | IUnknown *pD3DIf;
|
---|
160 | IUnknown *pSecondaryOpenedD3DIf;
|
---|
161 | VBOXDISP_D3DIFTYPE enmD3DIfType;
|
---|
162 | HANDLE hSharedHandle;
|
---|
163 | VBOXWDDMDISP_LOCKINFO LockInfo;
|
---|
164 | VBOXWDDM_DIRTYREGION DirtyRegion; /* <- dirty region to notify host about */
|
---|
165 | VBOXWDDM_SURFACE_DESC SurfDesc;
|
---|
166 | } VBOXWDDMDISP_ALLOCATION, *PVBOXWDDMDISP_ALLOCATION;
|
---|
167 |
|
---|
168 | typedef struct VBOXWDDMDISP_RESOURCE
|
---|
169 | {
|
---|
170 | HANDLE hResource;
|
---|
171 | D3DKMT_HANDLE hKMResource;
|
---|
172 | PVBOXWDDMDISP_DEVICE pDevice;
|
---|
173 | uint32_t fFlags;
|
---|
174 | VBOXWDDM_RC_DESC RcDesc;
|
---|
175 | UINT cAllocations;
|
---|
176 | VBOXWDDMDISP_ALLOCATION aAllocations[1];
|
---|
177 | } VBOXWDDMDISP_RESOURCE, *PVBOXWDDMDISP_RESOURCE;
|
---|
178 |
|
---|
179 | typedef struct VBOXWDDMDISP_TSS_LOOKUP
|
---|
180 | {
|
---|
181 | BOOL bSamplerState;
|
---|
182 | DWORD dType;
|
---|
183 | } VBOXWDDMDISP_TSS_LOOKUP;
|
---|
184 |
|
---|
185 | typedef struct VBOXWDDMDISP_OVERLAY
|
---|
186 | {
|
---|
187 | D3DKMT_HANDLE hOverlay;
|
---|
188 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
|
---|
189 | PVBOXWDDMDISP_RESOURCE *pResource;
|
---|
190 | } VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY;
|
---|
191 |
|
---|
192 | #define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If))
|
---|
193 |
|
---|
194 | #endif /* #ifndef ___VBoxDispD3D_h___ */
|
---|