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 *******************************************************************/
28 #define TAG_VBE ' EBV'
31 * Compile-time define to get VBE 1.2 support. The implementation
32 * is far from complete now and so it's left undefined.
35 /* #define VBE12_SUPPORT */
40 * VBE Command Definitions
43 #define VBE_GET_CONTROLLER_INFORMATION 0x4F00
44 #define VBE_GET_MODE_INFORMATION 0x4F01
45 #define VBE_SET_VBE_MODE 0x4F02
46 #define VBE_GET_CURRENT_VBE_MODE 0x4F03
47 #define VBE_SAVE_RESTORE_STATE 0x4F04
48 #define VBE_DISPLAY_WINDOW_CONTROL 0x4F05
49 #define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH 0x4F06
50 #define VBE_SET_GET_DISPLAY_START 0x4F07
51 #define VBE_SET_GET_DAC_PALETTE_FORMAT 0x4F08
52 #define VBE_SET_GET_PALETTE_DATA 0x4F09
55 #define VBE_RETURN_PROTECTED_MODE_INTERFACE 0x4F0A
56 #define VBE_GET_SET_PIXEL_CLOCK 0x4F0B
59 #define VBE_POWER_MANAGEMENT_EXTENSIONS 0x4F10
60 #define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS 0x4F11
61 #define VBE_AUDIO_INTERFACE_EXTENSIONS 0x4F12
62 #define VBE_OEM_EXTENSIONS 0x4F13
63 #define VBE_DISPLAY_DATA_CHANNEL 0x4F14
64 #define VBE_DDC 0x4F15
67 * VBE DDC Sub-Functions
70 #define VBE_DDC_READ_EDID 0x01
71 #define VBE_DDC_REPORT_CAPABILITIES 0x10
72 #define VBE_DDC_BEGIN_SCL_SDA_CONTROL 0x11
73 #define VBE_DDC_END_SCL_SDA_CONTROL 0x12
74 #define VBE_DDC_WRITE_SCL_CLOCK_LINE 0x13
75 #define VBE_DDC_WRITE_SDA_DATA_LINE 0x14
76 #define VBE_DDC_READ_SCL_CLOCK_LINE 0x15
77 #define VBE_DDC_READ_SDA_DATA_LINE 0x16
80 * VBE Video Mode Information Definitions
83 #define VBE_MODEATTR_LINEAR 0x80
85 #define VBE_MEMORYMODEL_PACKEDPIXEL 0x04
86 #define VBE_MEMORYMODEL_DIRECTCOLOR 0x06
92 #define VBE_SUCCESS 0x4F
93 #define VBE_UNSUCCESSFUL 0x14F
94 #define VBE_NOT_SUPPORTED 0x24F
95 #define VBE_FUNCTION_INVALID 0x34F
97 #define VBE_GETRETURNCODE(x) (x & 0xFFFF)
100 * VBE specification defined structure for general adapter info
101 * returned by function VBE_GET_CONTROLLER_INFORMATION command.
112 USHORT OemSoftwareRevision
;
113 ULONG OemVendorNamePtr
;
114 ULONG OemProductNamePtr
;
115 ULONG OemProductRevPtr
;
118 } VBE_INFO
, *PVBE_INFO
;
121 * VBE specification defined structure for specific video mode
122 * info returned by function VBE_GET_MODE_INFORMATION command.
127 /* Mandatory information for all VBE revisions */
128 USHORT ModeAttributes
;
129 UCHAR WinAAttributes
;
130 UCHAR WinBAttributes
;
131 USHORT WinGranularity
;
136 USHORT BytesPerScanLine
;
138 /* Mandatory information for VBE 1.2 and above */
143 UCHAR NumberOfPlanes
;
148 UCHAR NumberOfImagePages
;
151 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */
153 UCHAR RedFieldPosition
;
155 UCHAR GreenFieldPosition
;
157 UCHAR BlueFieldPosition
;
158 UCHAR ReservedMaskSize
;
159 UCHAR ReservedFieldPosition
;
160 UCHAR DirectColorModeInfo
;
162 /* Mandatory information for VBE 2.0 and above */
167 /* Mandatory information for VBE 3.0 and above */
168 USHORT LinBytesPerScanLine
;
169 UCHAR BnkNumberOfImagePages
;
170 UCHAR LinNumberOfImagePages
;
171 UCHAR LinRedMaskSize
;
172 UCHAR LinRedFieldPosition
;
173 UCHAR LinGreenMaskSize
;
174 UCHAR LinGreenFieldPosition
;
175 UCHAR LinBlueMaskSize
;
176 UCHAR LinBlueFieldPosition
;
177 UCHAR LinReservedMaskSize
;
178 UCHAR LinReservedFieldPosition
;
182 } VBE_MODEINFO
, *PVBE_MODEINFO
;
184 #define MAX_SIZE_OF_EDID 256
190 /* Interface to Int10 calls */
191 VIDEO_PORT_INT10_INTERFACE Int10Interface
;
193 /* Trampoline memory for communication with VBE real-mode interface */
194 USHORT TrampolineMemorySegment
;
195 USHORT TrampolineMemoryOffset
;
197 /* General controller/BIOS information */
200 /* Saved information about video modes */
203 PVBE_MODEINFO ModeInfo
;
206 /* Current child been enumerated */
207 ULONG CurrentChildIndex
;
208 } VBE_DEVICE_EXTENSION
, *PVBE_DEVICE_EXTENSION
;
213 VBEGetVideoChildDescriptor(
214 IN PVOID HwDeviceExtension
,
215 IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo
,
216 OUT PVIDEO_CHILD_TYPE VideoChildType
,
217 OUT PUCHAR pChildDescriptor
,
224 IN PVOID HwDeviceExtension
,
226 IN PWSTR ArgumentString
,
227 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo
,
231 VBEInitialize(PVOID HwDeviceExtension
);
235 PVOID HwDeviceExtension
,
236 PVIDEO_REQUEST_PACKET RequestPacket
);
240 PVOID DeviceExtension
,
246 PVOID HwDeviceExtension
,
248 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
252 PVOID HwDeviceExtension
,
254 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
258 PVBE_DEVICE_EXTENSION DeviceExtension
,
259 PVIDEO_MODE RequestedMode
,
260 PSTATUS_BLOCK StatusBlock
);
264 PVBE_DEVICE_EXTENSION DeviceExtension
,
265 PSTATUS_BLOCK StatusBlock
);
269 PVBE_DEVICE_EXTENSION DeviceExtension
,
270 PVIDEO_MEMORY RequestedAddress
,
271 PVIDEO_MEMORY_INFORMATION MapInformation
,
272 PSTATUS_BLOCK StatusBlock
);
276 PVBE_DEVICE_EXTENSION DeviceExtension
,
277 PVIDEO_MEMORY VideoMemory
,
278 PSTATUS_BLOCK StatusBlock
);
281 VBEQueryNumAvailModes(
282 PVBE_DEVICE_EXTENSION DeviceExtension
,
283 PVIDEO_NUM_MODES Modes
,
284 PSTATUS_BLOCK StatusBlock
);
288 PVBE_DEVICE_EXTENSION DeviceExtension
,
289 PVIDEO_MODE_INFORMATION ReturnedModes
,
290 PSTATUS_BLOCK StatusBlock
);
294 PVBE_DEVICE_EXTENSION DeviceExtension
,
295 PVIDEO_MODE_INFORMATION VideoModeInfo
,
296 PSTATUS_BLOCK StatusBlock
);
299 VBESetColorRegisters(
300 PVBE_DEVICE_EXTENSION DeviceExtension
,
301 PVIDEO_CLUT ColorLookUpTable
,
302 PSTATUS_BLOCK StatusBlock
);