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.
23 /* INCLUDES *******************************************************************/
32 #define TAG_VBE ' EBV'
35 * Compile-time define to get VBE 1.2 support. The implementation
36 * is far from complete now and so it's left undefined.
39 /* #define VBE12_SUPPORT */
44 * VBE Command Definitions
47 #define VBE_GET_CONTROLLER_INFORMATION 0x4F00
48 #define VBE_GET_MODE_INFORMATION 0x4F01
49 #define VBE_SET_VBE_MODE 0x4F02
50 #define VBE_GET_CURRENT_VBE_MODE 0x4F03
51 #define VBE_SAVE_RESTORE_STATE 0x4F04
52 #define VBE_DISPLAY_WINDOW_CONTROL 0x4F05
53 #define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH 0x4F06
54 #define VBE_SET_GET_DISPLAY_START 0x4F07
55 #define VBE_SET_GET_DAC_PALETTE_FORMAT 0x4F08
56 #define VBE_SET_GET_PALETTE_DATA 0x4F09
59 #define VBE_RETURN_PROTECTED_MODE_INTERFACE 0x4F0A
60 #define VBE_GET_SET_PIXEL_CLOCK 0x4F0B
63 #define VBE_POWER_MANAGEMENT_EXTENSIONS 0x4F10
64 #define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS 0x4F11
65 #define VBE_AUDIO_INTERFACE_EXTENSIONS 0x4F12
66 #define VBE_OEM_EXTENSIONS 0x4F13
67 #define VBE_DISPLAY_DATA_CHANNEL 0x4F14
68 #define VBE_DDC 0x4F15
71 * VBE DDC Sub-Functions
74 #define VBE_DDC_READ_EDID 0x01
75 #define VBE_DDC_REPORT_CAPABILITIES 0x10
76 #define VBE_DDC_BEGIN_SCL_SDA_CONTROL 0x11
77 #define VBE_DDC_END_SCL_SDA_CONTROL 0x12
78 #define VBE_DDC_WRITE_SCL_CLOCK_LINE 0x13
79 #define VBE_DDC_WRITE_SDA_DATA_LINE 0x14
80 #define VBE_DDC_READ_SCL_CLOCK_LINE 0x15
81 #define VBE_DDC_READ_SDA_DATA_LINE 0x16
84 * VBE Video Mode Information Definitions
87 #define VBE_MODEATTR_LINEAR 0x80
89 #define VBE_MEMORYMODEL_PACKEDPIXEL 0x04
90 #define VBE_MEMORYMODEL_DIRECTCOLOR 0x06
96 #define VBE_SUCCESS 0x4F
97 #define VBE_UNSUCCESSFUL 0x14F
98 #define VBE_NOT_SUPPORTED 0x24F
99 #define VBE_FUNCTION_INVALID 0x34F
101 #define VBE_GETRETURNCODE(x) (x & 0xFFFF)
104 * VBE specification defined structure for general adapter info
105 * returned by function VBE_GET_CONTROLLER_INFORMATION command.
116 USHORT OemSoftwareRevision
;
117 ULONG OemVendorNamePtr
;
118 ULONG OemProductNamePtr
;
119 ULONG OemProductRevPtr
;
122 } VBE_INFO
, *PVBE_INFO
;
125 * VBE specification defined structure for specific video mode
126 * info returned by function VBE_GET_MODE_INFORMATION command.
131 /* Mandatory information for all VBE revisions */
132 USHORT ModeAttributes
;
133 UCHAR WinAAttributes
;
134 UCHAR WinBAttributes
;
135 USHORT WinGranularity
;
140 USHORT BytesPerScanLine
;
142 /* Mandatory information for VBE 1.2 and above */
147 UCHAR NumberOfPlanes
;
152 UCHAR NumberOfImagePages
;
155 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */
157 UCHAR RedFieldPosition
;
159 UCHAR GreenFieldPosition
;
161 UCHAR BlueFieldPosition
;
162 UCHAR ReservedMaskSize
;
163 UCHAR ReservedFieldPosition
;
164 UCHAR DirectColorModeInfo
;
166 /* Mandatory information for VBE 2.0 and above */
171 /* Mandatory information for VBE 3.0 and above */
172 USHORT LinBytesPerScanLine
;
173 UCHAR BnkNumberOfImagePages
;
174 UCHAR LinNumberOfImagePages
;
175 UCHAR LinRedMaskSize
;
176 UCHAR LinRedFieldPosition
;
177 UCHAR LinGreenMaskSize
;
178 UCHAR LinGreenFieldPosition
;
179 UCHAR LinBlueMaskSize
;
180 UCHAR LinBlueFieldPosition
;
181 UCHAR LinReservedMaskSize
;
182 UCHAR LinReservedFieldPosition
;
186 } VBE_MODEINFO
, *PVBE_MODEINFO
;
188 #define MAX_SIZE_OF_EDID 256
194 /* Interface to Int10 calls */
195 VIDEO_PORT_INT10_INTERFACE Int10Interface
;
197 /* Trampoline memory for communication with VBE real-mode interface */
198 USHORT TrampolineMemorySegment
;
199 USHORT TrampolineMemoryOffset
;
201 /* General controller/BIOS information */
204 /* Saved information about video modes */
207 PVBE_MODEINFO ModeInfo
;
210 /* Current child been enumerated */
211 ULONG CurrentChildIndex
;
212 } VBE_DEVICE_EXTENSION
, *PVBE_DEVICE_EXTENSION
;
217 VBEGetVideoChildDescriptor(
218 IN PVOID HwDeviceExtension
,
219 IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo
,
220 OUT PVIDEO_CHILD_TYPE VideoChildType
,
221 OUT PUCHAR pChildDescriptor
,
228 IN PVOID HwDeviceExtension
,
230 IN PWSTR ArgumentString
,
231 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo
,
235 VBEInitialize(PVOID HwDeviceExtension
);
239 PVOID HwDeviceExtension
,
240 PVIDEO_REQUEST_PACKET RequestPacket
);
244 PVOID DeviceExtension
,
250 PVOID HwDeviceExtension
,
252 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
256 PVOID HwDeviceExtension
,
258 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
262 PVBE_DEVICE_EXTENSION DeviceExtension
,
263 PVIDEO_MODE RequestedMode
,
264 PSTATUS_BLOCK StatusBlock
);
268 PVBE_DEVICE_EXTENSION DeviceExtension
,
269 PSTATUS_BLOCK StatusBlock
);
273 PVBE_DEVICE_EXTENSION DeviceExtension
,
274 PVIDEO_MEMORY RequestedAddress
,
275 PVIDEO_MEMORY_INFORMATION MapInformation
,
276 PSTATUS_BLOCK StatusBlock
);
280 PVBE_DEVICE_EXTENSION DeviceExtension
,
281 PVIDEO_MEMORY VideoMemory
,
282 PSTATUS_BLOCK StatusBlock
);
285 VBEQueryNumAvailModes(
286 PVBE_DEVICE_EXTENSION DeviceExtension
,
287 PVIDEO_NUM_MODES Modes
,
288 PSTATUS_BLOCK StatusBlock
);
292 PVBE_DEVICE_EXTENSION DeviceExtension
,
293 PVIDEO_MODE_INFORMATION ReturnedModes
,
294 PSTATUS_BLOCK StatusBlock
);
298 PVBE_DEVICE_EXTENSION DeviceExtension
,
299 PVIDEO_MODE_INFORMATION VideoModeInfo
,
300 PSTATUS_BLOCK StatusBlock
);
303 VBESetColorRegisters(
304 PVBE_DEVICE_EXTENSION DeviceExtension
,
305 PVIDEO_CLUT ColorLookUpTable
,
306 PSTATUS_BLOCK StatusBlock
);