1 | /** @file
|
---|
2 | * VirtualBox Video miniport driver
|
---|
3 | *
|
---|
4 | * Copyright (C) 2006-2007 Oracle Corporation
|
---|
5 | *
|
---|
6 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
7 | * available from http://www.virtualbox.org. This file is free software;
|
---|
8 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
9 | * General Public License (GPL) as published by the Free Software
|
---|
10 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
11 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
12 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #ifndef VBOXVIDEO_H
|
---|
16 | #define VBOXVIDEO_H
|
---|
17 |
|
---|
18 | #include <VBox/cdefs.h>
|
---|
19 | #include <VBox/types.h>
|
---|
20 | #include <iprt/assert.h>
|
---|
21 |
|
---|
22 | #ifdef VBOX_WITH_HGSMI
|
---|
23 | //#include <iprt/thread.h>
|
---|
24 |
|
---|
25 | #include <VBox/HGSMI/HGSMI.h>
|
---|
26 | #include <VBox/HGSMI/HGSMIChSetup.h>
|
---|
27 | #include "VBoxHGSMI.h"
|
---|
28 | #endif /* VBOX_WITH_HGSMI */
|
---|
29 |
|
---|
30 | RT_C_DECLS_BEGIN
|
---|
31 | #ifndef VBOXWDDM
|
---|
32 | #include "dderror.h"
|
---|
33 | #include "devioctl.h"
|
---|
34 | #include "miniport.h"
|
---|
35 | #include "ntddvdeo.h"
|
---|
36 | #include "video.h"
|
---|
37 | #else
|
---|
38 | # define VBOX_WITH_WORKAROUND_MISSING_PACK
|
---|
39 | # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
40 | # define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
|
---|
41 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
|
---|
42 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
|
---|
43 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
|
---|
44 | # define _interlockedbittestandset _interlockedbittestandset_StupidDDKVsCompilerCrap
|
---|
45 | # define _interlockedbittestandreset _interlockedbittestandreset_StupidDDKVsCompilerCrap
|
---|
46 | # define _interlockedbittestandset64 _interlockedbittestandset64_StupidDDKVsCompilerCrap
|
---|
47 | # define _interlockedbittestandreset64 _interlockedbittestandreset64_StupidDDKVsCompilerCrap
|
---|
48 | # pragma warning(disable : 4163)
|
---|
49 | # ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
|
---|
50 | # pragma warning(disable : 4103)
|
---|
51 | # endif
|
---|
52 | # include <ntddk.h>
|
---|
53 | # pragma warning(default : 4163)
|
---|
54 | # ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
|
---|
55 | # pragma pack()
|
---|
56 | # pragma warning(default : 4103)
|
---|
57 | # endif
|
---|
58 | # undef _InterlockedExchange
|
---|
59 | # undef _InterlockedExchangeAdd
|
---|
60 | # undef _InterlockedCompareExchange
|
---|
61 | # undef _InterlockedAddLargeStatistic
|
---|
62 | # undef _interlockedbittestandset
|
---|
63 | # undef _interlockedbittestandreset
|
---|
64 | # undef _interlockedbittestandset64
|
---|
65 | # undef _interlockedbittestandreset64
|
---|
66 | # else
|
---|
67 | # include <ntddk.h>
|
---|
68 | # endif
|
---|
69 | #include "dispmprt.h"
|
---|
70 | #include "ntddvdeo.h"
|
---|
71 | #include "dderror.h"
|
---|
72 | #endif
|
---|
73 | RT_C_DECLS_END
|
---|
74 |
|
---|
75 | #define VBE_DISPI_IOPORT_INDEX 0x01CE
|
---|
76 | #define VBE_DISPI_IOPORT_DATA 0x01CF
|
---|
77 | #define VBE_DISPI_INDEX_ID 0x0
|
---|
78 | #define VBE_DISPI_INDEX_XRES 0x1
|
---|
79 | #define VBE_DISPI_INDEX_YRES 0x2
|
---|
80 | #define VBE_DISPI_INDEX_BPP 0x3
|
---|
81 | #define VBE_DISPI_INDEX_ENABLE 0x4
|
---|
82 | #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
|
---|
83 | #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
|
---|
84 | #define VBE_DISPI_INDEX_X_OFFSET 0x8
|
---|
85 | #define VBE_DISPI_INDEX_Y_OFFSET 0x9
|
---|
86 | #define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
|
---|
87 |
|
---|
88 | #define VBE_DISPI_ID2 0xB0C2
|
---|
89 | /* The VBOX interface id. Indicates support for VBE_DISPI_INDEX_VBOX_VIDEO. */
|
---|
90 | #define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
|
---|
91 | #ifdef VBOX_WITH_HGSMI
|
---|
92 | #define VBE_DISPI_ID_HGSMI 0xBE01
|
---|
93 | #endif /* VBOX_WITH_HGSMI */
|
---|
94 | #define VBE_DISPI_DISABLED 0x00
|
---|
95 | #define VBE_DISPI_ENABLED 0x01
|
---|
96 | #define VBE_DISPI_LFB_ENABLED 0x40
|
---|
97 | #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
|
---|
98 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
|
---|
99 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
|
---|
100 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
|
---|
101 |
|
---|
102 | #ifdef VBOX_WITH_HGSMI
|
---|
103 | #define VGA_PORT_HGSMI_HOST 0x3b0
|
---|
104 | #define VGA_PORT_HGSMI_GUEST 0x3d0
|
---|
105 | #endif /* VBOX_WITH_HGSMI */
|
---|
106 |
|
---|
107 | /* common API types */
|
---|
108 | #ifndef VBOXWDDM
|
---|
109 | typedef PSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK;
|
---|
110 | typedef UCHAR VBOXVCMNIRQL, *PVBOXVCMNIRQL;
|
---|
111 |
|
---|
112 | typedef PEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT;
|
---|
113 |
|
---|
114 | typedef struct _DEVICE_EXTENSION * VBOXCMNREG;
|
---|
115 | #else
|
---|
116 | typedef struct _DEVICE_EXTENSION *PDEVICE_EXTENSION;
|
---|
117 | #include <VBox/VBoxVideo.h>
|
---|
118 | #include "wddm/VBoxVideoIf.h"
|
---|
119 | #include "wddm/VBoxVideoWddm.h"
|
---|
120 | #include "wddm/VBoxVideoShgsmi.h"
|
---|
121 | #include "wddm/VBoxVideoVdma.h"
|
---|
122 | #include "wddm/VBoxVideoVidPn.h"
|
---|
123 | #ifdef VBOXWDDM_WITH_VBVA
|
---|
124 | # include "wddm/VBoxVideoVbva.h"
|
---|
125 | #endif
|
---|
126 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
127 | # include "wddm/VBoxVideoVhwa.h"
|
---|
128 | #endif
|
---|
129 |
|
---|
130 |
|
---|
131 | typedef KSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK;
|
---|
132 | typedef KIRQL VBOXVCMNIRQL, *PVBOXVCMNIRQL;
|
---|
133 |
|
---|
134 | typedef KEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT;
|
---|
135 |
|
---|
136 | typedef HANDLE VBOXCMNREG;
|
---|
137 |
|
---|
138 | #define VBOXWDDM_POINTER_ATTRIBUTES_SIZE VBOXWDDM_ROUNDBOUND( \
|
---|
139 | VBOXWDDM_ROUNDBOUND( sizeof (VIDEO_POINTER_ATTRIBUTES), 4 ) + \
|
---|
140 | VBOXWDDM_ROUNDBOUND(VBOXWDDM_C_POINTER_MAX_WIDTH * VBOXWDDM_C_POINTER_MAX_HEIGHT * 4, 4) + \
|
---|
141 | VBOXWDDM_ROUNDBOUND((VBOXWDDM_C_POINTER_MAX_WIDTH * VBOXWDDM_C_POINTER_MAX_HEIGHT + 7) >> 3, 4) \
|
---|
142 | , 8)
|
---|
143 |
|
---|
144 | typedef struct VBOXWDDM_POINTER_INFO
|
---|
145 | {
|
---|
146 | uint32_t xPos;
|
---|
147 | uint32_t yPos;
|
---|
148 | union
|
---|
149 | {
|
---|
150 | VIDEO_POINTER_ATTRIBUTES data;
|
---|
151 | char buffer[VBOXWDDM_POINTER_ATTRIBUTES_SIZE];
|
---|
152 | } Attributes;
|
---|
153 | } VBOXWDDM_POINTER_INFO, *PVBOXWDDM_POINTER_INFO;
|
---|
154 |
|
---|
155 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
156 | typedef struct VBOXWDDM_VHWA
|
---|
157 | {
|
---|
158 | VBOXVHWA_INFO Settings;
|
---|
159 | volatile uint32_t cOverlaysCreated;
|
---|
160 | } VBOXWDDM_VHWA;
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | typedef struct VBOXWDDM_SOURCE
|
---|
164 | {
|
---|
165 | struct VBOXWDDM_ALLOCATION * pPrimaryAllocation;
|
---|
166 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
167 | struct VBOXWDDM_ALLOCATION * pShadowAllocation;
|
---|
168 | VBOXVIDEOOFFSET offVram;
|
---|
169 | VBOXWDDM_SURFACE_DESC SurfDesc;
|
---|
170 | VBOXVBVAINFO Vbva;
|
---|
171 | #endif
|
---|
172 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
173 | /* @todo: in our case this seems more like a target property,
|
---|
174 | * but keep it here for now */
|
---|
175 | VBOXWDDM_VHWA Vhwa;
|
---|
176 | #endif
|
---|
177 | VBOXWDDM_POINTER_INFO PointerInfo;
|
---|
178 | } VBOXWDDM_SOURCE, *PVBOXWDDM_SOURCE;
|
---|
179 |
|
---|
180 | #endif
|
---|
181 |
|
---|
182 | typedef struct _DEVICE_EXTENSION
|
---|
183 | {
|
---|
184 | struct _DEVICE_EXTENSION *pNext; /* Next extension in the DualView extension list.
|
---|
185 | * The primary extension is the first one.
|
---|
186 | */
|
---|
187 | #ifndef VBOXWDDM
|
---|
188 | struct _DEVICE_EXTENSION *pPrimary; /* Pointer to the primary device extension. */
|
---|
189 |
|
---|
190 | ULONG iDevice; /* Device index: 0 for primary, otherwise a secondary device. */
|
---|
191 |
|
---|
192 | ULONG CurrentMode; /* Saved information about video modes */
|
---|
193 | ULONG CurrentModeWidth;
|
---|
194 | ULONG CurrentModeHeight;
|
---|
195 | ULONG CurrentModeBPP;
|
---|
196 |
|
---|
197 | ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */
|
---|
198 | ULONG ulFrameBufferSize; /* The size of the current framebuffer. */
|
---|
199 | #endif
|
---|
200 | union {
|
---|
201 | /* Information that is only relevant to the primary device or is the same for all devices. */
|
---|
202 | struct {
|
---|
203 |
|
---|
204 | void *pvReqFlush; /* Pointer to preallocated generic request structure for
|
---|
205 | * VMMDevReq_VideoAccelFlush. Allocated when VBVA status
|
---|
206 | * is changed. Deallocated on HwReset.
|
---|
207 | */
|
---|
208 |
|
---|
209 |
|
---|
210 | ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */
|
---|
211 |
|
---|
212 | BOOLEAN bVBoxVideoSupported; /* TRUE if VBoxVideo extensions, including DualView, are supported by the host. */
|
---|
213 | #ifndef VBOXWDDM
|
---|
214 | int cDisplays; /* Number of displays. */
|
---|
215 | #endif
|
---|
216 | ULONG cbVRAM; /* The VRAM size. */
|
---|
217 |
|
---|
218 | ULONG cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap.
|
---|
219 | * It is at offset:
|
---|
220 | * cbAdapterMemorySize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE - cbMiniportHeap
|
---|
221 | */
|
---|
222 | PVOID pvMiniportHeap; /* The pointer to the miniport heap VRAM.
|
---|
223 | * This is mapped by miniport separately.
|
---|
224 | */
|
---|
225 | #ifdef VBOXWDDM
|
---|
226 | VBOXVDMAINFO Vdma;
|
---|
227 | # ifdef VBOXVDMA_WITH_VBVA
|
---|
228 | VBOXVBVAINFO Vbva;
|
---|
229 | # endif
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | #ifdef VBOX_WITH_HGSMI
|
---|
233 | volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */
|
---|
234 | volatile bool bHostCmdProcessing;
|
---|
235 | VBOXVCMNSPIN_LOCK pSynchLock;
|
---|
236 | #endif
|
---|
237 |
|
---|
238 | PVOID pvAdapterInformation; /* The pointer to the last 4K of VRAM.
|
---|
239 | * This is mapped by miniport separately.
|
---|
240 | */
|
---|
241 |
|
---|
242 | ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */
|
---|
243 |
|
---|
244 | BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */
|
---|
245 |
|
---|
246 | #ifndef VBOX_WITH_HGSMI
|
---|
247 | ULONG ulDisplayInformationSize; /* The size of the Display information, which is at offset:
|
---|
248 | * ulFrameBufferOffset + ulMaxFrameBufferSize.
|
---|
249 | */
|
---|
250 | #endif /* !VBOX_WITH_HGSMI */
|
---|
251 |
|
---|
252 | #ifdef VBOX_WITH_HGSMI
|
---|
253 | BOOLEAN bHGSMI; /* Whether HGSMI is enabled. */
|
---|
254 |
|
---|
255 | HGSMIAREA areaHostHeap; /* Host heap VRAM area. */
|
---|
256 |
|
---|
257 | HGSMICHANNELINFO channels;
|
---|
258 |
|
---|
259 | HGSMIHEAP hgsmiAdapterHeap;
|
---|
260 |
|
---|
261 | /* The IO Port Number for host commands. */
|
---|
262 | RTIOPORT IOPortHost;
|
---|
263 |
|
---|
264 | /* The IO Port Number for guest commands. */
|
---|
265 | RTIOPORT IOPortGuest;
|
---|
266 | # ifndef VBOXWDDM
|
---|
267 | /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */
|
---|
268 | VBOXVIDEOPORTPROCS VideoPortProcs;
|
---|
269 | # else
|
---|
270 | /* Display Port handle and callbacks */
|
---|
271 | DXGKRNL_INTERFACE DxgkInterface;
|
---|
272 | # endif
|
---|
273 | #endif /* VBOX_WITH_HGSMI */
|
---|
274 | } primary;
|
---|
275 |
|
---|
276 | /* Secondary device information. */
|
---|
277 | struct {
|
---|
278 | BOOLEAN bEnabled; /* Device enabled flag */
|
---|
279 | } secondary;
|
---|
280 | } u;
|
---|
281 |
|
---|
282 | #ifdef VBOX_WITH_HGSMI
|
---|
283 | HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */
|
---|
284 | #endif /* VBOX_WITH_HGSMI */
|
---|
285 |
|
---|
286 | #ifdef VBOXWDDM
|
---|
287 | PDEVICE_OBJECT pPDO;
|
---|
288 |
|
---|
289 | VBOXSHGSMILIST CtlList;
|
---|
290 | VBOXSHGSMILIST DmaCmdList;
|
---|
291 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
292 | VBOXSHGSMILIST VhwaCmdList;
|
---|
293 | #endif
|
---|
294 | BOOL bSetNotifyDxDpc;
|
---|
295 | BOOL bNotifyDxDpc;
|
---|
296 |
|
---|
297 | ULONG cSources;
|
---|
298 | /* currently we define the array for the max possible size since we do not know
|
---|
299 | * the monitor count at the DxgkDdiAddDevice,
|
---|
300 | * i.e. we obtain the monitor count in DxgkDdiStartDevice due to implementation of the currently re-used XPDM functionality
|
---|
301 | *
|
---|
302 | * @todo: use the dynamic array size calculated at DxgkDdiAddDevice
|
---|
303 | * */
|
---|
304 | VBOXWDDM_SOURCE aSources[VBOX_VIDEO_MAX_SCREENS];
|
---|
305 | #endif
|
---|
306 | } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
---|
307 |
|
---|
308 | #ifndef VBOXWDDM
|
---|
309 | #define DEV_MOUSE_HIDDEN(dev) ((dev)->pPrimary->u.primary.fMouseHidden)
|
---|
310 | #define DEV_SET_MOUSE_HIDDEN(dev) \
|
---|
311 | do { \
|
---|
312 | (dev)->pPrimary->u.primary.fMouseHidden = TRUE; \
|
---|
313 | } while (0)
|
---|
314 | #define DEV_SET_MOUSE_SHOWN(dev) \
|
---|
315 | do { \
|
---|
316 | (dev)->pPrimary->u.primary.fMouseHidden = FALSE; \
|
---|
317 | } while (0)
|
---|
318 | #else
|
---|
319 | #define DEV_MOUSE_HIDDEN(dev) ((dev)->u.primary.fMouseHidden)
|
---|
320 | #define DEV_SET_MOUSE_HIDDEN(dev) \
|
---|
321 | do { \
|
---|
322 | (dev)->u.primary.fMouseHidden = TRUE; \
|
---|
323 | } while (0)
|
---|
324 | #define DEV_SET_MOUSE_SHOWN(dev) \
|
---|
325 | do { \
|
---|
326 | (dev)->u.primary.fMouseHidden = FALSE; \
|
---|
327 | } while (0)
|
---|
328 | #endif
|
---|
329 | extern "C"
|
---|
330 | {
|
---|
331 | #ifndef VBOXWDDM
|
---|
332 | /* XPDM-WDDM common API */
|
---|
333 |
|
---|
334 | typedef PEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT;
|
---|
335 |
|
---|
336 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUchar(IN PUCHAR Port, IN UCHAR Value)
|
---|
337 | {
|
---|
338 | VideoPortWritePortUchar(Port,Value);
|
---|
339 | }
|
---|
340 |
|
---|
341 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUshort(IN PUSHORT Port, IN USHORT Value)
|
---|
342 | {
|
---|
343 | VideoPortWritePortUshort(Port,Value);
|
---|
344 | }
|
---|
345 |
|
---|
346 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUlong(IN PULONG Port, IN ULONG Value)
|
---|
347 | {
|
---|
348 | VideoPortWritePortUlong(Port,Value);
|
---|
349 | }
|
---|
350 |
|
---|
351 | DECLINLINE(UCHAR) VBoxVideoCmnPortReadUchar(IN PUCHAR Port)
|
---|
352 | {
|
---|
353 | return VideoPortReadPortUchar(Port);
|
---|
354 | }
|
---|
355 |
|
---|
356 | DECLINLINE(USHORT) VBoxVideoCmnPortReadUshort(IN PUSHORT Port)
|
---|
357 | {
|
---|
358 | return VideoPortReadPortUshort(Port);
|
---|
359 | }
|
---|
360 |
|
---|
361 | DECLINLINE(ULONG) VBoxVideoCmnPortReadUlong(IN PULONG Port)
|
---|
362 | {
|
---|
363 | return VideoPortReadPortUlong(Port);
|
---|
364 | }
|
---|
365 |
|
---|
366 | DECLINLINE(VOID) VBoxVideoCmnMemZero(PVOID pvMem, ULONG cbMem)
|
---|
367 | {
|
---|
368 | VideoPortZeroMemory(pvMem, cbMem);
|
---|
369 | }
|
---|
370 |
|
---|
371 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql)
|
---|
372 | {
|
---|
373 | pDeviceExtension->u.primary.VideoPortProcs.pfnAcquireSpinLock(pDeviceExtension, *SpinLock, OldIrql);
|
---|
374 | }
|
---|
375 |
|
---|
376 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquireAtDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
377 | {
|
---|
378 | pDeviceExtension->u.primary.VideoPortProcs.pfnAcquireSpinLockAtDpcLevel(pDeviceExtension, *SpinLock);
|
---|
379 | }
|
---|
380 |
|
---|
381 | DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql)
|
---|
382 | {
|
---|
383 | pDeviceExtension->u.primary.VideoPortProcs.pfnReleaseSpinLock(pDeviceExtension, *SpinLock, NewIrql);
|
---|
384 | }
|
---|
385 |
|
---|
386 | DECLINLINE(VOID) VBoxVideoCmnSpinLockReleaseFromDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
387 | {
|
---|
388 | pDeviceExtension->u.primary.VideoPortProcs.pfnReleaseSpinLockFromDpcLevel(pDeviceExtension, *SpinLock);
|
---|
389 | }
|
---|
390 |
|
---|
391 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
392 | {
|
---|
393 | return pDeviceExtension->u.primary.VideoPortProcs.pfnCreateSpinLock(pDeviceExtension, SpinLock);
|
---|
394 | }
|
---|
395 |
|
---|
396 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
397 | {
|
---|
398 | return pDeviceExtension->u.primary.VideoPortProcs.pfnDeleteSpinLock(pDeviceExtension, *SpinLock);
|
---|
399 | }
|
---|
400 |
|
---|
401 | DECLINLINE(LONG) VBoxVideoCmnEventSet(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
402 | {
|
---|
403 | return pDeviceExtension->u.primary.VideoPortProcs.pfnSetEvent(pDeviceExtension, *pEvent);
|
---|
404 | }
|
---|
405 |
|
---|
406 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventCreateNotification(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent, IN BOOLEAN bSignaled)
|
---|
407 | {
|
---|
408 | ULONG fFlags = NOTIFICATION_EVENT;
|
---|
409 | if(bSignaled)
|
---|
410 | fFlags |= INITIAL_EVENT_SIGNALED;
|
---|
411 |
|
---|
412 | return pDeviceExtension->u.primary.VideoPortProcs.pfnCreateEvent(pDeviceExtension, fFlags, NULL, pEvent);
|
---|
413 | }
|
---|
414 |
|
---|
415 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
416 | {
|
---|
417 | return pDeviceExtension->u.primary.VideoPortProcs.pfnDeleteEvent(pDeviceExtension, *pEvent);
|
---|
418 | }
|
---|
419 |
|
---|
420 | DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag)
|
---|
421 | {
|
---|
422 | return pDeviceExtension->u.primary.VideoPortProcs.pfnAllocatePool(pDeviceExtension, (VBOXVP_POOL_TYPE)VpNonPagedPool, NumberOfBytes, Tag);
|
---|
423 | }
|
---|
424 |
|
---|
425 | DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr)
|
---|
426 | {
|
---|
427 | pDeviceExtension->u.primary.VideoPortProcs.pfnFreePool(pDeviceExtension, Ptr);
|
---|
428 | }
|
---|
429 |
|
---|
430 | DECLINLINE(VP_STATUS) VBoxVideoCmnRegInit(IN PDEVICE_EXTENSION pDeviceExtension, OUT VBOXCMNREG *pReg)
|
---|
431 | {
|
---|
432 | *pReg = pDeviceExtension->pPrimary;
|
---|
433 | return NO_ERROR;
|
---|
434 | }
|
---|
435 |
|
---|
436 | DECLINLINE(VP_STATUS) VBoxVideoCmnRegFini(IN VBOXCMNREG Reg)
|
---|
437 | {
|
---|
438 | return NO_ERROR;
|
---|
439 | }
|
---|
440 |
|
---|
441 | VP_STATUS VBoxVideoCmnRegQueryDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t *pVal);
|
---|
442 |
|
---|
443 | VP_STATUS VBoxVideoCmnRegSetDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t Val);
|
---|
444 |
|
---|
445 | /* */
|
---|
446 |
|
---|
447 | RT_C_DECLS_BEGIN
|
---|
448 | ULONG DriverEntry(IN PVOID Context1, IN PVOID Context2);
|
---|
449 | RT_C_DECLS_END
|
---|
450 |
|
---|
451 | VP_STATUS VBoxVideoFindAdapter(
|
---|
452 | IN PVOID HwDeviceExtension,
|
---|
453 | IN PVOID HwContext,
|
---|
454 | IN PWSTR ArgumentString,
|
---|
455 | IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
|
---|
456 | OUT PUCHAR Again);
|
---|
457 |
|
---|
458 | BOOLEAN VBoxVideoInitialize(PVOID HwDeviceExtension);
|
---|
459 |
|
---|
460 | BOOLEAN VBoxVideoStartIO(
|
---|
461 | PVOID HwDeviceExtension,
|
---|
462 | PVIDEO_REQUEST_PACKET RequestPacket);
|
---|
463 |
|
---|
464 | #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)
|
---|
465 | BOOLEAN VBoxVideoInterrupt(PVOID HwDeviceExtension);
|
---|
466 | #endif
|
---|
467 |
|
---|
468 |
|
---|
469 | BOOLEAN VBoxVideoResetHW(
|
---|
470 | PVOID HwDeviceExtension,
|
---|
471 | ULONG Columns,
|
---|
472 | ULONG Rows);
|
---|
473 |
|
---|
474 | VP_STATUS VBoxVideoGetPowerState(
|
---|
475 | PVOID HwDeviceExtension,
|
---|
476 | ULONG HwId,
|
---|
477 | PVIDEO_POWER_MANAGEMENT VideoPowerControl);
|
---|
478 |
|
---|
479 | VP_STATUS VBoxVideoSetPowerState(
|
---|
480 | PVOID HwDeviceExtension,
|
---|
481 | ULONG HwId,
|
---|
482 | PVIDEO_POWER_MANAGEMENT VideoPowerControl);
|
---|
483 |
|
---|
484 | VP_STATUS VBoxVideoGetChildDescriptor(
|
---|
485 | PVOID HwDeviceExtension,
|
---|
486 | PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
|
---|
487 | PVIDEO_CHILD_TYPE VideoChildType,
|
---|
488 | PUCHAR pChildDescriptor,
|
---|
489 | PULONG pUId,
|
---|
490 | PULONG pUnused);
|
---|
491 |
|
---|
492 |
|
---|
493 | void VBoxSetupVideoPortFunctions(PDEVICE_EXTENSION PrimaryExtension,
|
---|
494 | VBOXVIDEOPORTPROCS *pCallbacks,
|
---|
495 | PVIDEO_PORT_CONFIG_INFO pConfigInfo);
|
---|
496 |
|
---|
497 | #else
|
---|
498 |
|
---|
499 | /* XPDM-WDDM common API */
|
---|
500 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUchar(IN PUCHAR Port, IN UCHAR Value)
|
---|
501 | {
|
---|
502 | WRITE_PORT_UCHAR(Port,Value);
|
---|
503 | }
|
---|
504 |
|
---|
505 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUshort(IN PUSHORT Port, IN USHORT Value)
|
---|
506 | {
|
---|
507 | WRITE_PORT_USHORT(Port,Value);
|
---|
508 | }
|
---|
509 |
|
---|
510 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUlong(IN PULONG Port, IN ULONG Value)
|
---|
511 | {
|
---|
512 | WRITE_PORT_ULONG(Port,Value);
|
---|
513 | }
|
---|
514 |
|
---|
515 | DECLINLINE(UCHAR) VBoxVideoCmnPortReadUchar(IN PUCHAR Port)
|
---|
516 | {
|
---|
517 | return READ_PORT_UCHAR(Port);
|
---|
518 | }
|
---|
519 |
|
---|
520 | DECLINLINE(USHORT) VBoxVideoCmnPortReadUshort(IN PUSHORT Port)
|
---|
521 | {
|
---|
522 | return READ_PORT_USHORT(Port);
|
---|
523 | }
|
---|
524 |
|
---|
525 | DECLINLINE(ULONG) VBoxVideoCmnPortReadUlong(IN PULONG Port)
|
---|
526 | {
|
---|
527 | return READ_PORT_ULONG(Port);
|
---|
528 | }
|
---|
529 |
|
---|
530 | DECLINLINE(VOID) VBoxVideoCmnMemZero(PVOID pvMem, ULONG cbMem)
|
---|
531 | {
|
---|
532 | memset(pvMem, 0, cbMem);
|
---|
533 | }
|
---|
534 |
|
---|
535 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql)
|
---|
536 | {
|
---|
537 | KeAcquireSpinLock(SpinLock, OldIrql);
|
---|
538 | }
|
---|
539 |
|
---|
540 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquireAtDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
541 | {
|
---|
542 | KeAcquireSpinLockAtDpcLevel(SpinLock);
|
---|
543 | }
|
---|
544 |
|
---|
545 | DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql)
|
---|
546 | {
|
---|
547 | KeReleaseSpinLock(SpinLock, NewIrql);
|
---|
548 | }
|
---|
549 |
|
---|
550 | DECLINLINE(VOID) VBoxVideoCmnSpinLockReleaseFromDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
551 | {
|
---|
552 | KeReleaseSpinLockFromDpcLevel(SpinLock);
|
---|
553 | }
|
---|
554 |
|
---|
555 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
556 | {
|
---|
557 | KeInitializeSpinLock(SpinLock);
|
---|
558 | return NO_ERROR;
|
---|
559 | }
|
---|
560 |
|
---|
561 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
562 | {
|
---|
563 | return NO_ERROR;
|
---|
564 | }
|
---|
565 |
|
---|
566 | DECLINLINE(LONG) VBoxVideoCmnEventSet(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
567 | {
|
---|
568 | return KeSetEvent(pEvent, 0, FALSE);
|
---|
569 | }
|
---|
570 |
|
---|
571 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventCreateNotification(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent, IN BOOLEAN bSignaled)
|
---|
572 | {
|
---|
573 | KeInitializeEvent(pEvent, NotificationEvent, bSignaled);
|
---|
574 | return NO_ERROR;
|
---|
575 | }
|
---|
576 |
|
---|
577 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
578 | {
|
---|
579 | return NO_ERROR;
|
---|
580 | }
|
---|
581 |
|
---|
582 | DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag)
|
---|
583 | {
|
---|
584 | return ExAllocatePoolWithTag(NonPagedPool, NumberOfBytes, Tag);
|
---|
585 | }
|
---|
586 |
|
---|
587 | DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr)
|
---|
588 | {
|
---|
589 | ExFreePool(Ptr);
|
---|
590 | }
|
---|
591 |
|
---|
592 | VP_STATUS VBoxVideoCmnRegInit(IN PDEVICE_EXTENSION pDeviceExtension, OUT VBOXCMNREG *pReg);
|
---|
593 |
|
---|
594 | DECLINLINE(VP_STATUS) VBoxVideoCmnRegFini(IN VBOXCMNREG Reg)
|
---|
595 | {
|
---|
596 | if(!Reg)
|
---|
597 | return ERROR_INVALID_PARAMETER;
|
---|
598 |
|
---|
599 | NTSTATUS Status = ZwClose(Reg);
|
---|
600 | return Status == STATUS_SUCCESS ? NO_ERROR : ERROR_INVALID_PARAMETER;
|
---|
601 | }
|
---|
602 |
|
---|
603 | VP_STATUS VBoxVideoCmnRegQueryDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t *pVal);
|
---|
604 |
|
---|
605 | VP_STATUS VBoxVideoCmnRegSetDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t Val);
|
---|
606 |
|
---|
607 | /* */
|
---|
608 |
|
---|
609 | RT_C_DECLS_BEGIN
|
---|
610 | NTSTATUS
|
---|
611 | DriverEntry(
|
---|
612 | IN PDRIVER_OBJECT DriverObject,
|
---|
613 | IN PUNICODE_STRING RegistryPath
|
---|
614 | );
|
---|
615 | RT_C_DECLS_END
|
---|
616 |
|
---|
617 | typedef struct VBOXWDDM_VIDEOMODES
|
---|
618 | {
|
---|
619 | VIDEO_MODE_INFORMATION *pModes;
|
---|
620 | uint32_t cModes;
|
---|
621 | D3DKMDT_2DREGION pResolutions;
|
---|
622 | uint32_t cResolutions;
|
---|
623 | int32_t iPreferrableMode;
|
---|
624 | int32_t iCustomMode;
|
---|
625 | } VBOXWDDM_VIDEOMODES;
|
---|
626 |
|
---|
627 | VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable,
|
---|
628 | VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, int32_t * pPreferrableMode,
|
---|
629 | D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions);
|
---|
630 |
|
---|
631 | VOID VBoxWddmInvalidateModesTable(PDEVICE_EXTENSION DeviceExtension);
|
---|
632 |
|
---|
633 | /* @return STATUS_BUFFER_TOO_SMALL - if buffer is too small, STATUS_SUCCESS - on success */
|
---|
634 | NTSTATUS VBoxWddmGetModesForResolution(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable,
|
---|
635 | D3DKMDT_2DREGION *pResolution,
|
---|
636 | VIDEO_MODE_INFORMATION * pModes, uint32_t cModes, uint32_t *pcModes, int32_t * piPreferrableMode);
|
---|
637 |
|
---|
638 | D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo);
|
---|
639 |
|
---|
640 | DECLINLINE(ULONG) vboxWddmVramCpuVisibleSize(PDEVICE_EXTENSION pDevExt)
|
---|
641 | {
|
---|
642 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
643 | /* all memory layout info should be initialized */
|
---|
644 | Assert(pDevExt->aSources[0].Vbva.offVBVA);
|
---|
645 | /* page aligned */
|
---|
646 | Assert(!(pDevExt->aSources[0].Vbva.offVBVA & 0xfff));
|
---|
647 |
|
---|
648 | return (ULONG)(pDevExt->aSources[0].Vbva.offVBVA & ~0xfffULL);
|
---|
649 | #else
|
---|
650 | /* all memory layout info should be initialized */
|
---|
651 | Assert(pDevExt->u.primary.Vdma.CmdHeap.area.offBase);
|
---|
652 | /* page aligned */
|
---|
653 | Assert(!(pDevExt->u.primary.Vdma.CmdHeap.area.offBase & 0xfff));
|
---|
654 |
|
---|
655 | return pDevExt->u.primary.Vdma.CmdHeap.area.offBase & ~0xfffUL;
|
---|
656 | #endif
|
---|
657 | }
|
---|
658 |
|
---|
659 | DECLINLINE(ULONG) vboxWddmVramCpuVisibleSegmentSize(PDEVICE_EXTENSION pDevExt)
|
---|
660 | {
|
---|
661 | return vboxWddmVramCpuVisibleSize(pDevExt);
|
---|
662 | }
|
---|
663 |
|
---|
664 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
665 | DECLINLINE(ULONG) vboxWddmVramCpuInvisibleSegmentSize(PDEVICE_EXTENSION pDevExt)
|
---|
666 | {
|
---|
667 | return vboxWddmVramCpuVisibleSegmentSize(pDevExt);
|
---|
668 | }
|
---|
669 |
|
---|
670 | DECLINLINE(bool) vboxWddmCmpSurfDescsBase(VBOXWDDM_SURFACE_DESC *pDesc1, VBOXWDDM_SURFACE_DESC *pDesc2)
|
---|
671 | {
|
---|
672 | if (pDesc1->width != pDesc2->width)
|
---|
673 | return false;
|
---|
674 | if (pDesc1->height != pDesc2->height)
|
---|
675 | return false;
|
---|
676 | if (pDesc1->format != pDesc2->format)
|
---|
677 | return false;
|
---|
678 | if (pDesc1->bpp != pDesc2->bpp)
|
---|
679 | return false;
|
---|
680 | if (pDesc1->pitch != pDesc2->pitch)
|
---|
681 | return false;
|
---|
682 | return true;
|
---|
683 | }
|
---|
684 |
|
---|
685 | DECLINLINE(void) vboxWddmAssignShadow(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
|
---|
686 | {
|
---|
687 | if (pSource->pShadowAllocation == pAllocation)
|
---|
688 | return;
|
---|
689 |
|
---|
690 | if (pSource->pShadowAllocation)
|
---|
691 | {
|
---|
692 | PVBOXWDDM_ALLOCATION pOldAlloc = pSource->pShadowAllocation;
|
---|
693 | /* clear the visibility info fo the current primary */
|
---|
694 | pOldAlloc->bVisible = FALSE;
|
---|
695 | pOldAlloc->bAssigned = FALSE;
|
---|
696 | Assert(pOldAlloc->SurfDesc.VidPnSourceId == srcId);
|
---|
697 | /* release the shadow surface */
|
---|
698 | pOldAlloc->SurfDesc.VidPnSourceId = D3DDDI_ID_UNINITIALIZED;
|
---|
699 | }
|
---|
700 |
|
---|
701 | if (pAllocation)
|
---|
702 | {
|
---|
703 | pAllocation->bVisible = FALSE;
|
---|
704 | /* this check ensures the shadow is not used for other source simultaneously */
|
---|
705 | Assert(pAllocation->SurfDesc.VidPnSourceId == D3DDDI_ID_UNINITIALIZED);
|
---|
706 | pAllocation->SurfDesc.VidPnSourceId = srcId;
|
---|
707 | pAllocation->bAssigned = TRUE;
|
---|
708 | if (!vboxWddmCmpSurfDescsBase(&pSource->SurfDesc, &pAllocation->SurfDesc))
|
---|
709 | pSource->offVram = VBOXVIDEOOFFSET_VOID; /* force guest->host notification */
|
---|
710 | pSource->SurfDesc = pAllocation->SurfDesc;
|
---|
711 | }
|
---|
712 |
|
---|
713 | pSource->pShadowAllocation = pAllocation;
|
---|
714 | }
|
---|
715 | #endif
|
---|
716 |
|
---|
717 | DECLINLINE(VOID) vboxWddmAssignPrimary(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
|
---|
718 | {
|
---|
719 | if (pSource->pPrimaryAllocation == pAllocation)
|
---|
720 | return;
|
---|
721 |
|
---|
722 | if (pSource->pPrimaryAllocation)
|
---|
723 | {
|
---|
724 | PVBOXWDDM_ALLOCATION pOldAlloc = pSource->pPrimaryAllocation;
|
---|
725 | /* clear the visibility info fo the current primary */
|
---|
726 | pOldAlloc->bVisible = FALSE;
|
---|
727 | pOldAlloc->bAssigned = FALSE;
|
---|
728 | Assert(pOldAlloc->SurfDesc.VidPnSourceId == srcId);
|
---|
729 | }
|
---|
730 |
|
---|
731 | if (pAllocation)
|
---|
732 | {
|
---|
733 | pAllocation->bVisible = FALSE;
|
---|
734 | Assert(pAllocation->SurfDesc.VidPnSourceId == srcId);
|
---|
735 | pAllocation->SurfDesc.VidPnSourceId = srcId;
|
---|
736 | pAllocation->bAssigned = TRUE;
|
---|
737 | }
|
---|
738 |
|
---|
739 | pSource->pPrimaryAllocation = pAllocation;
|
---|
740 | }
|
---|
741 |
|
---|
742 | #endif
|
---|
743 |
|
---|
744 | void* vboxHGSMIBufferAlloc(PDEVICE_EXTENSION PrimaryExtension,
|
---|
745 | HGSMISIZE cbData,
|
---|
746 | uint8_t u8Ch,
|
---|
747 | uint16_t u16Op);
|
---|
748 | void vboxHGSMIBufferFree (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer);
|
---|
749 | int vboxHGSMIBufferSubmit (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer);
|
---|
750 |
|
---|
751 | BOOLEAN FASTCALL VBoxVideoSetCurrentModePerform(PDEVICE_EXTENSION DeviceExtension,
|
---|
752 | USHORT width, USHORT height, USHORT bpp
|
---|
753 | #ifdef VBOXWDDM
|
---|
754 | , ULONG offDisplay
|
---|
755 | #endif
|
---|
756 | );
|
---|
757 |
|
---|
758 | BOOLEAN FASTCALL VBoxVideoSetCurrentMode(
|
---|
759 | PDEVICE_EXTENSION DeviceExtension,
|
---|
760 | PVIDEO_MODE RequestedMode,
|
---|
761 | PSTATUS_BLOCK StatusBlock);
|
---|
762 |
|
---|
763 | BOOLEAN FASTCALL VBoxVideoResetDevice(
|
---|
764 | PDEVICE_EXTENSION DeviceExtension,
|
---|
765 | PSTATUS_BLOCK StatusBlock);
|
---|
766 |
|
---|
767 | BOOLEAN FASTCALL VBoxVideoMapVideoMemory(
|
---|
768 | PDEVICE_EXTENSION DeviceExtension,
|
---|
769 | PVIDEO_MEMORY RequestedAddress,
|
---|
770 | PVIDEO_MEMORY_INFORMATION MapInformation,
|
---|
771 | PSTATUS_BLOCK StatusBlock);
|
---|
772 |
|
---|
773 | BOOLEAN FASTCALL VBoxVideoUnmapVideoMemory(
|
---|
774 | PDEVICE_EXTENSION DeviceExtension,
|
---|
775 | PVIDEO_MEMORY VideoMemory,
|
---|
776 | PSTATUS_BLOCK StatusBlock);
|
---|
777 |
|
---|
778 | BOOLEAN FASTCALL VBoxVideoQueryNumAvailModes(
|
---|
779 | PDEVICE_EXTENSION DeviceExtension,
|
---|
780 | PVIDEO_NUM_MODES Modes,
|
---|
781 | PSTATUS_BLOCK StatusBlock);
|
---|
782 |
|
---|
783 | BOOLEAN FASTCALL VBoxVideoQueryAvailModes(
|
---|
784 | PDEVICE_EXTENSION DeviceExtension,
|
---|
785 | PVIDEO_MODE_INFORMATION ReturnedModes,
|
---|
786 | PSTATUS_BLOCK StatusBlock);
|
---|
787 |
|
---|
788 | BOOLEAN FASTCALL VBoxVideoQueryCurrentMode(
|
---|
789 | PDEVICE_EXTENSION DeviceExtension,
|
---|
790 | PVIDEO_MODE_INFORMATION VideoModeInfo,
|
---|
791 | PSTATUS_BLOCK StatusBlock);
|
---|
792 |
|
---|
793 | BOOLEAN FASTCALL VBoxVideoSetColorRegisters(
|
---|
794 | PDEVICE_EXTENSION DeviceExtension,
|
---|
795 | PVIDEO_CLUT ColorLookUpTable,
|
---|
796 | PSTATUS_BLOCK StatusBlock);
|
---|
797 |
|
---|
798 | int VBoxMapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension,
|
---|
799 | void **ppv,
|
---|
800 | ULONG ulOffset,
|
---|
801 | ULONG ulSize);
|
---|
802 |
|
---|
803 | void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension,
|
---|
804 | void **ppv, ULONG ulSize);
|
---|
805 |
|
---|
806 | void VBoxComputeFrameBufferSizes (PDEVICE_EXTENSION PrimaryExtension);
|
---|
807 |
|
---|
808 | #ifdef VBOX_WITH_HGSMI
|
---|
809 |
|
---|
810 | /*
|
---|
811 | * Host and Guest port IO helpers.
|
---|
812 | */
|
---|
813 | DECLINLINE(void) VBoxHGSMIHostWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data)
|
---|
814 | {
|
---|
815 | #ifndef VBOXWDDM
|
---|
816 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost, data);
|
---|
817 | #else
|
---|
818 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->u.primary.IOPortHost, data);
|
---|
819 | #endif
|
---|
820 | }
|
---|
821 |
|
---|
822 | DECLINLINE(ULONG) VBoxHGSMIHostRead(PDEVICE_EXTENSION PrimaryExtension)
|
---|
823 | {
|
---|
824 | #ifndef VBOXWDDM
|
---|
825 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost);
|
---|
826 | #else
|
---|
827 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->u.primary.IOPortHost);
|
---|
828 | #endif
|
---|
829 | }
|
---|
830 |
|
---|
831 | DECLINLINE(void) VBoxHGSMIGuestWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data)
|
---|
832 | {
|
---|
833 | #ifndef VBOXWDDM
|
---|
834 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest, data);
|
---|
835 | #else
|
---|
836 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->u.primary.IOPortGuest, data);
|
---|
837 | #endif
|
---|
838 | }
|
---|
839 |
|
---|
840 | DECLINLINE(ULONG) VBoxHGSMIGuestRead(PDEVICE_EXTENSION PrimaryExtension)
|
---|
841 | {
|
---|
842 | #ifndef VBOXWDDM
|
---|
843 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest);
|
---|
844 | #else
|
---|
845 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->u.primary.IOPortGuest);
|
---|
846 | #endif
|
---|
847 | }
|
---|
848 |
|
---|
849 | BOOLEAN VBoxHGSMIIsSupported (PDEVICE_EXTENSION PrimaryExtension);
|
---|
850 |
|
---|
851 | VOID VBoxSetupDisplaysHGSMI (PDEVICE_EXTENSION PrimaryExtension,
|
---|
852 | #ifndef VBOXWDDM
|
---|
853 | PVIDEO_PORT_CONFIG_INFO pConfigInfo,
|
---|
854 | #endif
|
---|
855 | ULONG AdapterMemorySize);
|
---|
856 | BOOLEAN vboxUpdatePointerShape (PDEVICE_EXTENSION DeviceExtension,
|
---|
857 | PVIDEO_POINTER_ATTRIBUTES pointerAttr,
|
---|
858 | uint32_t cbLength);
|
---|
859 |
|
---|
860 | #ifdef VBOXWDDM
|
---|
861 | int VBoxFreeDisplaysHGSMI(PDEVICE_EXTENSION PrimaryExtension);
|
---|
862 | #else
|
---|
863 | DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd);
|
---|
864 | DECLCALLBACK(int) hgsmiHostCmdRequest (HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, struct _VBVAHOSTCMD ** ppCmd);
|
---|
865 | #endif
|
---|
866 |
|
---|
867 |
|
---|
868 | int vboxVBVAChannelDisplayEnable(PDEVICE_EXTENSION PrimaryExtension,
|
---|
869 | int iDisplay, /* negative would mean this is a miniport handler */
|
---|
870 | uint8_t u8Channel);
|
---|
871 |
|
---|
872 | VOID VBoxVideoHGSMIDpc(
|
---|
873 | IN PVOID HwDeviceExtension,
|
---|
874 | IN PVOID Context
|
---|
875 | );
|
---|
876 |
|
---|
877 | void HGSMIClearIrq (PDEVICE_EXTENSION PrimaryExtension);
|
---|
878 |
|
---|
879 | #endif /* VBOX_WITH_HGSMI */
|
---|
880 | } /* extern "C" */
|
---|
881 |
|
---|
882 | #endif /* VBOXVIDEO_H */
|
---|