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 *******************************************************************/
29 #include <ddk/miniport.h>
30 #include <ddk/video.h>
31 #include <ddk/ntddvdeo.h>
32 #include <ddk/ntapi.h>
35 #define DPRINT(arg) DbgPrint arg;
41 * Compile-time define to get VBE 1.2 support. The implementation
42 * is far from complete now and so it's left undefined.
45 /* #define VBE12_SUPPORT */
50 * VBE Command Definitions
53 #define VBE_GET_CONTROLLER_INFORMATION 0x4F00
54 #define VBE_GET_MODE_INFORMATION 0x4F01
55 #define VBE_SET_VBE_MODE 0x4F02
56 #define VBE_GET_CURRENT_VBE_MODE 0x4F03
57 #define VBE_SAVE_RESTORE_STATE 0x4F04
58 #define VBE_DISPLAY_WINDOW_CONTROL 0x4F05
59 #define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH 0x4F06
60 #define VBE_SET_GET_DISPLAY_START 0x4F07
61 #define VBE_SET_GET_DAC_PALETTE_FORMAT 0x4F08
62 #define VBE_SET_GET_PALETTE_DATA 0x4F09
65 #define VBE_RETURN_PROTECTED_MODE_INTERFACE 0x4F0A
66 #define VBE_GET_SET_PIXEL_CLOCK 0x4F0B
69 #define VBE_POWER_MANAGEMENT_EXTENSIONS 0x4F10
70 #define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS 0x4F11
71 #define VBE_AUDIO_INTERFACE_EXTENSIONS 0x4F12
72 #define VBE_OEM_EXTENSIONS 0x4F13
73 #define VBE_DISPLAY_DATA_CHANNEL 0x4F14
76 * VBE Video Mode Information Definitions
79 #define VBE_MODEATTR_LINEAR 0x80
81 #define VBE_MEMORYMODEL_PACKEDPIXEL 0x04
82 #define VBE_MEMORYMODEL_DIRECTCOLOR 0x06
88 #define VBE_SUCCESS 0x4F
89 #define VBE_UNSUCCESSFUL 0x14F
90 #define VBE_NOT_SUPPORTED 0x24F
91 #define VBE_FUNCTION_INVALID 0x34F
94 * VBE specification defined structure for general adapter info
95 * returned by function VBE_GET_CONTROLLER_INFORMATION command.
106 WORD OemSoftwareRevision
;
107 DWORD OemVendorNamePtr
;
108 DWORD OemProductNamePtr
;
109 DWORD OemProductRevPtr
;
112 } VBE_INFO
, *PVBE_INFO
;
115 * VBE specification defined structure for specific video mode
116 * info returned by function VBE_GET_MODE_INFORMATION command.
121 /* Mandatory information for all VBE revisions */
130 WORD BytesPerScanLine
;
132 /* Mandatory information for VBE 1.2 and above */
142 BYTE NumberOfImagePages
;
145 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */
147 BYTE RedFieldPosition
;
149 BYTE GreenFieldPosition
;
151 BYTE BlueFieldPosition
;
152 BYTE ReservedMaskSize
;
153 BYTE ReservedFieldPosition
;
154 BYTE DirectColorModeInfo
;
156 /* Mandatory information for VBE 2.0 and above */
161 /* Mandatory information for VBE 3.0 and above */
162 WORD LinBytesPerScanLine
;
163 BYTE BnkNumberOfImagePages
;
164 BYTE LinNumberOfImagePages
;
166 BYTE LinRedFieldPosition
;
167 BYTE LinGreenMaskSize
;
168 BYTE LinGreenFieldPosition
;
169 BYTE LinBlueMaskSize
;
170 BYTE LinBlueFieldPosition
;
171 BYTE LinReservedMaskSize
;
172 BYTE LinReservedFieldPosition
;
176 } VBE_MODEINFO
, *PVBE_MODEINFO
;
182 /* Interface to Int10 calls */
183 VIDEO_PORT_INT10_INTERFACE Int10Interface
;
185 /* Trampoline memory for communication with VBE real-mode interface */
186 USHORT TrampolineMemorySegment
;
187 USHORT TrampolineMemoryOffset
;
189 /* General controller/BIOS information */
192 /* Saved information about video modes */
195 PVBE_MODEINFO ModeInfo
;
197 } VBE_DEVICE_EXTENSION
, *PVBE_DEVICE_EXTENSION
;
201 IN PVOID HwDeviceExtension
,
203 IN PWSTR ArgumentString
,
204 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo
,
208 VBEInitialize(PVOID HwDeviceExtension
);
212 PVOID HwDeviceExtension
,
213 PVIDEO_REQUEST_PACKET RequestPacket
);
217 PVOID DeviceExtension
,
223 PVOID HwDeviceExtension
,
225 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
229 PVOID HwDeviceExtension
,
231 PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
235 PVBE_DEVICE_EXTENSION DeviceExtension
,
236 PVIDEO_MODE RequestedMode
,
237 PSTATUS_BLOCK StatusBlock
);
241 PVBE_DEVICE_EXTENSION DeviceExtension
,
242 PSTATUS_BLOCK StatusBlock
);
246 PVBE_DEVICE_EXTENSION DeviceExtension
,
247 PVIDEO_MEMORY RequestedAddress
,
248 PVIDEO_MEMORY_INFORMATION MapInformation
,
249 PSTATUS_BLOCK StatusBlock
);
253 PVBE_DEVICE_EXTENSION DeviceExtension
,
254 PVIDEO_MEMORY VideoMemory
,
255 PSTATUS_BLOCK StatusBlock
);
258 VBEQueryNumAvailModes(
259 PVBE_DEVICE_EXTENSION DeviceExtension
,
260 PVIDEO_NUM_MODES Modes
,
261 PSTATUS_BLOCK StatusBlock
);
265 PVBE_DEVICE_EXTENSION DeviceExtension
,
266 PVIDEO_MODE_INFORMATION ReturnedModes
,
267 PSTATUS_BLOCK StatusBlock
);
271 PVBE_DEVICE_EXTENSION DeviceExtension
,
272 PVIDEO_MODE_INFORMATION VideoModeInfo
,
273 PSTATUS_BLOCK StatusBlock
);
276 VBESetColorRegisters(
277 PVBE_DEVICE_EXTENSION DeviceExtension
,
278 PVIDEO_CLUT ColorLookUpTable
,
279 PSTATUS_BLOCK StatusBlock
);