2 * ReactOS VBE miniport video driver
4 * Copyright (C) 2004 Filip Navara
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 /* INCLUDES *******************************************************************/
30 #define TAG_VBE ' EBV'
33 * Compile-time define to get VBE 1.2 support. The implementation
34 * is far from complete now and so it's left undefined.
37 /* #define VBE12_SUPPORT */
42 * VBE Command Definitions
45 #define VBE_GET_CONTROLLER_INFORMATION 0x4F00
46 #define VBE_GET_MODE_INFORMATION 0x4F01
47 #define VBE_SET_VBE_MODE 0x4F02
48 #define VBE_GET_CURRENT_VBE_MODE 0x4F03
49 #define VBE_SAVE_RESTORE_STATE 0x4F04
50 #define VBE_DISPLAY_WINDOW_CONTROL 0x4F05
51 #define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH 0x4F06
52 #define VBE_SET_GET_DISPLAY_START 0x4F07
53 #define VBE_SET_GET_DAC_PALETTE_FORMAT 0x4F08
54 #define VBE_SET_GET_PALETTE_DATA 0x4F09
57 #define VBE_RETURN_PROTECTED_MODE_INTERFACE 0x4F0A
58 #define VBE_GET_SET_PIXEL_CLOCK 0x4F0B
61 #define VBE_POWER_MANAGEMENT_EXTENSIONS 0x4F10
62 #define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS 0x4F11
63 #define VBE_AUDIO_INTERFACE_EXTENSIONS 0x4F12
64 #define VBE_OEM_EXTENSIONS 0x4F13
65 #define VBE_DISPLAY_DATA_CHANNEL 0x4F14
66 #define VBE_DDC 0x4F15
69 * VBE DDC Sub-Functions
72 #define VBE_DDC_READ_EDID 0x01
73 #define VBE_DDC_REPORT_CAPABILITIES 0x10
74 #define VBE_DDC_BEGIN_SCL_SDA_CONTROL 0x11
75 #define VBE_DDC_END_SCL_SDA_CONTROL 0x12
76 #define VBE_DDC_WRITE_SCL_CLOCK_LINE 0x13
77 #define VBE_DDC_WRITE_SDA_DATA_LINE 0x14
78 #define VBE_DDC_READ_SCL_CLOCK_LINE 0x15
79 #define VBE_DDC_READ_SDA_DATA_LINE 0x16
82 * VBE Video Mode Information Definitions
85 #define VBE_MODEATTR_LINEAR 0x80
87 #define VBE_MEMORYMODEL_PACKEDPIXEL 0x04
88 #define VBE_MEMORYMODEL_DIRECTCOLOR 0x06
94 #define VBE_SUCCESS 0x4F
95 #define VBE_UNSUCCESSFUL 0x14F
96 #define VBE_NOT_SUPPORTED 0x24F
97 #define VBE_FUNCTION_INVALID 0x34F
99 #define VBE_GETRETURNCODE(x) (x & 0xFFFF)
102 * VBE specification defined structure for general adapter info
103 * returned by function VBE_GET_CONTROLLER_INFORMATION command.
114 USHORT OemSoftwareRevision
;
115 ULONG OemVendorNamePtr
;
116 ULONG OemProductNamePtr
;
117 ULONG OemProductRevPtr
;
120 } VBE_INFO
, *PVBE_INFO
;
123 * VBE specification defined structure for specific video mode
124 * info returned by function VBE_GET_MODE_INFORMATION command.
129 /* Mandatory information for all VBE revisions */
130 USHORT ModeAttributes
;
131 UCHAR WinAAttributes
;
132 UCHAR WinBAttributes
;
133 USHORT WinGranularity
;
138 USHORT BytesPerScanLine
;
140 /* Mandatory information for VBE 1.2 and above */
145 UCHAR NumberOfPlanes
;
150 UCHAR NumberOfImagePages
;
153 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */
155 UCHAR RedFieldPosition
;
157 UCHAR GreenFieldPosition
;
159 UCHAR BlueFieldPosition
;
160 UCHAR ReservedMaskSize
;
161 UCHAR ReservedFieldPosition
;
162 UCHAR DirectColorModeInfo
;
164 /* Mandatory information for VBE 2.0 and above */
169 /* Mandatory information for VBE 3.0 and above */
170 USHORT LinBytesPerScanLine
;
171 UCHAR BnkNumberOfImagePages
;
172 UCHAR LinNumberOfImagePages
;
173 UCHAR LinRedMaskSize
;
174 UCHAR LinRedFieldPosition
;
175 UCHAR LinGreenMaskSize
;
176 UCHAR LinGreenFieldPosition
;
177 UCHAR LinBlueMaskSize
;
178 UCHAR LinBlueFieldPosition
;
179 UCHAR LinReservedMaskSize
;
180 UCHAR LinReservedFieldPosition
;
184 } VBE_MODEINFO
, *PVBE_MODEINFO
;
186 #define MAX_SIZE_OF_EDID 256
192 /* Interface to Int10 calls */
193 VIDEO_PORT_INT10_INTERFACE Int10Interface
;
195 /* Trampoline memory for communication with VBE real-mode interface */
196 USHORT TrampolineMemorySegment
;
197 USHORT TrampolineMemoryOffset
;
199 /* General controller/BIOS information */
202 /* Saved information about video modes */
205 PVBE_MODEINFO ModeInfo
;
208 /* Current child been enumerated */
209 ULONG CurrentChildIndex
;
210 } VBE_DEVICE_EXTENSION
, *PVBE_DEVICE_EXTENSION
;
215 VBEGetVideoChildDescriptor(
216 IN PVOID HwDeviceExtension
,
217 IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo
,
218 OUT PVIDEO_CHILD_TYPE VideoChildType
,
219 OUT PUCHAR pChildDescriptor
,
226 IN PVOID HwDeviceExtension
,
228 IN PWSTR ArgumentString
,
229 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo
,
233 VBEInitialize(PVOID HwDeviceExtension
);
237 PVOID HwDeviceExtension
,
238 PVIDEO_REQUEST_PACKET RequestPacket
);
242 PVOID DeviceExtension
,
248 PVOID HwDeviceExtension
,
250 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
254 PVOID HwDeviceExtension
,
256 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
260 PVBE_DEVICE_EXTENSION DeviceExtension
,
261 PVIDEO_MODE RequestedMode
,
262 PSTATUS_BLOCK StatusBlock
);
266 PVBE_DEVICE_EXTENSION DeviceExtension
,
267 PSTATUS_BLOCK StatusBlock
);
271 PVBE_DEVICE_EXTENSION DeviceExtension
,
272 PVIDEO_MEMORY RequestedAddress
,
273 PVIDEO_MEMORY_INFORMATION MapInformation
,
274 PSTATUS_BLOCK StatusBlock
);
278 PVBE_DEVICE_EXTENSION DeviceExtension
,
279 PVIDEO_MEMORY VideoMemory
,
280 PSTATUS_BLOCK StatusBlock
);
283 VBEQueryNumAvailModes(
284 PVBE_DEVICE_EXTENSION DeviceExtension
,
285 PVIDEO_NUM_MODES Modes
,
286 PSTATUS_BLOCK StatusBlock
);
290 PVBE_DEVICE_EXTENSION DeviceExtension
,
291 PVIDEO_MODE_INFORMATION ReturnedModes
,
292 PSTATUS_BLOCK StatusBlock
);
296 PVBE_DEVICE_EXTENSION DeviceExtension
,
297 PVIDEO_MODE_INFORMATION VideoModeInfo
,
298 PSTATUS_BLOCK StatusBlock
);
301 VBESetColorRegisters(
302 PVBE_DEVICE_EXTENSION DeviceExtension
,
303 PVIDEO_CLUT ColorLookUpTable
,
304 PSTATUS_BLOCK StatusBlock
);