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