1 | /** @file
|
---|
2 | * VirtualBox Video miniport driver
|
---|
3 | *
|
---|
4 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
10 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
11 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
12 | * 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 | __BEGIN_DECLS
|
---|
23 | #include "dderror.h"
|
---|
24 | #include "devioctl.h"
|
---|
25 | #include "miniport.h"
|
---|
26 | #include "ntddvdeo.h"
|
---|
27 | #include "video.h"
|
---|
28 | __END_DECLS
|
---|
29 |
|
---|
30 |
|
---|
31 | #define VBE_DISPI_IOPORT_INDEX 0x01CE
|
---|
32 | #define VBE_DISPI_IOPORT_DATA 0x01CF
|
---|
33 | #define VBE_DISPI_INDEX_ID 0x0
|
---|
34 | #define VBE_DISPI_INDEX_XRES 0x1
|
---|
35 | #define VBE_DISPI_INDEX_YRES 0x2
|
---|
36 | #define VBE_DISPI_INDEX_BPP 0x3
|
---|
37 | #define VBE_DISPI_INDEX_ENABLE 0x4
|
---|
38 | #define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
|
---|
39 | #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
|
---|
40 | #define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
|
---|
41 | #define VBE_DISPI_ID2 0xB0C2
|
---|
42 | /* The VBOX interface id. Indicates support for VBE_DISPI_INDEX_VBOX_VIDEO. */
|
---|
43 | #define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
|
---|
44 | #define VBE_DISPI_DISABLED 0x00
|
---|
45 | #define VBE_DISPI_ENABLED 0x01
|
---|
46 | #define VBE_DISPI_LFB_ENABLED 0x40
|
---|
47 | #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
|
---|
48 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
|
---|
49 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
|
---|
50 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
|
---|
51 |
|
---|
52 | typedef struct _DEVICE_EXTENSION
|
---|
53 | {
|
---|
54 | struct _DEVICE_EXTENSION *pNext; /* Next extension in the DualView extension list.
|
---|
55 | * The primary extension is the first one.
|
---|
56 | */
|
---|
57 |
|
---|
58 | struct _DEVICE_EXTENSION *pPrimary; /* Pointer to the primary device extension. */
|
---|
59 |
|
---|
60 | ULONG iDevice; /* Device index: 0 for primary, otherwise a secondary device. */
|
---|
61 |
|
---|
62 |
|
---|
63 | ULONG CurrentMode; /* Saved information about video modes */
|
---|
64 |
|
---|
65 | ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */
|
---|
66 | ULONG ulFrameBufferSize; /* The size of the current framebuffer. */
|
---|
67 |
|
---|
68 | union {
|
---|
69 | /* Information that is only relevant to the primary device or is the same for all devices. */
|
---|
70 | struct {
|
---|
71 |
|
---|
72 | void *pvReqFlush; /* Pointer to preallocated generic request structure for
|
---|
73 | * VMMDevReq_VideoAccelFlush. Allocated when VBVA status
|
---|
74 | * is changed. Deallocated on HwReset.
|
---|
75 | */
|
---|
76 |
|
---|
77 |
|
---|
78 | ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */
|
---|
79 |
|
---|
80 | BOOLEAN bVBoxVideoSupported; /* TRUE if VBoxVideo extensions, including DualView, are supported by the host. */
|
---|
81 |
|
---|
82 | int cDisplays; /* Number of displays. */
|
---|
83 |
|
---|
84 | ULONG cbVRAM; /* The VRAM size. */
|
---|
85 |
|
---|
86 | ULONG cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap.
|
---|
87 | * It is at offset:
|
---|
88 | * cbAdapterMemorySize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE - cbMiniportHeap
|
---|
89 | */
|
---|
90 | PVOID pvMiniportHeap; /* The pointer to the miniport heap VRAM.
|
---|
91 | * This is mapped by miniport separately.
|
---|
92 | */
|
---|
93 |
|
---|
94 | PVOID pvAdapterInformation; /* The pointer to the last 4K of VRAM.
|
---|
95 | * This is mapped by miniport separately.
|
---|
96 | */
|
---|
97 |
|
---|
98 | ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */
|
---|
99 |
|
---|
100 | ULONG ulDisplayInformationSize; /* The size of the Display information, which is at offset:
|
---|
101 | * ulFrameBufferOffset + ulMaxFrameBufferSize.
|
---|
102 | */
|
---|
103 |
|
---|
104 | } primary;
|
---|
105 |
|
---|
106 | /* Secondary device information. */
|
---|
107 | struct {
|
---|
108 | BOOLEAN bEnabled; /* Device enabled flag */
|
---|
109 | } secondary;
|
---|
110 | } u;
|
---|
111 | } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
---|
112 |
|
---|
113 | extern "C"
|
---|
114 | {
|
---|
115 |
|
---|
116 | __BEGIN_DECLS
|
---|
117 | ULONG DriverEntry(IN PVOID Context1, IN PVOID Context2);
|
---|
118 | __END_DECLS
|
---|
119 |
|
---|
120 | VP_STATUS VBoxVideoFindAdapter(
|
---|
121 | IN PVOID HwDeviceExtension,
|
---|
122 | IN PVOID HwContext,
|
---|
123 | IN PWSTR ArgumentString,
|
---|
124 | IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
|
---|
125 | OUT PUCHAR Again);
|
---|
126 |
|
---|
127 | BOOLEAN VBoxVideoInitialize(PVOID HwDeviceExtension);
|
---|
128 |
|
---|
129 | BOOLEAN VBoxVideoStartIO(
|
---|
130 | PVOID HwDeviceExtension,
|
---|
131 | PVIDEO_REQUEST_PACKET RequestPacket);
|
---|
132 |
|
---|
133 | BOOLEAN VBoxVideoResetHW(
|
---|
134 | PVOID HwDeviceExtension,
|
---|
135 | ULONG Columns,
|
---|
136 | ULONG Rows);
|
---|
137 |
|
---|
138 | VP_STATUS VBoxVideoGetPowerState(
|
---|
139 | PVOID HwDeviceExtension,
|
---|
140 | ULONG HwId,
|
---|
141 | PVIDEO_POWER_MANAGEMENT VideoPowerControl);
|
---|
142 |
|
---|
143 | VP_STATUS VBoxVideoSetPowerState(
|
---|
144 | PVOID HwDeviceExtension,
|
---|
145 | ULONG HwId,
|
---|
146 | PVIDEO_POWER_MANAGEMENT VideoPowerControl);
|
---|
147 |
|
---|
148 | BOOLEAN FASTCALL VBoxVideoSetCurrentMode(
|
---|
149 | PDEVICE_EXTENSION DeviceExtension,
|
---|
150 | PVIDEO_MODE RequestedMode,
|
---|
151 | PSTATUS_BLOCK StatusBlock);
|
---|
152 |
|
---|
153 | BOOLEAN FASTCALL VBoxVideoResetDevice(
|
---|
154 | PDEVICE_EXTENSION DeviceExtension,
|
---|
155 | PSTATUS_BLOCK StatusBlock);
|
---|
156 |
|
---|
157 | BOOLEAN FASTCALL VBoxVideoMapVideoMemory(
|
---|
158 | PDEVICE_EXTENSION DeviceExtension,
|
---|
159 | PVIDEO_MEMORY RequestedAddress,
|
---|
160 | PVIDEO_MEMORY_INFORMATION MapInformation,
|
---|
161 | PSTATUS_BLOCK StatusBlock);
|
---|
162 |
|
---|
163 | BOOLEAN FASTCALL VBoxVideoUnmapVideoMemory(
|
---|
164 | PDEVICE_EXTENSION DeviceExtension,
|
---|
165 | PVIDEO_MEMORY VideoMemory,
|
---|
166 | PSTATUS_BLOCK StatusBlock);
|
---|
167 |
|
---|
168 | BOOLEAN FASTCALL VBoxVideoQueryNumAvailModes(
|
---|
169 | PDEVICE_EXTENSION DeviceExtension,
|
---|
170 | PVIDEO_NUM_MODES Modes,
|
---|
171 | PSTATUS_BLOCK StatusBlock);
|
---|
172 |
|
---|
173 | BOOLEAN FASTCALL VBoxVideoQueryAvailModes(
|
---|
174 | PDEVICE_EXTENSION DeviceExtension,
|
---|
175 | PVIDEO_MODE_INFORMATION ReturnedModes,
|
---|
176 | PSTATUS_BLOCK StatusBlock);
|
---|
177 |
|
---|
178 | BOOLEAN FASTCALL VBoxVideoQueryCurrentMode(
|
---|
179 | PDEVICE_EXTENSION DeviceExtension,
|
---|
180 | PVIDEO_MODE_INFORMATION VideoModeInfo,
|
---|
181 | PSTATUS_BLOCK StatusBlock);
|
---|
182 |
|
---|
183 | BOOLEAN FASTCALL VBoxVideoSetColorRegisters(
|
---|
184 | PDEVICE_EXTENSION DeviceExtension,
|
---|
185 | PVIDEO_CLUT ColorLookUpTable,
|
---|
186 | PSTATUS_BLOCK StatusBlock);
|
---|
187 |
|
---|
188 | VP_STATUS VBoxVideoGetChildDescriptor(
|
---|
189 | PVOID HwDeviceExtension,
|
---|
190 | PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
|
---|
191 | PVIDEO_CHILD_TYPE VideoChildType,
|
---|
192 | PUCHAR pChildDescriptor,
|
---|
193 | PULONG pUId,
|
---|
194 | PULONG pUnused);
|
---|
195 |
|
---|
196 | } /* extern "C" */
|
---|
197 |
|
---|
198 | #endif /* VBOXVIDEO_H */
|
---|