1 | /*
|
---|
2 | * Copyright (C) 2010 Oracle Corporation
|
---|
3 | *
|
---|
4 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | * available from http://www.virtualbox.org. This file is free software;
|
---|
6 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | * General Public License (GPL) as published by the Free Software
|
---|
8 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | */
|
---|
12 | #ifndef ___VBoxVideoWddm_h___
|
---|
13 | #define ___VBoxVideoWddm_h___
|
---|
14 |
|
---|
15 | #include "../VBoxVideo.h"
|
---|
16 |
|
---|
17 | /* one page size */
|
---|
18 | #define VBOXWDDM_C_DMA_BUFFER_SIZE 0x1000
|
---|
19 | #define VBOXWDDM_C_ALLOC_LIST_SIZE 0xc00
|
---|
20 | #define VBOXWDDM_C_PATH_LOCATION_LIST_SIZE 0xc00
|
---|
21 |
|
---|
22 | #define VBOXWDDM_C_POINTER_MAX_WIDTH 64
|
---|
23 | #define VBOXWDDM_C_POINTER_MAX_HEIGHT 64
|
---|
24 |
|
---|
25 | #define VBOXWDDM_C_VDMA_BUFFER_SIZE (64*_1K)
|
---|
26 |
|
---|
27 | #ifdef VBOXWDDM_WITH_VBVA
|
---|
28 | # define VBOXWDDM_RENDER_FROM_SHADOW
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #define VBOXWDDM_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1))
|
---|
32 |
|
---|
33 | PVOID vboxWddmMemAlloc(IN SIZE_T cbSize);
|
---|
34 | PVOID vboxWddmMemAllocZero(IN SIZE_T cbSize);
|
---|
35 | VOID vboxWddmMemFree(PVOID pvMem);
|
---|
36 |
|
---|
37 | typedef enum
|
---|
38 | {
|
---|
39 | VBOXWDDM_ALLOC_TYPE_UNEFINED = 0,
|
---|
40 | VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE,
|
---|
41 | VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE,
|
---|
42 | VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE,
|
---|
43 | /* this one is win 7-specific and hence unused for now */
|
---|
44 | VBOXWDDM_ALLOC_TYPE_STD_GDISURFACE
|
---|
45 | /* custom allocation types requested from user-mode d3d module will go here */
|
---|
46 | } VBOXWDDM_ALLOC_TYPE;
|
---|
47 |
|
---|
48 | typedef struct VBOXWDDM_SURFACE_DESC
|
---|
49 | {
|
---|
50 | UINT width;
|
---|
51 | UINT height;
|
---|
52 | D3DDDIFORMAT format;
|
---|
53 | UINT bpp;
|
---|
54 | UINT pitch;
|
---|
55 | } VBOXWDDM_SURFACE_DESC, *PVBOXWDDM_SURFACE_DESC;
|
---|
56 |
|
---|
57 | typedef struct VBOXWDDM_ALLOCINFO
|
---|
58 | {
|
---|
59 | VBOXWDDM_ALLOC_TYPE enmType;
|
---|
60 | union
|
---|
61 | {
|
---|
62 | VBOXWDDM_SURFACE_DESC SurfInfo;
|
---|
63 | } u;
|
---|
64 | } VBOXWDDM_ALLOCINFO, *PVBOXWDDM_ALLOCINFO;
|
---|
65 |
|
---|
66 | #define VBOXWDDM_ALLOCINFO_HEADSIZE() (sizeof (VBOXWDDM_ALLOCINFO))
|
---|
67 | #define VBOXWDDM_ALLOCINFO_SIZE_FROMBODYSIZE(_s) (VBOXWDDM_ALLOCINFO_HEADSIZE() + (_s))
|
---|
68 | #define VBOXWDDM_ALLOCINFO_SIZE(_tCmd) (VBOXWDDM_ALLOCINFO_SIZE_FROMBODYSIZE(sizeof(_tCmd)))
|
---|
69 | #define VBOXWDDM_ALLOCINFO_BODY(_p, _t) ( (_t*)(((uint8_t*)(_p)) + VBOXWDDM_ALLOCINFO_HEADSIZE()) )
|
---|
70 | #define VBOXWDDM_ALLOCINFO_HEAD(_pb) ((VBOXWDDM_ALLOCINFO*)((uint8_t *)(_pb) - VBOXWDDM_ALLOCATION_HEADSIZE()))
|
---|
71 |
|
---|
72 |
|
---|
73 | typedef struct VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE
|
---|
74 | {
|
---|
75 | D3DDDI_RATIONAL RefreshRate;
|
---|
76 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
|
---|
77 | } VBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE, *PVBOXWDDM_ALLOCINFO_SHAREDPRIMARYSURFACE;
|
---|
78 |
|
---|
79 | /* allocation */
|
---|
80 | typedef struct VBOXWDDM_ALLOCATION
|
---|
81 | {
|
---|
82 | VBOXWDDM_ALLOC_TYPE enmType;
|
---|
83 | UINT SegmentId;
|
---|
84 | VBOXVIDEOOFFSET offVram;
|
---|
85 | union
|
---|
86 | {
|
---|
87 | VBOXWDDM_SURFACE_DESC SurfInfo;
|
---|
88 | } u;
|
---|
89 | } VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
|
---|
90 |
|
---|
91 | #define VBOXWDDM_ALLOCATION_HEADSIZE() (sizeof (VBOXWDDM_ALLOCATION))
|
---|
92 | #define VBOXWDDM_ALLOCATION_SIZE_FROMBODYSIZE(_s) (VBOXWDDM_ALLOCATION_HEADSIZE() + (_s))
|
---|
93 | #define VBOXWDDM_ALLOCATION_SIZE(_tCmd) (VBOXWDDM_ALLOCATION_SIZE_FROMBODYSIZE(sizeof(_tCmd)))
|
---|
94 | #define VBOXWDDM_ALLOCATION_BODY(_p, _t) ( (_t*)(((uint8_t*)(_p)) + VBOXWDDM_ALLOCATION_HEADSIZE()) )
|
---|
95 | #define VBOXWDDM_ALLOCATION_HEAD(_pb) ((VBOXWDDM_ALLOCATION*)((uint8_t *)(_pb) - VBOXWDDM_ALLOCATION_HEADSIZE()))
|
---|
96 |
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 | typedef struct VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE
|
---|
102 | {
|
---|
103 | D3DDDI_RATIONAL RefreshRate;
|
---|
104 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
|
---|
105 | // VBOXVIDEOOFFSET offAddress;
|
---|
106 | BOOLEAN bVisible;
|
---|
107 | BOOLEAN bAssigned;
|
---|
108 | } VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE, *PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE;
|
---|
109 |
|
---|
110 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
111 | typedef struct VBOXWDDM_ALLOCATION_SHADOWSURFACE
|
---|
112 | {
|
---|
113 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
|
---|
114 | // VBOXVIDEOOFFSET offAddress;
|
---|
115 | BOOLEAN bVisible;
|
---|
116 | BOOLEAN bAssigned;
|
---|
117 | } VBOXWDDM_ALLOCATION_SHADOWSURFACE, *PVBOXWDDM_ALLOCATION_SHADOWSURFACE;
|
---|
118 | #endif
|
---|
119 |
|
---|
120 | typedef enum
|
---|
121 | {
|
---|
122 | VBOXWDDM_DEVICE_TYPE_UNDEFINED = 0,
|
---|
123 | VBOXWDDM_DEVICE_TYPE_SYSTEM
|
---|
124 | } VBOXWDDM_DEVICE_TYPE;
|
---|
125 |
|
---|
126 | typedef struct VBOXWDDM_DEVICE
|
---|
127 | {
|
---|
128 | struct _DEVICE_EXTENSION * pAdapter; /* Adapder info */
|
---|
129 | HANDLE hDevice; /* handle passed to CreateDevice */
|
---|
130 | VBOXWDDM_DEVICE_TYPE enmType; /* device creation flags passed to DxgkDdiCreateDevice, not sure we need it */
|
---|
131 | } VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE;
|
---|
132 |
|
---|
133 | typedef enum
|
---|
134 | {
|
---|
135 | VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0,
|
---|
136 | VBOXWDDM_CONTEXT_TYPE_SYSTEM
|
---|
137 | } VBOXWDDM_CONTEXT_TYPE;
|
---|
138 |
|
---|
139 | typedef struct VBOXWDDM_CONTEXT
|
---|
140 | {
|
---|
141 | struct VBOXWDDM_DEVICE * pDevice;
|
---|
142 | HANDLE hContext;
|
---|
143 | VBOXWDDM_CONTEXT_TYPE enmType;
|
---|
144 | UINT NodeOrdinal;
|
---|
145 | UINT EngineAffinity;
|
---|
146 | UINT uLastCompletedCmdFenceId;
|
---|
147 | } VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
|
---|
148 |
|
---|
149 | typedef struct VBOXWDDM_DMA_PRIVATE_DATA
|
---|
150 | {
|
---|
151 | PVBOXWDDM_CONTEXT pContext;
|
---|
152 | VBOXVDMACMD_TYPE enmCmd;
|
---|
153 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
154 | RECT rect;
|
---|
155 | VBOXVIDEOOFFSET offShadow;
|
---|
156 | UINT segmentIdShadow;
|
---|
157 | D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
|
---|
158 | #endif
|
---|
159 | // uint8_t Reserved[8];
|
---|
160 | }VBOXWDDM_DMA_PRIVATE_DATA, *PVBOXWDDM_DMA_PRIVATE_DATA;
|
---|
161 |
|
---|
162 | typedef struct VBOXWDDM_OPENALLOCATION
|
---|
163 | {
|
---|
164 | D3DKMT_HANDLE hAllocation;
|
---|
165 | } VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION;
|
---|
166 |
|
---|
167 | #endif /* #ifndef ___VBoxVideoWddm_h___ */
|
---|