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_DEVICE
|
---|
94 | {
|
---|
95 | HANDLE hDevice;
|
---|
96 | PVBOXWDDMDISP_ADAPTER pAdapter;
|
---|
97 | UINT u32IfVersion;
|
---|
98 | UINT uRtVersion;
|
---|
99 | D3DDDI_DEVICECALLBACKS RtCallbacks;
|
---|
100 | VOID *pvCmdBuffer;
|
---|
101 | UINT cbCmdBuffer;
|
---|
102 | D3DDDI_CREATEDEVICEFLAGS fFlags;
|
---|
103 | HWND hWnd;
|
---|
104 | #ifndef VBOXWDDM_WITH_VISIBLE_FB
|
---|
105 | IDirect3DSurface9 *pRenderTargetFbCopy;
|
---|
106 | #endif
|
---|
107 | struct VBOXWDDMDISP_RESOURCE *pRenderTargetRc;
|
---|
108 | uint32_t iRenderTargetFrontBuf;
|
---|
109 | /* number of StreamSources set */
|
---|
110 | UINT cStreamSources;
|
---|
111 | VBOXWDDMDISP_STREAMSOURCEUM aStreamSourceUm[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
|
---|
112 | VBOXWDDMDISP_ALLOCATION *aStreamSource[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
|
---|
113 | VBOXWDDMDISP_STREAM_SOURCE_INFO StreamSourceInfo[VBOXWDDMDISP_MAX_VERTEX_STREAMS];
|
---|
114 | VBOXWDDMDISP_INDICIESUM IndiciesUm;
|
---|
115 | VBOXWDDMDISP_ALLOCATION *pIndicesAlloc;
|
---|
116 | VBOXWDDMDISP_INDICES_INFO IndiciesInfo;
|
---|
117 | IDirect3DDevice9 *pDevice9If;
|
---|
118 | /* need to cache the ViewPort data because IDirect3DDevice9::SetViewport
|
---|
119 | * is split into two calls : SetViewport & SetZRange */
|
---|
120 | D3DVIEWPORT9 ViewPort;
|
---|
121 | VBOXWDDMDISP_CONTEXT DefaultContext;
|
---|
122 | } VBOXWDDMDISP_DEVICE, *PVBOXWDDMDISP_DEVICE;
|
---|
123 |
|
---|
124 | typedef struct VBOXWDDMDISP_LOCKINFO
|
---|
125 | {
|
---|
126 | uint32_t cLocks;
|
---|
127 | union {
|
---|
128 | D3DDDIRANGE Range;
|
---|
129 | RECT Area;
|
---|
130 | D3DDDIBOX Box;
|
---|
131 | };
|
---|
132 | D3DDDI_LOCKFLAGS fFlags;
|
---|
133 | D3DLOCKED_RECT LockedRect;
|
---|
134 | } VBOXWDDMDISP_LOCKINFO;
|
---|
135 |
|
---|
136 | typedef enum
|
---|
137 | {
|
---|
138 | VBOXDISP_D3DIFTYPE_UNDEFINED = 0,
|
---|
139 | VBOXDISP_D3DIFTYPE_SURFACE,
|
---|
140 | VBOXDISP_D3DIFTYPE_TEXTURE,
|
---|
141 | VBOXDISP_D3DIFTYPE_VERTEXBUFFER,
|
---|
142 | VBOXDISP_D3DIFTYPE_INDEXBUFFER
|
---|
143 | } VBOXDISP_D3DIFTYPE;
|
---|
144 |
|
---|
145 | typedef struct VBOXWDDMDISP_ALLOCATION
|
---|
146 | {
|
---|
147 | D3DKMT_HANDLE hAllocation;
|
---|
148 | VBOXWDDM_ALLOC_TYPE enmType;
|
---|
149 | void* pvMem;
|
---|
150 | /* object type is defined by enmD3DIfType enum */
|
---|
151 | IUnknown *pD3DIf;
|
---|
152 | VBOXDISP_D3DIFTYPE enmD3DIfType;
|
---|
153 | VBOXWDDMDISP_LOCKINFO LockInfo;
|
---|
154 | VBOXWDDM_DIRTYREGION DirtyRegion; /* <- dirty region to notify host about */
|
---|
155 | VBOXWDDM_SURFACE_DESC SurfDesc;
|
---|
156 | } VBOXWDDMDISP_ALLOCATION, *PVBOXWDDMDISP_ALLOCATION;
|
---|
157 |
|
---|
158 | typedef struct VBOXWDDMDISP_RESOURCE
|
---|
159 | {
|
---|
160 | HANDLE hResource;
|
---|
161 | D3DKMT_HANDLE hKMResource;
|
---|
162 | PVBOXWDDMDISP_DEVICE pDevice;
|
---|
163 | uint32_t fFlags;
|
---|
164 | VBOXWDDM_RC_DESC RcDesc;
|
---|
165 | UINT cAllocations;
|
---|
166 | VBOXWDDMDISP_ALLOCATION aAllocations[1];
|
---|
167 | } VBOXWDDMDISP_RESOURCE, *PVBOXWDDMDISP_RESOURCE;
|
---|
168 |
|
---|
169 | typedef struct VBOXWDDMDISP_TSS_LOOKUP
|
---|
170 | {
|
---|
171 | BOOL bSamplerState;
|
---|
172 | DWORD dType;
|
---|
173 | } VBOXWDDMDISP_TSS_LOOKUP;
|
---|
174 |
|
---|
175 | typedef struct VBOXWDDMDISP_OVERLAY
|
---|
176 | {
|
---|
177 | D3DKMT_HANDLE hOverlay;
|
---|
178 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
|
---|
179 | PVBOXWDDMDISP_RESOURCE *pResource;
|
---|
180 | } VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY;
|
---|
181 |
|
---|
182 | #define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If))
|
---|
183 |
|
---|
184 | #endif /* #ifndef ___VBoxDispD3D_h___ */
|
---|