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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 /* INCLUDES *******************************************************************/
38 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
39 #define TAG_VBE TAG('V', 'B', 'E', ' ')
42 * Compile-time define to get VBE 1.2 support. The implementation
43 * is far from complete now and so it's left undefined.
46 /* #define VBE12_SUPPORT */
51 * VBE Command Definitions
54 #define VBE_GET_CONTROLLER_INFORMATION 0x4F00
55 #define VBE_GET_MODE_INFORMATION 0x4F01
56 #define VBE_SET_VBE_MODE 0x4F02
57 #define VBE_GET_CURRENT_VBE_MODE 0x4F03
58 #define VBE_SAVE_RESTORE_STATE 0x4F04
59 #define VBE_DISPLAY_WINDOW_CONTROL 0x4F05
60 #define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH 0x4F06
61 #define VBE_SET_GET_DISPLAY_START 0x4F07
62 #define VBE_SET_GET_DAC_PALETTE_FORMAT 0x4F08
63 #define VBE_SET_GET_PALETTE_DATA 0x4F09
66 #define VBE_RETURN_PROTECTED_MODE_INTERFACE 0x4F0A
67 #define VBE_GET_SET_PIXEL_CLOCK 0x4F0B
70 #define VBE_POWER_MANAGEMENT_EXTENSIONS 0x4F10
71 #define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS 0x4F11
72 #define VBE_AUDIO_INTERFACE_EXTENSIONS 0x4F12
73 #define VBE_OEM_EXTENSIONS 0x4F13
74 #define VBE_DISPLAY_DATA_CHANNEL 0x4F14
75 #define VBE_DDC 0x4F15
78 * VBE DDC Sub-Functions
81 #define VBE_DDC_READ_EDID 0x01
82 #define VBE_DDC_REPORT_CAPABILITIES 0x10
83 #define VBE_DDC_BEGIN_SCL_SDA_CONTROL 0x11
84 #define VBE_DDC_END_SCL_SDA_CONTROL 0x12
85 #define VBE_DDC_WRITE_SCL_CLOCK_LINE 0x13
86 #define VBE_DDC_WRITE_SDA_DATA_LINE 0x14
87 #define VBE_DDC_READ_SCL_CLOCK_LINE 0x15
88 #define VBE_DDC_READ_SDA_DATA_LINE 0x16
91 * VBE Video Mode Information Definitions
94 #define VBE_MODEATTR_LINEAR 0x80
96 #define VBE_MEMORYMODEL_PACKEDPIXEL 0x04
97 #define VBE_MEMORYMODEL_DIRECTCOLOR 0x06
103 #define VBE_SUCCESS 0x4F
104 #define VBE_UNSUCCESSFUL 0x14F
105 #define VBE_NOT_SUPPORTED 0x24F
106 #define VBE_FUNCTION_INVALID 0x34F
108 #define VBE_GETRETURNCODE(x) (x & 0xFFFF)
111 * VBE specification defined structure for general adapter info
112 * returned by function VBE_GET_CONTROLLER_INFORMATION command.
123 USHORT OemSoftwareRevision
;
124 ULONG OemVendorNamePtr
;
125 ULONG OemProductNamePtr
;
126 ULONG OemProductRevPtr
;
129 } VBE_INFO
, *PVBE_INFO
;
132 * VBE specification defined structure for specific video mode
133 * info returned by function VBE_GET_MODE_INFORMATION command.
138 /* Mandatory information for all VBE revisions */
139 USHORT ModeAttributes
;
140 UCHAR WinAAttributes
;
141 UCHAR WinBAttributes
;
142 USHORT WinGranularity
;
147 USHORT BytesPerScanLine
;
149 /* Mandatory information for VBE 1.2 and above */
154 UCHAR NumberOfPlanes
;
159 UCHAR NumberOfImagePages
;
162 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */
164 UCHAR RedFieldPosition
;
166 UCHAR GreenFieldPosition
;
168 UCHAR BlueFieldPosition
;
169 UCHAR ReservedMaskSize
;
170 UCHAR ReservedFieldPosition
;
171 UCHAR DirectColorModeInfo
;
173 /* Mandatory information for VBE 2.0 and above */
178 /* Mandatory information for VBE 3.0 and above */
179 USHORT LinBytesPerScanLine
;
180 UCHAR BnkNumberOfImagePages
;
181 UCHAR LinNumberOfImagePages
;
182 UCHAR LinRedMaskSize
;
183 UCHAR LinRedFieldPosition
;
184 UCHAR LinGreenMaskSize
;
185 UCHAR LinGreenFieldPosition
;
186 UCHAR LinBlueMaskSize
;
187 UCHAR LinBlueFieldPosition
;
188 UCHAR LinReservedMaskSize
;
189 UCHAR LinReservedFieldPosition
;
193 } VBE_MODEINFO
, *PVBE_MODEINFO
;
195 #define MAX_SIZE_OF_EDID 256
201 /* Interface to Int10 calls */
202 VIDEO_PORT_INT10_INTERFACE Int10Interface
;
204 /* Trampoline memory for communication with VBE real-mode interface */
205 USHORT TrampolineMemorySegment
;
206 USHORT TrampolineMemoryOffset
;
208 /* General controller/BIOS information */
211 /* Saved information about video modes */
214 PVBE_MODEINFO ModeInfo
;
217 /* Current child been enumerated */
218 ULONG CurrentChildIndex
;
219 } VBE_DEVICE_EXTENSION
, *PVBE_DEVICE_EXTENSION
;
224 VBEGetVideoChildDescriptor(
225 IN PVOID HwDeviceExtension
,
226 IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo
,
227 OUT PVIDEO_CHILD_TYPE VideoChildType
,
228 OUT PUCHAR pChildDescriptor
,
235 IN PVOID HwDeviceExtension
,
237 IN PWSTR ArgumentString
,
238 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo
,
242 VBEInitialize(PVOID HwDeviceExtension
);
246 PVOID HwDeviceExtension
,
247 PVIDEO_REQUEST_PACKET RequestPacket
);
251 PVOID DeviceExtension
,
257 PVOID HwDeviceExtension
,
259 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
263 PVOID HwDeviceExtension
,
265 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
269 PVBE_DEVICE_EXTENSION DeviceExtension
,
270 PVIDEO_MODE RequestedMode
,
271 PSTATUS_BLOCK StatusBlock
);
275 PVBE_DEVICE_EXTENSION DeviceExtension
,
276 PSTATUS_BLOCK StatusBlock
);
280 PVBE_DEVICE_EXTENSION DeviceExtension
,
281 PVIDEO_MEMORY RequestedAddress
,
282 PVIDEO_MEMORY_INFORMATION MapInformation
,
283 PSTATUS_BLOCK StatusBlock
);
287 PVBE_DEVICE_EXTENSION DeviceExtension
,
288 PVIDEO_MEMORY VideoMemory
,
289 PSTATUS_BLOCK StatusBlock
);
292 VBEQueryNumAvailModes(
293 PVBE_DEVICE_EXTENSION DeviceExtension
,
294 PVIDEO_NUM_MODES Modes
,
295 PSTATUS_BLOCK StatusBlock
);
299 PVBE_DEVICE_EXTENSION DeviceExtension
,
300 PVIDEO_MODE_INFORMATION ReturnedModes
,
301 PSTATUS_BLOCK StatusBlock
);
305 PVBE_DEVICE_EXTENSION DeviceExtension
,
306 PVIDEO_MODE_INFORMATION VideoModeInfo
,
307 PSTATUS_BLOCK StatusBlock
);
310 VBESetColorRegisters(
311 PVBE_DEVICE_EXTENSION DeviceExtension
,
312 PVIDEO_CLUT ColorLookUpTable
,
313 PSTATUS_BLOCK StatusBlock
);