1 | /** @file
|
---|
2 | * VirtualBox Video miniport driver
|
---|
3 | *
|
---|
4 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
15 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
16 | * additional information or have any questions.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef VBOXVIDEO_H
|
---|
20 | #define VBOXVIDEO_H
|
---|
21 |
|
---|
22 | #include <VBox/cdefs.h>
|
---|
23 | #include <VBox/types.h>
|
---|
24 | #include <iprt/assert.h>
|
---|
25 |
|
---|
26 | #ifdef VBOX_WITH_HGSMI
|
---|
27 | //#include <iprt/thread.h>
|
---|
28 |
|
---|
29 | #include <VBox/HGSMI/HGSMI.h>
|
---|
30 | #include <VBox/HGSMI/HGSMIChSetup.h>
|
---|
31 | #include "VBoxHGSMI.h"
|
---|
32 | #endif /* VBOX_WITH_HGSMI */
|
---|
33 |
|
---|
34 | RT_C_DECLS_BEGIN
|
---|
35 | #ifndef VBOXWDDM
|
---|
36 | #include "dderror.h"
|
---|
37 | #include "devioctl.h"
|
---|
38 | #include "miniport.h"
|
---|
39 | #include "ntddvdeo.h"
|
---|
40 | #include "video.h"
|
---|
41 | #else
|
---|
42 | # define VBOX_WITH_WORKAROUND_MISSING_PACK
|
---|
43 | # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
44 | # define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
|
---|
45 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
|
---|
46 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
|
---|
47 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
|
---|
48 | # define _interlockedbittestandset _interlockedbittestandset_StupidDDKVsCompilerCrap
|
---|
49 | # define _interlockedbittestandreset _interlockedbittestandreset_StupidDDKVsCompilerCrap
|
---|
50 | # define _interlockedbittestandset64 _interlockedbittestandset64_StupidDDKVsCompilerCrap
|
---|
51 | # define _interlockedbittestandreset64 _interlockedbittestandreset64_StupidDDKVsCompilerCrap
|
---|
52 | # pragma warning(disable : 4163)
|
---|
53 | # ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
|
---|
54 | # pragma warning(disable : 4103)
|
---|
55 | # endif
|
---|
56 | # include <ntddk.h>
|
---|
57 | # pragma warning(default : 4163)
|
---|
58 | # ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
|
---|
59 | # pragma pack()
|
---|
60 | # pragma warning(default : 4103)
|
---|
61 | # endif
|
---|
62 | # undef _InterlockedExchange
|
---|
63 | # undef _InterlockedExchangeAdd
|
---|
64 | # undef _InterlockedCompareExchange
|
---|
65 | # undef _InterlockedAddLargeStatistic
|
---|
66 | # undef _interlockedbittestandset
|
---|
67 | # undef _interlockedbittestandreset
|
---|
68 | # undef _interlockedbittestandset64
|
---|
69 | # undef _interlockedbittestandreset64
|
---|
70 | # else
|
---|
71 | # include <ntddk.h>
|
---|
72 | # endif
|
---|
73 | #include "dispmprt.h"
|
---|
74 | #include "ntddvdeo.h"
|
---|
75 | #include "dderror.h"
|
---|
76 | #endif
|
---|
77 | RT_C_DECLS_END
|
---|
78 |
|
---|
79 | #define VBE_DISPI_IOPORT_INDEX 0x01CE
|
---|
80 | #define VBE_DISPI_IOPORT_DATA 0x01CF
|
---|
81 | #define VBE_DISPI_INDEX_ID 0x0
|
---|
82 | #define VBE_DISPI_INDEX_XRES 0x1
|
---|
83 | #define VBE_DISPI_INDEX_YRES 0x2
|
---|
84 | #define VBE_DISPI_INDEX_BPP 0x3
|
---|
85 | #define VBE_DISPI_INDEX_ENABLE 0x4
|
---|
86 | #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
|
---|
87 | #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
|
---|
88 | #define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
|
---|
89 |
|
---|
90 | #define VBE_DISPI_ID2 0xB0C2
|
---|
91 | /* The VBOX interface id. Indicates support for VBE_DISPI_INDEX_VBOX_VIDEO. */
|
---|
92 | #define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
|
---|
93 | #ifdef VBOX_WITH_HGSMI
|
---|
94 | #define VBE_DISPI_ID_HGSMI 0xBE01
|
---|
95 | #endif /* VBOX_WITH_HGSMI */
|
---|
96 | #define VBE_DISPI_DISABLED 0x00
|
---|
97 | #define VBE_DISPI_ENABLED 0x01
|
---|
98 | #define VBE_DISPI_LFB_ENABLED 0x40
|
---|
99 | #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
|
---|
100 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
|
---|
101 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
|
---|
102 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
|
---|
103 |
|
---|
104 | #ifdef VBOX_WITH_HGSMI
|
---|
105 | #define VGA_PORT_HGSMI_HOST 0x3b0
|
---|
106 | #define VGA_PORT_HGSMI_GUEST 0x3d0
|
---|
107 | #endif /* VBOX_WITH_HGSMI */
|
---|
108 |
|
---|
109 | /* common API types */
|
---|
110 | #ifndef VBOXWDDM
|
---|
111 | typedef PSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK;
|
---|
112 | typedef UCHAR VBOXVCMNIRQL, *PVBOXVCMNIRQL;
|
---|
113 |
|
---|
114 | typedef PEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT;
|
---|
115 |
|
---|
116 | typedef struct _DEVICE_EXTENSION * VBOXCMNREG;
|
---|
117 | #else
|
---|
118 | #include <VBox/VBoxVideo.h>
|
---|
119 | #include "wddm/VBoxVideoShgsmi.h"
|
---|
120 | #include "wddm/VBoxVideoVdma.h"
|
---|
121 | #include "wddm/VBoxVideoWddm.h"
|
---|
122 |
|
---|
123 | typedef KSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK;
|
---|
124 | typedef KIRQL VBOXVCMNIRQL, *PVBOXVCMNIRQL;
|
---|
125 |
|
---|
126 | typedef KEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT;
|
---|
127 |
|
---|
128 | typedef HANDLE VBOXCMNREG;
|
---|
129 |
|
---|
130 | typedef struct VBOXWDDM_SOURCE
|
---|
131 | {
|
---|
132 | struct VBOXWDDM_ALLOCATION * pAllocation;
|
---|
133 | } VBOXWDDM_SOURCE, *PVBOXWDDM_SOURCE;
|
---|
134 |
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | typedef struct _DEVICE_EXTENSION
|
---|
138 | {
|
---|
139 | struct _DEVICE_EXTENSION *pNext; /* Next extension in the DualView extension list.
|
---|
140 | * The primary extension is the first one.
|
---|
141 | */
|
---|
142 | #ifndef VBOXWDDM
|
---|
143 | struct _DEVICE_EXTENSION *pPrimary; /* Pointer to the primary device extension. */
|
---|
144 |
|
---|
145 | ULONG iDevice; /* Device index: 0 for primary, otherwise a secondary device. */
|
---|
146 |
|
---|
147 | ULONG CurrentMode; /* Saved information about video modes */
|
---|
148 | ULONG CurrentModeWidth;
|
---|
149 | ULONG CurrentModeHeight;
|
---|
150 | ULONG CurrentModeBPP;
|
---|
151 |
|
---|
152 | ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */
|
---|
153 | ULONG ulFrameBufferSize; /* The size of the current framebuffer. */
|
---|
154 | #endif
|
---|
155 | union {
|
---|
156 | /* Information that is only relevant to the primary device or is the same for all devices. */
|
---|
157 | struct {
|
---|
158 |
|
---|
159 | void *pvReqFlush; /* Pointer to preallocated generic request structure for
|
---|
160 | * VMMDevReq_VideoAccelFlush. Allocated when VBVA status
|
---|
161 | * is changed. Deallocated on HwReset.
|
---|
162 | */
|
---|
163 |
|
---|
164 |
|
---|
165 | ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */
|
---|
166 |
|
---|
167 | BOOLEAN bVBoxVideoSupported; /* TRUE if VBoxVideo extensions, including DualView, are supported by the host. */
|
---|
168 |
|
---|
169 | int cDisplays; /* Number of displays. */
|
---|
170 |
|
---|
171 | ULONG cbVRAM; /* The VRAM size. */
|
---|
172 |
|
---|
173 | ULONG cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap.
|
---|
174 | * It is at offset:
|
---|
175 | * cbAdapterMemorySize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE - cbMiniportHeap
|
---|
176 | */
|
---|
177 | PVOID pvMiniportHeap; /* The pointer to the miniport heap VRAM.
|
---|
178 | * This is mapped by miniport separately.
|
---|
179 | */
|
---|
180 | #ifdef VBOXWDDM
|
---|
181 | VBOXVDMAINFO Vdma;
|
---|
182 | #endif
|
---|
183 |
|
---|
184 | #ifdef VBOX_WITH_HGSMI
|
---|
185 | volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */
|
---|
186 | volatile bool bHostCmdProcessing;
|
---|
187 | VBOXVCMNSPIN_LOCK pSynchLock;
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | PVOID pvAdapterInformation; /* The pointer to the last 4K of VRAM.
|
---|
191 | * This is mapped by miniport separately.
|
---|
192 | */
|
---|
193 |
|
---|
194 | ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */
|
---|
195 |
|
---|
196 | BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */
|
---|
197 |
|
---|
198 | #ifndef VBOX_WITH_HGSMI
|
---|
199 | ULONG ulDisplayInformationSize; /* The size of the Display information, which is at offset:
|
---|
200 | * ulFrameBufferOffset + ulMaxFrameBufferSize.
|
---|
201 | */
|
---|
202 | #endif /* !VBOX_WITH_HGSMI */
|
---|
203 |
|
---|
204 | #ifdef VBOX_WITH_HGSMI
|
---|
205 | BOOLEAN bHGSMI; /* Whether HGSMI is enabled. */
|
---|
206 |
|
---|
207 | HGSMIAREA areaHostHeap; /* Host heap VRAM area. */
|
---|
208 |
|
---|
209 | HGSMICHANNELINFO channels;
|
---|
210 |
|
---|
211 | HGSMIHEAP hgsmiAdapterHeap;
|
---|
212 |
|
---|
213 | /* The IO Port Number for host commands. */
|
---|
214 | RTIOPORT IOPortHost;
|
---|
215 |
|
---|
216 | /* The IO Port Number for guest commands. */
|
---|
217 | RTIOPORT IOPortGuest;
|
---|
218 | # ifndef VBOXWDDM
|
---|
219 | /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */
|
---|
220 | VBOXVIDEOPORTPROCS VideoPortProcs;
|
---|
221 | # else
|
---|
222 | /* Display Port handle and callbacks */
|
---|
223 | DXGKRNL_INTERFACE DxgkInterface;
|
---|
224 | # endif
|
---|
225 | #endif /* VBOX_WITH_HGSMI */
|
---|
226 | } primary;
|
---|
227 |
|
---|
228 | /* Secondary device information. */
|
---|
229 | struct {
|
---|
230 | BOOLEAN bEnabled; /* Device enabled flag */
|
---|
231 | } secondary;
|
---|
232 | } u;
|
---|
233 |
|
---|
234 | #ifdef VBOX_WITH_HGSMI
|
---|
235 | HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */
|
---|
236 | #endif /* VBOX_WITH_HGSMI */
|
---|
237 |
|
---|
238 | #ifdef VBOXWDDM
|
---|
239 | PDEVICE_OBJECT pPDO;
|
---|
240 |
|
---|
241 | VBOXSHGSMILIST CtlList;
|
---|
242 | VBOXSHGSMILIST DmaCmdList;
|
---|
243 | BOOL bSetNotifyDxDpc;
|
---|
244 | BOOL bNotifyDxDpc;
|
---|
245 |
|
---|
246 | ULONG cSources;
|
---|
247 | /* currently we define the array for the max possible size since we do not know
|
---|
248 | * the monitor count at the DxgkDdiAddDevice,
|
---|
249 | * i.e. we obtain the monitor count in DxgkDdiStartDevice due to implementation of the currently re-used XPDM functionality
|
---|
250 | *
|
---|
251 | * @todo: use the dynamic array size calculated at DxgkDdiAddDevice
|
---|
252 | * */
|
---|
253 | VBOXWDDM_SOURCE aSources[VBOX_VIDEO_MAX_SCREENS];
|
---|
254 | #endif
|
---|
255 | } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
---|
256 |
|
---|
257 | #ifndef VBOXWDDM
|
---|
258 | #define DEV_MOUSE_HIDDEN(dev) ((dev)->pPrimary->u.primary.fMouseHidden)
|
---|
259 | #define DEV_SET_MOUSE_HIDDEN(dev) \
|
---|
260 | do { \
|
---|
261 | (dev)->pPrimary->u.primary.fMouseHidden = TRUE; \
|
---|
262 | } while (0)
|
---|
263 | #define DEV_SET_MOUSE_SHOWN(dev) \
|
---|
264 | do { \
|
---|
265 | (dev)->pPrimary->u.primary.fMouseHidden = FALSE; \
|
---|
266 | } while (0)
|
---|
267 | #else
|
---|
268 | #define DEV_MOUSE_HIDDEN(dev) ((dev)->u.primary.fMouseHidden)
|
---|
269 | #define DEV_SET_MOUSE_HIDDEN(dev) \
|
---|
270 | do { \
|
---|
271 | (dev)->u.primary.fMouseHidden = TRUE; \
|
---|
272 | } while (0)
|
---|
273 | #define DEV_SET_MOUSE_SHOWN(dev) \
|
---|
274 | do { \
|
---|
275 | (dev)->u.primary.fMouseHidden = FALSE; \
|
---|
276 | } while (0)
|
---|
277 | #endif
|
---|
278 | extern "C"
|
---|
279 | {
|
---|
280 | #ifndef VBOXWDDM
|
---|
281 | /* XPDM-WDDM common API */
|
---|
282 |
|
---|
283 | typedef PEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT;
|
---|
284 |
|
---|
285 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUchar(IN PUCHAR Port, IN UCHAR Value)
|
---|
286 | {
|
---|
287 | VideoPortWritePortUchar(Port,Value);
|
---|
288 | }
|
---|
289 |
|
---|
290 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUshort(IN PUSHORT Port, IN USHORT Value)
|
---|
291 | {
|
---|
292 | VideoPortWritePortUshort(Port,Value);
|
---|
293 | }
|
---|
294 |
|
---|
295 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUlong(IN PULONG Port, IN ULONG Value)
|
---|
296 | {
|
---|
297 | VideoPortWritePortUlong(Port,Value);
|
---|
298 | }
|
---|
299 |
|
---|
300 | DECLINLINE(UCHAR) VBoxVideoCmnPortReadUchar(IN PUCHAR Port)
|
---|
301 | {
|
---|
302 | return VideoPortReadPortUchar(Port);
|
---|
303 | }
|
---|
304 |
|
---|
305 | DECLINLINE(USHORT) VBoxVideoCmnPortReadUshort(IN PUSHORT Port)
|
---|
306 | {
|
---|
307 | return VideoPortReadPortUshort(Port);
|
---|
308 | }
|
---|
309 |
|
---|
310 | DECLINLINE(ULONG) VBoxVideoCmnPortReadUlong(IN PULONG Port)
|
---|
311 | {
|
---|
312 | return VideoPortReadPortUlong(Port);
|
---|
313 | }
|
---|
314 |
|
---|
315 | DECLINLINE(VOID) VBoxVideoCmnMemZero(PVOID pvMem, ULONG cbMem)
|
---|
316 | {
|
---|
317 | VideoPortZeroMemory(pvMem, cbMem);
|
---|
318 | }
|
---|
319 |
|
---|
320 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql)
|
---|
321 | {
|
---|
322 | pDeviceExtension->u.primary.VideoPortProcs.pfnAcquireSpinLock(pDeviceExtension, *SpinLock, OldIrql);
|
---|
323 | }
|
---|
324 |
|
---|
325 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquireAtDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
326 | {
|
---|
327 | pDeviceExtension->u.primary.VideoPortProcs.pfnAcquireSpinLockAtDpcLevel(pDeviceExtension, *SpinLock);
|
---|
328 | }
|
---|
329 |
|
---|
330 | DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql)
|
---|
331 | {
|
---|
332 | pDeviceExtension->u.primary.VideoPortProcs.pfnReleaseSpinLock(pDeviceExtension, *SpinLock, NewIrql);
|
---|
333 | }
|
---|
334 |
|
---|
335 | DECLINLINE(VOID) VBoxVideoCmnSpinLockReleaseFromDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
336 | {
|
---|
337 | pDeviceExtension->u.primary.VideoPortProcs.pfnReleaseSpinLockFromDpcLevel(pDeviceExtension, *SpinLock);
|
---|
338 | }
|
---|
339 |
|
---|
340 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
341 | {
|
---|
342 | return pDeviceExtension->u.primary.VideoPortProcs.pfnCreateSpinLock(pDeviceExtension, SpinLock);
|
---|
343 | }
|
---|
344 |
|
---|
345 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
346 | {
|
---|
347 | return pDeviceExtension->u.primary.VideoPortProcs.pfnDeleteSpinLock(pDeviceExtension, *SpinLock);
|
---|
348 | }
|
---|
349 |
|
---|
350 | DECLINLINE(LONG) VBoxVideoCmnEventSet(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
351 | {
|
---|
352 | return pDeviceExtension->u.primary.VideoPortProcs.pfnSetEvent(pDeviceExtension, *pEvent);
|
---|
353 | }
|
---|
354 |
|
---|
355 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventCreateNotification(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent, IN BOOLEAN bSignaled)
|
---|
356 | {
|
---|
357 | ULONG fFlags = NOTIFICATION_EVENT;
|
---|
358 | if(bSignaled)
|
---|
359 | fFlags |= INITIAL_EVENT_SIGNALED;
|
---|
360 |
|
---|
361 | return pDeviceExtension->u.primary.VideoPortProcs.pfnCreateEvent(pDeviceExtension, fFlags, NULL, pEvent);
|
---|
362 | }
|
---|
363 |
|
---|
364 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
365 | {
|
---|
366 | return pDeviceExtension->u.primary.VideoPortProcs.pfnDeleteEvent(pDeviceExtension, *pEvent);
|
---|
367 | }
|
---|
368 |
|
---|
369 | DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag)
|
---|
370 | {
|
---|
371 | return pDeviceExtension->u.primary.VideoPortProcs.pfnAllocatePool(pDeviceExtension, (VBOXVP_POOL_TYPE)VpNonPagedPool, NumberOfBytes, Tag);
|
---|
372 | }
|
---|
373 |
|
---|
374 | DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr)
|
---|
375 | {
|
---|
376 | pDeviceExtension->u.primary.VideoPortProcs.pfnFreePool(pDeviceExtension, Ptr);
|
---|
377 | }
|
---|
378 |
|
---|
379 | DECLINLINE(VP_STATUS) VBoxVideoCmnRegInit(IN PDEVICE_EXTENSION pDeviceExtension, OUT VBOXCMNREG *pReg)
|
---|
380 | {
|
---|
381 | *pReg = pDeviceExtension->pPrimary;
|
---|
382 | return NO_ERROR;
|
---|
383 | }
|
---|
384 |
|
---|
385 | DECLINLINE(VP_STATUS) VBoxVideoCmnRegFini(IN VBOXCMNREG Reg)
|
---|
386 | {
|
---|
387 | return NO_ERROR;
|
---|
388 | }
|
---|
389 |
|
---|
390 | VP_STATUS VBoxVideoCmnRegQueryDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t *pVal);
|
---|
391 |
|
---|
392 | VP_STATUS VBoxVideoCmnRegSetDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t Val);
|
---|
393 |
|
---|
394 | /* */
|
---|
395 |
|
---|
396 | RT_C_DECLS_BEGIN
|
---|
397 | ULONG DriverEntry(IN PVOID Context1, IN PVOID Context2);
|
---|
398 | RT_C_DECLS_END
|
---|
399 |
|
---|
400 | VP_STATUS VBoxVideoFindAdapter(
|
---|
401 | IN PVOID HwDeviceExtension,
|
---|
402 | IN PVOID HwContext,
|
---|
403 | IN PWSTR ArgumentString,
|
---|
404 | IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
|
---|
405 | OUT PUCHAR Again);
|
---|
406 |
|
---|
407 | BOOLEAN VBoxVideoInitialize(PVOID HwDeviceExtension);
|
---|
408 |
|
---|
409 | BOOLEAN VBoxVideoStartIO(
|
---|
410 | PVOID HwDeviceExtension,
|
---|
411 | PVIDEO_REQUEST_PACKET RequestPacket);
|
---|
412 |
|
---|
413 | #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)
|
---|
414 | BOOLEAN VBoxVideoInterrupt(PVOID HwDeviceExtension);
|
---|
415 | #endif
|
---|
416 |
|
---|
417 |
|
---|
418 | BOOLEAN VBoxVideoResetHW(
|
---|
419 | PVOID HwDeviceExtension,
|
---|
420 | ULONG Columns,
|
---|
421 | ULONG Rows);
|
---|
422 |
|
---|
423 | VP_STATUS VBoxVideoGetPowerState(
|
---|
424 | PVOID HwDeviceExtension,
|
---|
425 | ULONG HwId,
|
---|
426 | PVIDEO_POWER_MANAGEMENT VideoPowerControl);
|
---|
427 |
|
---|
428 | VP_STATUS VBoxVideoSetPowerState(
|
---|
429 | PVOID HwDeviceExtension,
|
---|
430 | ULONG HwId,
|
---|
431 | PVIDEO_POWER_MANAGEMENT VideoPowerControl);
|
---|
432 |
|
---|
433 | VP_STATUS VBoxVideoGetChildDescriptor(
|
---|
434 | PVOID HwDeviceExtension,
|
---|
435 | PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
|
---|
436 | PVIDEO_CHILD_TYPE VideoChildType,
|
---|
437 | PUCHAR pChildDescriptor,
|
---|
438 | PULONG pUId,
|
---|
439 | PULONG pUnused);
|
---|
440 |
|
---|
441 |
|
---|
442 | void VBoxSetupVideoPortFunctions(PDEVICE_EXTENSION PrimaryExtension,
|
---|
443 | VBOXVIDEOPORTPROCS *pCallbacks,
|
---|
444 | PVIDEO_PORT_CONFIG_INFO pConfigInfo);
|
---|
445 |
|
---|
446 | #else
|
---|
447 |
|
---|
448 | /* XPDM-WDDM common API */
|
---|
449 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUchar(IN PUCHAR Port, IN UCHAR Value)
|
---|
450 | {
|
---|
451 | WRITE_PORT_UCHAR(Port,Value);
|
---|
452 | }
|
---|
453 |
|
---|
454 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUshort(IN PUSHORT Port, IN USHORT Value)
|
---|
455 | {
|
---|
456 | WRITE_PORT_USHORT(Port,Value);
|
---|
457 | }
|
---|
458 |
|
---|
459 | DECLINLINE(VOID) VBoxVideoCmnPortWriteUlong(IN PULONG Port, IN ULONG Value)
|
---|
460 | {
|
---|
461 | WRITE_PORT_ULONG(Port,Value);
|
---|
462 | }
|
---|
463 |
|
---|
464 | DECLINLINE(UCHAR) VBoxVideoCmnPortReadUchar(IN PUCHAR Port)
|
---|
465 | {
|
---|
466 | return READ_PORT_UCHAR(Port);
|
---|
467 | }
|
---|
468 |
|
---|
469 | DECLINLINE(USHORT) VBoxVideoCmnPortReadUshort(IN PUSHORT Port)
|
---|
470 | {
|
---|
471 | return READ_PORT_USHORT(Port);
|
---|
472 | }
|
---|
473 |
|
---|
474 | DECLINLINE(ULONG) VBoxVideoCmnPortReadUlong(IN PULONG Port)
|
---|
475 | {
|
---|
476 | return READ_PORT_ULONG(Port);
|
---|
477 | }
|
---|
478 |
|
---|
479 | DECLINLINE(VOID) VBoxVideoCmnMemZero(PVOID pvMem, ULONG cbMem)
|
---|
480 | {
|
---|
481 | memset(pvMem, 0, cbMem);
|
---|
482 | }
|
---|
483 |
|
---|
484 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql)
|
---|
485 | {
|
---|
486 | KeAcquireSpinLock(SpinLock, OldIrql);
|
---|
487 | }
|
---|
488 |
|
---|
489 | DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquireAtDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
490 | {
|
---|
491 | KeAcquireSpinLockAtDpcLevel(SpinLock);
|
---|
492 | }
|
---|
493 |
|
---|
494 | DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql)
|
---|
495 | {
|
---|
496 | KeReleaseSpinLock(SpinLock, NewIrql);
|
---|
497 | }
|
---|
498 |
|
---|
499 | DECLINLINE(VOID) VBoxVideoCmnSpinLockReleaseFromDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
500 | {
|
---|
501 | KeReleaseSpinLockFromDpcLevel(SpinLock);
|
---|
502 | }
|
---|
503 |
|
---|
504 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
505 | {
|
---|
506 | KeInitializeSpinLock(SpinLock);
|
---|
507 | return NO_ERROR;
|
---|
508 | }
|
---|
509 |
|
---|
510 | DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock)
|
---|
511 | {
|
---|
512 | return NO_ERROR;
|
---|
513 | }
|
---|
514 |
|
---|
515 | DECLINLINE(LONG) VBoxVideoCmnEventSet(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
516 | {
|
---|
517 | return KeSetEvent(pEvent, 0, FALSE);
|
---|
518 | }
|
---|
519 |
|
---|
520 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventCreateNotification(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent, IN BOOLEAN bSignaled)
|
---|
521 | {
|
---|
522 | KeInitializeEvent(pEvent, NotificationEvent, bSignaled);
|
---|
523 | return NO_ERROR;
|
---|
524 | }
|
---|
525 |
|
---|
526 | DECLINLINE(VP_STATUS) VBoxVideoCmnEventDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent)
|
---|
527 | {
|
---|
528 | return NO_ERROR;
|
---|
529 | }
|
---|
530 |
|
---|
531 | DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag)
|
---|
532 | {
|
---|
533 | return ExAllocatePoolWithTag(NonPagedPool, NumberOfBytes, Tag);
|
---|
534 | }
|
---|
535 |
|
---|
536 | DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr)
|
---|
537 | {
|
---|
538 | ExFreePool(Ptr);
|
---|
539 | }
|
---|
540 |
|
---|
541 | VP_STATUS VBoxVideoCmnRegInit(IN PDEVICE_EXTENSION pDeviceExtension, OUT VBOXCMNREG *pReg);
|
---|
542 |
|
---|
543 | DECLINLINE(VP_STATUS) VBoxVideoCmnRegFini(IN VBOXCMNREG Reg)
|
---|
544 | {
|
---|
545 | if(!Reg)
|
---|
546 | return ERROR_INVALID_PARAMETER;
|
---|
547 |
|
---|
548 | NTSTATUS Status = ZwClose(Reg);
|
---|
549 | return Status == STATUS_SUCCESS ? NO_ERROR : ERROR_INVALID_PARAMETER;
|
---|
550 | }
|
---|
551 |
|
---|
552 | VP_STATUS VBoxVideoCmnRegQueryDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t *pVal);
|
---|
553 |
|
---|
554 | VP_STATUS VBoxVideoCmnRegSetDword(IN VBOXCMNREG Reg, PWSTR pName, uint32_t Val);
|
---|
555 |
|
---|
556 | /* */
|
---|
557 |
|
---|
558 | RT_C_DECLS_BEGIN
|
---|
559 | NTSTATUS
|
---|
560 | DriverEntry(
|
---|
561 | IN PDRIVER_OBJECT DriverObject,
|
---|
562 | IN PUNICODE_STRING RegistryPath
|
---|
563 | );
|
---|
564 | RT_C_DECLS_END
|
---|
565 |
|
---|
566 | VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable,
|
---|
567 | VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode,
|
---|
568 | D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions);
|
---|
569 |
|
---|
570 | D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo);
|
---|
571 | UINT vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format);
|
---|
572 |
|
---|
573 | DECLINLINE(ULONG) vboxWddmVramReportedSize(PDEVICE_EXTENSION pDevExt)
|
---|
574 | {
|
---|
575 | return pDevExt->u.primary.Vdma.CmdHeap.area.offBase;
|
---|
576 | }
|
---|
577 |
|
---|
578 | NTSTATUS vboxVidPnCheckTopology(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
579 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
580 | BOOLEAN *pbSupported);
|
---|
581 |
|
---|
582 | NTSTATUS vboxVidPnCheckSourceModeInfo(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
583 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo,
|
---|
584 | BOOLEAN *pbSupported);
|
---|
585 |
|
---|
586 | NTSTATUS vboxVidPnCheckSourceModeSet(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
587 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
588 | BOOLEAN *pbSupported);
|
---|
589 |
|
---|
590 | NTSTATUS vboxVidPnCheckTargetModeInfo(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
591 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo,
|
---|
592 | BOOLEAN *pbSupported);
|
---|
593 |
|
---|
594 | NTSTATUS vboxVidPnCheckTargetModeSet(const D3DKMDT_HVIDPN hDesiredVidPn,
|
---|
595 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
596 | BOOLEAN *pbSupported);
|
---|
597 |
|
---|
598 | typedef struct VBOXVIDPNCOFUNCMODALITY
|
---|
599 | {
|
---|
600 | NTSTATUS Status;
|
---|
601 | CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* pEnumCofuncModalityArg;
|
---|
602 | /* legacy mode information populated by the common XPDM-WDDM layer */
|
---|
603 | uint32_t cModes;
|
---|
604 | uint32_t iPreferredMode;
|
---|
605 | VIDEO_MODE_INFORMATION *pModes;
|
---|
606 | uint32_t cResolutions;
|
---|
607 | D3DKMDT_2DREGION *pResolutions;
|
---|
608 | }VBOXVIDPNCOFUNCMODALITY, *PVBOXVIDPNCOFUNCMODALITY;
|
---|
609 |
|
---|
610 | /* !!!NOTE: The callback is responsible for releasing the path */
|
---|
611 | typedef DECLCALLBACK(BOOLEAN) FNVBOXVIDPNENUMPATHS(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
612 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
613 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo, PVOID pContext);
|
---|
614 | typedef FNVBOXVIDPNENUMPATHS *PFNVBOXVIDPNENUMPATHS;
|
---|
615 |
|
---|
616 | /* !!!NOTE: The callback is responsible for releasing the source mode info */
|
---|
617 | typedef DECLCALLBACK(BOOLEAN) FNVBOXVIDPNENUMSOURCEMODES(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
618 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
619 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext);
|
---|
620 | typedef FNVBOXVIDPNENUMSOURCEMODES *PFNVBOXVIDPNENUMSOURCEMODES;
|
---|
621 |
|
---|
622 | /* !!!NOTE: The callback is responsible for releasing the target mode info */
|
---|
623 | typedef DECLCALLBACK(BOOLEAN) FNVBOXVIDPNENUMTARGETMODES(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
624 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
625 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext);
|
---|
626 | typedef FNVBOXVIDPNENUMTARGETMODES *PFNVBOXVIDPNENUMTARGETMODES;
|
---|
627 |
|
---|
628 |
|
---|
629 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityPathEnum(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
630 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
631 | const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo, PVOID pContext);
|
---|
632 |
|
---|
633 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalitySourceModeEnum(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
634 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
635 | const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext);
|
---|
636 |
|
---|
637 | DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityTargetModeEnum(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
638 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
639 | const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext);
|
---|
640 |
|
---|
641 | NTSTATUS vboxVidPnEnumPaths(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
642 | D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
|
---|
643 | PFNVBOXVIDPNENUMPATHS pfnCallback, PVOID pContext);
|
---|
644 |
|
---|
645 | NTSTATUS vboxVidPnEnumSourceModes(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
646 | D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
|
---|
647 | PFNVBOXVIDPNENUMSOURCEMODES pfnCallback, PVOID pContext);
|
---|
648 |
|
---|
649 | NTSTATUS vboxVidPnEnumTargetModes(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
|
---|
650 | D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
|
---|
651 | PFNVBOXVIDPNENUMTARGETMODES pfnCallback, PVOID pContext);
|
---|
652 | #endif
|
---|
653 |
|
---|
654 | BOOLEAN FASTCALL VBoxVideoSetCurrentMode(
|
---|
655 | PDEVICE_EXTENSION DeviceExtension,
|
---|
656 | PVIDEO_MODE RequestedMode,
|
---|
657 | PSTATUS_BLOCK StatusBlock);
|
---|
658 |
|
---|
659 | BOOLEAN FASTCALL VBoxVideoResetDevice(
|
---|
660 | PDEVICE_EXTENSION DeviceExtension,
|
---|
661 | PSTATUS_BLOCK StatusBlock);
|
---|
662 |
|
---|
663 | BOOLEAN FASTCALL VBoxVideoMapVideoMemory(
|
---|
664 | PDEVICE_EXTENSION DeviceExtension,
|
---|
665 | PVIDEO_MEMORY RequestedAddress,
|
---|
666 | PVIDEO_MEMORY_INFORMATION MapInformation,
|
---|
667 | PSTATUS_BLOCK StatusBlock);
|
---|
668 |
|
---|
669 | BOOLEAN FASTCALL VBoxVideoUnmapVideoMemory(
|
---|
670 | PDEVICE_EXTENSION DeviceExtension,
|
---|
671 | PVIDEO_MEMORY VideoMemory,
|
---|
672 | PSTATUS_BLOCK StatusBlock);
|
---|
673 |
|
---|
674 | BOOLEAN FASTCALL VBoxVideoQueryNumAvailModes(
|
---|
675 | PDEVICE_EXTENSION DeviceExtension,
|
---|
676 | PVIDEO_NUM_MODES Modes,
|
---|
677 | PSTATUS_BLOCK StatusBlock);
|
---|
678 |
|
---|
679 | BOOLEAN FASTCALL VBoxVideoQueryAvailModes(
|
---|
680 | PDEVICE_EXTENSION DeviceExtension,
|
---|
681 | PVIDEO_MODE_INFORMATION ReturnedModes,
|
---|
682 | PSTATUS_BLOCK StatusBlock);
|
---|
683 |
|
---|
684 | BOOLEAN FASTCALL VBoxVideoQueryCurrentMode(
|
---|
685 | PDEVICE_EXTENSION DeviceExtension,
|
---|
686 | PVIDEO_MODE_INFORMATION VideoModeInfo,
|
---|
687 | PSTATUS_BLOCK StatusBlock);
|
---|
688 |
|
---|
689 | BOOLEAN FASTCALL VBoxVideoSetColorRegisters(
|
---|
690 | PDEVICE_EXTENSION DeviceExtension,
|
---|
691 | PVIDEO_CLUT ColorLookUpTable,
|
---|
692 | PSTATUS_BLOCK StatusBlock);
|
---|
693 |
|
---|
694 | int VBoxMapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension,
|
---|
695 | void **ppv,
|
---|
696 | ULONG ulOffset,
|
---|
697 | ULONG ulSize);
|
---|
698 |
|
---|
699 | void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension,
|
---|
700 | void **ppv, ULONG ulSize);
|
---|
701 |
|
---|
702 | void VBoxComputeFrameBufferSizes (PDEVICE_EXTENSION PrimaryExtension);
|
---|
703 |
|
---|
704 | #ifdef VBOX_WITH_HGSMI
|
---|
705 |
|
---|
706 | /*
|
---|
707 | * Host and Guest port IO helpers.
|
---|
708 | */
|
---|
709 | DECLINLINE(void) VBoxHGSMIHostWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data)
|
---|
710 | {
|
---|
711 | #ifndef VBOXWDDM
|
---|
712 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost, data);
|
---|
713 | #else
|
---|
714 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->u.primary.IOPortHost, data);
|
---|
715 | #endif
|
---|
716 | }
|
---|
717 |
|
---|
718 | DECLINLINE(ULONG) VBoxHGSMIHostRead(PDEVICE_EXTENSION PrimaryExtension)
|
---|
719 | {
|
---|
720 | #ifndef VBOXWDDM
|
---|
721 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost);
|
---|
722 | #else
|
---|
723 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->u.primary.IOPortHost);
|
---|
724 | #endif
|
---|
725 | }
|
---|
726 |
|
---|
727 | DECLINLINE(void) VBoxHGSMIGuestWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data)
|
---|
728 | {
|
---|
729 | #ifndef VBOXWDDM
|
---|
730 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest, data);
|
---|
731 | #else
|
---|
732 | VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->u.primary.IOPortGuest, data);
|
---|
733 | #endif
|
---|
734 | }
|
---|
735 |
|
---|
736 | DECLINLINE(ULONG) VBoxHGSMIGuestRead(PDEVICE_EXTENSION PrimaryExtension)
|
---|
737 | {
|
---|
738 | #ifndef VBOXWDDM
|
---|
739 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest);
|
---|
740 | #else
|
---|
741 | return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->u.primary.IOPortGuest);
|
---|
742 | #endif
|
---|
743 | }
|
---|
744 |
|
---|
745 | BOOLEAN VBoxHGSMIIsSupported (PDEVICE_EXTENSION PrimaryExtension);
|
---|
746 |
|
---|
747 | VOID VBoxSetupDisplaysHGSMI (PDEVICE_EXTENSION PrimaryExtension,
|
---|
748 | #ifndef VBOXWDDM
|
---|
749 | PVIDEO_PORT_CONFIG_INFO pConfigInfo,
|
---|
750 | #endif
|
---|
751 | ULONG AdapterMemorySize);
|
---|
752 | BOOLEAN vboxUpdatePointerShape (PDEVICE_EXTENSION DeviceExtension,
|
---|
753 | PVIDEO_POINTER_ATTRIBUTES pointerAttr,
|
---|
754 | uint32_t cbLength);
|
---|
755 | #ifndef VBOXWDDM
|
---|
756 | DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd);
|
---|
757 | DECLCALLBACK(int) hgsmiHostCmdRequest (HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, struct _VBVAHOSTCMD ** ppCmd);
|
---|
758 | #endif
|
---|
759 |
|
---|
760 |
|
---|
761 | int vboxVBVAChannelDisplayEnable(PDEVICE_EXTENSION PrimaryExtension,
|
---|
762 | int iDisplay, /* negative would mean this is a miniport handler */
|
---|
763 | uint8_t u8Channel);
|
---|
764 |
|
---|
765 | VOID VBoxVideoHGSMIDpc(
|
---|
766 | IN PVOID HwDeviceExtension,
|
---|
767 | IN PVOID Context
|
---|
768 | );
|
---|
769 |
|
---|
770 | void HGSMIClearIrq (PDEVICE_EXTENSION PrimaryExtension);
|
---|
771 |
|
---|
772 | #endif /* VBOX_WITH_HGSMI */
|
---|
773 | } /* extern "C" */
|
---|
774 |
|
---|
775 | #endif /* VBOXVIDEO_H */
|
---|