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