ReactOS 0.4.15-dev-7889-g76290a6
vbemp.h File Reference
#include <ntdef.h>
#include <dderror.h>
#include <miniport.h>
#include <video.h>
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for vbemp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  VBE_INFO
 
struct  VBE_MODEINFO
 
struct  VBE_DEVICE_EXTENSION
 

Macros

#define TAG_VBE   ' EBV'
 
#define VBE_GET_CONTROLLER_INFORMATION   0x4F00
 
#define VBE_GET_MODE_INFORMATION   0x4F01
 
#define VBE_SET_VBE_MODE   0x4F02
 
#define VBE_GET_CURRENT_VBE_MODE   0x4F03
 
#define VBE_SAVE_RESTORE_STATE   0x4F04
 
#define VBE_DISPLAY_WINDOW_CONTROL   0x4F05
 
#define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH   0x4F06
 
#define VBE_SET_GET_DISPLAY_START   0x4F07
 
#define VBE_SET_GET_DAC_PALETTE_FORMAT   0x4F08
 
#define VBE_SET_GET_PALETTE_DATA   0x4F09
 
#define VBE_RETURN_PROTECTED_MODE_INTERFACE   0x4F0A
 
#define VBE_GET_SET_PIXEL_CLOCK   0x4F0B
 
#define VBE_POWER_MANAGEMENT_EXTENSIONS   0x4F10
 
#define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS   0x4F11
 
#define VBE_AUDIO_INTERFACE_EXTENSIONS   0x4F12
 
#define VBE_OEM_EXTENSIONS   0x4F13
 
#define VBE_DISPLAY_DATA_CHANNEL   0x4F14
 
#define VBE_DDC   0x4F15
 
#define VBE_DDC_READ_EDID   0x01
 
#define VBE_DDC_REPORT_CAPABILITIES   0x10
 
#define VBE_DDC_BEGIN_SCL_SDA_CONTROL   0x11
 
#define VBE_DDC_END_SCL_SDA_CONTROL   0x12
 
#define VBE_DDC_WRITE_SCL_CLOCK_LINE   0x13
 
#define VBE_DDC_WRITE_SDA_DATA_LINE   0x14
 
#define VBE_DDC_READ_SCL_CLOCK_LINE   0x15
 
#define VBE_DDC_READ_SDA_DATA_LINE   0x16
 
#define VBE_MODEATTR_LINEAR   0x80
 
#define VBE_MEMORYMODEL_PACKEDPIXEL   0x04
 
#define VBE_MEMORYMODEL_DIRECTCOLOR   0x06
 
#define VBE_SUCCESS   0x4F
 
#define VBE_UNSUCCESSFUL   0x14F
 
#define VBE_NOT_SUPPORTED   0x24F
 
#define VBE_FUNCTION_INVALID   0x34F
 
#define VBE_GETRETURNCODE(x)   (x & 0xFFFF)
 
#define MAX_SIZE_OF_EDID   256
 

Typedefs

typedef struct VBE_INFOPVBE_INFO
 
typedef struct VBE_MODEINFOPVBE_MODEINFO
 
typedef struct VBE_DEVICE_EXTENSIONPVBE_DEVICE_EXTENSION
 

Functions

VP_STATUS NTAPI VBEGetVideoChildDescriptor (IN PVOID HwDeviceExtension, IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo, OUT PVIDEO_CHILD_TYPE VideoChildType, OUT PUCHAR pChildDescriptor, OUT PULONG UId, OUT PULONG pUnused)
 
VP_STATUS NTAPI VBEFindAdapter (IN PVOID HwDeviceExtension, IN PVOID HwContext, IN PWSTR ArgumentString, IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo, OUT PUCHAR Again)
 
BOOLEAN NTAPI VBEInitialize (PVOID HwDeviceExtension)
 
BOOLEAN NTAPI VBEStartIO (PVOID HwDeviceExtension, PVIDEO_REQUEST_PACKET RequestPacket)
 
BOOLEAN NTAPI VBEResetHw (PVOID DeviceExtension, ULONG Columns, ULONG Rows)
 
VP_STATUS NTAPI VBEGetPowerState (PVOID HwDeviceExtension, ULONG HwId, PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
VP_STATUS NTAPI VBESetPowerState (PVOID HwDeviceExtension, ULONG HwId, PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
BOOLEAN FASTCALL VBESetCurrentMode (PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL VBEResetDevice (PVBE_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL VBEMapVideoMemory (PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY RequestedAddress, PVIDEO_MEMORY_INFORMATION MapInformation, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL VBEUnmapVideoMemory (PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY VideoMemory, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL VBEQueryNumAvailModes (PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_NUM_MODES Modes, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL VBEQueryAvailModes (PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION ReturnedModes, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL VBEQueryCurrentMode (PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoModeInfo, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL VBESetColorRegisters (PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_CLUT ColorLookUpTable, PSTATUS_BLOCK StatusBlock)
 

Macro Definition Documentation

◆ MAX_SIZE_OF_EDID

#define MAX_SIZE_OF_EDID   256

Definition at line 187 of file vbemp.h.

◆ TAG_VBE

#define TAG_VBE   ' EBV'

Definition at line 31 of file vbemp.h.

◆ VBE_AUDIO_INTERFACE_EXTENSIONS

#define VBE_AUDIO_INTERFACE_EXTENSIONS   0x4F12

Definition at line 64 of file vbemp.h.

◆ VBE_DDC

#define VBE_DDC   0x4F15

Definition at line 67 of file vbemp.h.

◆ VBE_DDC_BEGIN_SCL_SDA_CONTROL

#define VBE_DDC_BEGIN_SCL_SDA_CONTROL   0x11

Definition at line 75 of file vbemp.h.

◆ VBE_DDC_END_SCL_SDA_CONTROL

#define VBE_DDC_END_SCL_SDA_CONTROL   0x12

Definition at line 76 of file vbemp.h.

◆ VBE_DDC_READ_EDID

#define VBE_DDC_READ_EDID   0x01

Definition at line 73 of file vbemp.h.

◆ VBE_DDC_READ_SCL_CLOCK_LINE

#define VBE_DDC_READ_SCL_CLOCK_LINE   0x15

Definition at line 79 of file vbemp.h.

◆ VBE_DDC_READ_SDA_DATA_LINE

#define VBE_DDC_READ_SDA_DATA_LINE   0x16

Definition at line 80 of file vbemp.h.

◆ VBE_DDC_REPORT_CAPABILITIES

#define VBE_DDC_REPORT_CAPABILITIES   0x10

Definition at line 74 of file vbemp.h.

◆ VBE_DDC_WRITE_SCL_CLOCK_LINE

#define VBE_DDC_WRITE_SCL_CLOCK_LINE   0x13

Definition at line 77 of file vbemp.h.

◆ VBE_DDC_WRITE_SDA_DATA_LINE

#define VBE_DDC_WRITE_SDA_DATA_LINE   0x14

Definition at line 78 of file vbemp.h.

◆ VBE_DISPLAY_DATA_CHANNEL

#define VBE_DISPLAY_DATA_CHANNEL   0x4F14

Definition at line 66 of file vbemp.h.

◆ VBE_DISPLAY_WINDOW_CONTROL

#define VBE_DISPLAY_WINDOW_CONTROL   0x4F05

Definition at line 51 of file vbemp.h.

◆ VBE_FLAT_PANEL_INTERFACE_EXTENSIONS

#define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS   0x4F11

Definition at line 63 of file vbemp.h.

◆ VBE_FUNCTION_INVALID

#define VBE_FUNCTION_INVALID   0x34F

Definition at line 98 of file vbemp.h.

◆ VBE_GET_CONTROLLER_INFORMATION

#define VBE_GET_CONTROLLER_INFORMATION   0x4F00

Definition at line 46 of file vbemp.h.

◆ VBE_GET_CURRENT_VBE_MODE

#define VBE_GET_CURRENT_VBE_MODE   0x4F03

Definition at line 49 of file vbemp.h.

◆ VBE_GET_MODE_INFORMATION

#define VBE_GET_MODE_INFORMATION   0x4F01

Definition at line 47 of file vbemp.h.

◆ VBE_GET_SET_PIXEL_CLOCK

#define VBE_GET_SET_PIXEL_CLOCK   0x4F0B

Definition at line 59 of file vbemp.h.

◆ VBE_GETRETURNCODE

#define VBE_GETRETURNCODE (   x)    (x & 0xFFFF)

Definition at line 100 of file vbemp.h.

◆ VBE_MEMORYMODEL_DIRECTCOLOR

#define VBE_MEMORYMODEL_DIRECTCOLOR   0x06

Definition at line 89 of file vbemp.h.

◆ VBE_MEMORYMODEL_PACKEDPIXEL

#define VBE_MEMORYMODEL_PACKEDPIXEL   0x04

Definition at line 88 of file vbemp.h.

◆ VBE_MODEATTR_LINEAR

#define VBE_MODEATTR_LINEAR   0x80

Definition at line 86 of file vbemp.h.

◆ VBE_NOT_SUPPORTED

#define VBE_NOT_SUPPORTED   0x24F

Definition at line 97 of file vbemp.h.

◆ VBE_OEM_EXTENSIONS

#define VBE_OEM_EXTENSIONS   0x4F13

Definition at line 65 of file vbemp.h.

◆ VBE_POWER_MANAGEMENT_EXTENSIONS

#define VBE_POWER_MANAGEMENT_EXTENSIONS   0x4F10

Definition at line 62 of file vbemp.h.

◆ VBE_RETURN_PROTECTED_MODE_INTERFACE

#define VBE_RETURN_PROTECTED_MODE_INTERFACE   0x4F0A

Definition at line 58 of file vbemp.h.

◆ VBE_SAVE_RESTORE_STATE

#define VBE_SAVE_RESTORE_STATE   0x4F04

Definition at line 50 of file vbemp.h.

◆ VBE_SET_GET_DAC_PALETTE_FORMAT

#define VBE_SET_GET_DAC_PALETTE_FORMAT   0x4F08

Definition at line 54 of file vbemp.h.

◆ VBE_SET_GET_DISPLAY_START

#define VBE_SET_GET_DISPLAY_START   0x4F07

Definition at line 53 of file vbemp.h.

◆ VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH

#define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH   0x4F06

Definition at line 52 of file vbemp.h.

◆ VBE_SET_GET_PALETTE_DATA

#define VBE_SET_GET_PALETTE_DATA   0x4F09

Definition at line 55 of file vbemp.h.

◆ VBE_SET_VBE_MODE

#define VBE_SET_VBE_MODE   0x4F02

Definition at line 48 of file vbemp.h.

◆ VBE_SUCCESS

#define VBE_SUCCESS   0x4F

Definition at line 95 of file vbemp.h.

◆ VBE_UNSUCCESSFUL

#define VBE_UNSUCCESSFUL   0x14F

Definition at line 96 of file vbemp.h.

Typedef Documentation

◆ PVBE_DEVICE_EXTENSION

◆ PVBE_INFO

◆ PVBE_MODEINFO

Function Documentation

◆ VBEFindAdapter()

VP_STATUS NTAPI VBEFindAdapter ( IN PVOID  HwDeviceExtension,
IN PVOID  HwContext,
IN PWSTR  ArgumentString,
IN OUT PVIDEO_PORT_CONFIG_INFO  ConfigInfo,
OUT PUCHAR  Again 
)

Definition at line 78 of file vbemp.c.

84{
87
88 if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO))
90
91 ConfigInfo->VdmPhysicalVideoMemoryAddress = VBEAccessRange[2].RangeStart;
92 ConfigInfo->VdmPhysicalVideoMemoryLength = VBEAccessRange[2].RangeLength;
93 return NO_ERROR;
94}
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VPAPI BOOLEAN NTAPI VideoPortIsNoVesa(VOID)
Definition: videoprt.c:1738
ULONG RangeLength
Definition: video.h:216
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215
VIDEO_ACCESS_RANGE VBEAccessRange[]
Definition: vbemp.c:39

Referenced by DriverEntry().

◆ VBEGetPowerState()

VP_STATUS NTAPI VBEGetPowerState ( PVOID  HwDeviceExtension,
ULONG  HwId,
PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 582 of file vbemp.c.

586{
587 INT10_BIOS_ARGUMENTS BiosRegisters;
588 PVBE_DEVICE_EXTENSION VBEDeviceExtension =
589 (PVBE_DEVICE_EXTENSION)HwDeviceExtension;
590
591 if (HwId != DISPLAY_ADAPTER_HW_ID ||
592 VideoPowerControl->Length < sizeof(VIDEO_POWER_MANAGEMENT))
594
595 /*
596 * Get general power support information.
597 */
598
599 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
600 BiosRegisters.Eax = VBE_POWER_MANAGEMENT_EXTENSIONS;
601 BiosRegisters.Ebx = 0;
602 BiosRegisters.Edi = 0;
603 BiosRegisters.SegEs = 0;
604 VBEDeviceExtension->Int10Interface.Int10CallBios(
605 VBEDeviceExtension->Int10Interface.Context,
606 &BiosRegisters);
607
608 if ( VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_NOT_SUPPORTED)
609 return ERROR_DEV_NOT_EXIST;
610 if (VBE_GETRETURNCODE(BiosRegisters.Eax) != VBE_SUCCESS)
612
613 /*
614 * Get current power state.
615 */
616
617 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
618 BiosRegisters.Eax = VBE_POWER_MANAGEMENT_EXTENSIONS;
619 BiosRegisters.Ebx = 0x2;
620 BiosRegisters.Edi = 0;
621 BiosRegisters.SegEs = 0;
622 VBEDeviceExtension->Int10Interface.Int10CallBios(
623 VBEDeviceExtension->Int10Interface.Context,
624 &BiosRegisters);
625
626 if (VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_SUCCESS)
627 {
628 VideoPowerControl->DPMSVersion = BiosRegisters.Ebx & 0xFF;
629 switch (BiosRegisters.Ebx >> 8)
630 {
631 case 0: VideoPowerControl->PowerState = VideoPowerOn; break;
632 case 1: VideoPowerControl->PowerState = VideoPowerStandBy; break;
633 case 2: VideoPowerControl->PowerState = VideoPowerSuspend; break;
634 case 4: VideoPowerControl->PowerState = VideoPowerOff; break;
635 case 5: VideoPowerControl->PowerState = VideoPowerOn; break;
636 default: VideoPowerControl->PowerState = VideoPowerUnspecified;
637 }
638
639 return NO_ERROR;
640 }
641
642 return ERROR_DEV_NOT_EXIST;
643}
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
@ VideoPowerOn
Definition: ntddvdeo.h:403
@ VideoPowerUnspecified
Definition: ntddvdeo.h:402
@ VideoPowerSuspend
Definition: ntddvdeo.h:405
@ VideoPowerOff
Definition: ntddvdeo.h:406
@ VideoPowerStandBy
Definition: ntddvdeo.h:404
VPAPI VOID NTAPI VideoPortZeroMemory(IN PVOID Destination, IN ULONG Length)
#define DISPLAY_ADAPTER_HW_ID
Definition: video.h:115
VIDEO_PORT_INT10_INTERFACE Int10Interface
Definition: vbemp.h:194
OUT PINT10_CALL_BIOS Int10CallBios
Definition: video.h:790
#define VBE_SUCCESS
Definition: vbemp.h:95
#define VBE_NOT_SUPPORTED
Definition: vbemp.h:97
#define VBE_GETRETURNCODE(x)
Definition: vbemp.h:100
struct VBE_DEVICE_EXTENSION * PVBE_DEVICE_EXTENSION
#define VBE_POWER_MANAGEMENT_EXTENSIONS
Definition: vbemp.h:62

Referenced by DriverEntry().

◆ VBEGetVideoChildDescriptor()

VP_STATUS NTAPI VBEGetVideoChildDescriptor ( IN PVOID  HwDeviceExtension,
IN PVIDEO_CHILD_ENUM_INFO  ChildEnumInfo,
OUT PVIDEO_CHILD_TYPE  VideoChildType,
OUT PUCHAR  pChildDescriptor,
OUT PULONG  UId,
OUT PULONG  pUnused 
)

Definition at line 230 of file edid.c.

237{
238 if (ChildEnumInfo->Size != sizeof(VIDEO_CHILD_ENUM_INFO) ||
239 ChildEnumInfo->ChildDescriptorSize < MAX_SIZE_OF_EDID)
240 {
242 }
243
244 if (ChildEnumInfo->ChildIndex == 0)
245 {
246 /* We don't support enumeration of ACPI children */
248 }
249 else if (ChildEnumInfo->ChildIndex == 1)
250 {
251 /* Our screen */
252 *VideoChildType = Monitor;
253 *UId = 1;
254
255 /* Try to read EDID information using 2 different methods. */
256 if (VBEReadEdid(HwDeviceExtension, 0, pChildDescriptor))
257 {
258 VideoPortDebugPrint(Info, "VBEMP: EDID information read directly\n");
259 }
260 else if (VBEReadEdidUsingSCI(HwDeviceExtension, 0, pChildDescriptor))
261 {
262 VideoPortDebugPrint(Info, "VBEMP: EDID information read using I2C\n");
263 }
264
266 }
267 else
268 {
269 /* Unknown hardware id */
271 }
272}
#define ERROR_NO_MORE_DEVICES
Definition: dderror.h:18
static BOOLEAN VBEReadEdid(IN PVBE_DEVICE_EXTENSION VBEDeviceExtension, IN ULONG ChildIndex, OUT PVOID Edid)
Definition: edid.c:178
static BOOLEAN VBEReadEdidUsingSCI(IN PVOID HwDeviceExtension, IN ULONG ChildIndex, OUT PVOID Edid)
Definition: edid.c:105
VPAPI VOID __cdecl VideoPortDebugPrint(IN VIDEO_DEBUG_LEVEL DebugPrintLevel, IN PSTR DebugMessage, IN ...)
@ Monitor
Definition: video.h:270
#define VIDEO_ENUM_MORE_DEVICES
Definition: video.h:139
#define MAX_SIZE_OF_EDID
Definition: vbemp.h:187
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Referenced by DriverEntry().

◆ VBEInitialize()

BOOLEAN NTAPI VBEInitialize ( PVOID  HwDeviceExtension)

Definition at line 182 of file vbemp.c.

183{
184 INT10_BIOS_ARGUMENTS BiosRegisters;
186 PVBE_DEVICE_EXTENSION VBEDeviceExtension =
187 (PVBE_DEVICE_EXTENSION)HwDeviceExtension;
189 ULONG ModeCount;
190 ULONG SuitableModeCount;
191 USHORT ModeTemp;
192 ULONG CurrentMode;
193 PVBE_MODEINFO VbeModeInfo;
194
195 if (VideoPortIsNoVesa())
196 {
197 VBEDeviceExtension->Int10Interface.Version = 0;
198 VBEDeviceExtension->Int10Interface.Size = 0;
199 return FALSE;
200 }
201
202 /*
203 * Get the Int 10 interface that we will use for allocating real
204 * mode memory and calling the video BIOS.
205 */
206
208 VBEDeviceExtension->Int10Interface.Size = sizeof(VIDEO_PORT_INT10_INTERFACE);
210 HwDeviceExtension,
212 (PINTERFACE)&VBEDeviceExtension->Int10Interface);
213
214 if (Status != NO_ERROR)
215 {
216 VideoPortDebugPrint(Error, "Failed to get Int 10 service functions (Status %x)\n", Status);
217 return FALSE;
218 }
219
220 /*
221 * Allocate a bit of memory that will be later used for VBE transport
222 * buffer. This memory must be accessible from V86 mode so it must fit
223 * in the first megabyte of physical memory.
224 */
225
226 Length = 0x400;
227 Status = VBEDeviceExtension->Int10Interface.Int10AllocateBuffer(
228 VBEDeviceExtension->Int10Interface.Context,
229 &VBEDeviceExtension->TrampolineMemorySegment,
230 &VBEDeviceExtension->TrampolineMemoryOffset,
231 &Length);
232
233 if (Status != NO_ERROR)
234 {
235 VideoPortDebugPrint(Error, "Failed to allocate virtual memory (Status %x)\n", Status);
236 return FALSE;
237 }
238
239 /*
240 * Get the VBE general information.
241 */
242
243 VBEDeviceExtension->Int10Interface.Int10WriteMemory(
244 VBEDeviceExtension->Int10Interface.Context,
245 VBEDeviceExtension->TrampolineMemorySegment,
246 VBEDeviceExtension->TrampolineMemoryOffset,
247 "VBE2",
248 4);
249
250 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
251 BiosRegisters.Eax = VBE_GET_CONTROLLER_INFORMATION;
252 BiosRegisters.Edi = VBEDeviceExtension->TrampolineMemoryOffset;
253 BiosRegisters.SegEs = VBEDeviceExtension->TrampolineMemorySegment;
254 VBEDeviceExtension->Int10Interface.Int10CallBios(
255 VBEDeviceExtension->Int10Interface.Context,
256 &BiosRegisters);
257
258 if (VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_SUCCESS)
259 {
260 VBEDeviceExtension->Int10Interface.Int10ReadMemory(
261 VBEDeviceExtension->Int10Interface.Context,
262 VBEDeviceExtension->TrampolineMemorySegment,
263 VBEDeviceExtension->TrampolineMemoryOffset,
264 &VBEDeviceExtension->VbeInfo,
265 sizeof(VBEDeviceExtension->VbeInfo));
266
267 /* Verify the VBE signature. */
268 if (VideoPortCompareMemory(VBEDeviceExtension->VbeInfo.Signature, "VESA", 4) != 4)
269 {
270 VideoPortDebugPrint(Error, "No VBE BIOS present\n");
271 return FALSE;
272 }
273
274 VideoPortDebugPrint(Trace, "VBE BIOS Present (%d.%d, %8ld Kb)\n",
275 VBEDeviceExtension->VbeInfo.Version / 0x100,
276 VBEDeviceExtension->VbeInfo.Version & 0xFF,
277 VBEDeviceExtension->VbeInfo.TotalMemory * 64);
278
279#ifdef VBE12_SUPPORT
280 if (VBEDeviceExtension->VbeInfo.Version < 0x102)
281#else
282 if (VBEDeviceExtension->VbeInfo.Version < 0x200)
283#endif
284 {
285 VideoPortDebugPrint(Error, "VBE BIOS present, but incompatible version %d.%d\n",
286 VBEDeviceExtension->VbeInfo.Version / 0x100,
287 VBEDeviceExtension->VbeInfo.Version & 0xFF);
288 return FALSE;
289 }
290 }
291 else
292 {
293 VideoPortDebugPrint(Error, "No VBE BIOS found.\n");
294 return FALSE;
295 }
296
297 /*
298 * Build a mode list here that can be later used by
299 * IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES and IOCTL_VIDEO_QUERY_AVAIL_MODES
300 * calls.
301 */
302
303 /*
304 * Get the number of supported video modes.
305 *
306 * No need to be map the memory. It's either in the video BIOS memory or
307 * in our trampoline memory. In either case the memory is already mapped.
308 */
309
310 for (ModeCount = 0; ; ModeCount++)
311 {
312 /* Read the VBE mode number. */
313 VBEDeviceExtension->Int10Interface.Int10ReadMemory(
314 VBEDeviceExtension->Int10Interface.Context,
315 HIWORD(VBEDeviceExtension->VbeInfo.VideoModePtr),
316 LOWORD(VBEDeviceExtension->VbeInfo.VideoModePtr) + (ModeCount << 1),
317 &ModeTemp,
318 sizeof(ModeTemp));
319
320 /* End of list? */
321 if (ModeTemp == 0xFFFF || ModeTemp == 0)
322 break;
323 }
324
325 /*
326 * Allocate space for video modes information.
327 */
328
329 VBEDeviceExtension->ModeInfo =
330 VideoPortAllocatePool(HwDeviceExtension, VpPagedPool, ModeCount * sizeof(VBE_MODEINFO), TAG_VBE);
331 VBEDeviceExtension->ModeNumbers =
332 VideoPortAllocatePool(HwDeviceExtension, VpPagedPool, ModeCount * sizeof(USHORT), TAG_VBE);
333
334 /*
335 * Get the actual mode infos.
336 */
337
338 for (CurrentMode = 0, SuitableModeCount = 0;
339 CurrentMode < ModeCount;
340 CurrentMode++)
341 {
342 /* Read the VBE mode number. */
343 VBEDeviceExtension->Int10Interface.Int10ReadMemory(
344 VBEDeviceExtension->Int10Interface.Context,
345 HIWORD(VBEDeviceExtension->VbeInfo.VideoModePtr),
346 LOWORD(VBEDeviceExtension->VbeInfo.VideoModePtr) + (CurrentMode << 1),
347 &ModeTemp,
348 sizeof(ModeTemp));
349
350 /* Call VBE BIOS to read the mode info. */
351 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
352 BiosRegisters.Eax = VBE_GET_MODE_INFORMATION;
353 BiosRegisters.Ecx = ModeTemp;
354 BiosRegisters.Edi = VBEDeviceExtension->TrampolineMemoryOffset + 0x200;
355 BiosRegisters.SegEs = VBEDeviceExtension->TrampolineMemorySegment;
356 VBEDeviceExtension->Int10Interface.Int10CallBios(
357 VBEDeviceExtension->Int10Interface.Context,
358 &BiosRegisters);
359
360 /* Read the VBE mode info. */
361 VBEDeviceExtension->Int10Interface.Int10ReadMemory(
362 VBEDeviceExtension->Int10Interface.Context,
363 VBEDeviceExtension->TrampolineMemorySegment,
364 VBEDeviceExtension->TrampolineMemoryOffset + 0x200,
365 VBEDeviceExtension->ModeInfo + SuitableModeCount,
366 sizeof(VBE_MODEINFO));
367
368 VbeModeInfo = VBEDeviceExtension->ModeInfo + SuitableModeCount;
369
370 /* Is this mode acceptable? */
371 if (VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_SUCCESS &&
372 VbeModeInfo->XResolution >= 640 &&
373 VbeModeInfo->YResolution >= 480 &&
374 (VbeModeInfo->MemoryModel == VBE_MEMORYMODEL_PACKEDPIXEL ||
375 VbeModeInfo->MemoryModel == VBE_MEMORYMODEL_DIRECTCOLOR) &&
376 VbeModeInfo->PhysBasePtr != 0)
377 {
378 if (VbeModeInfo->ModeAttributes & VBE_MODEATTR_LINEAR)
379 {
380 /* Bit 15 14 13 12 | 11 10 9 8 | 7 6 5 4 | 3 2 1 0 */
381 // if (ModeTemp & 0x4000)
382 //{
383 VBEDeviceExtension->ModeNumbers[SuitableModeCount] = ModeTemp | 0x4000;
384 SuitableModeCount++;
385 //}
386 }
387#ifdef VBE12_SUPPORT
388 else
389 {
390 VBEDeviceExtension->ModeNumbers[SuitableModeCount] = ModeTemp;
391 SuitableModeCount++;
392 }
393#endif
394 }
395 }
396
397
398 if (SuitableModeCount == 0)
399 {
400
401 VideoPortDebugPrint(Warn, "VBEMP: No video modes supported\n");
402 return FALSE;
403 }
404
405 VBEDeviceExtension->ModeCount = SuitableModeCount;
406
407 /*
408 * Sort the video mode list according to resolution and bits per pixel.
409 */
410
411 VBESortModes(VBEDeviceExtension);
412
413 /*
414 * Print the supported video modes.
415 */
416
417 for (CurrentMode = 0;
418 CurrentMode < SuitableModeCount;
419 CurrentMode++)
420 {
421 VideoPortDebugPrint(Trace, "%dx%dx%d\n",
422 VBEDeviceExtension->ModeInfo[CurrentMode].XResolution,
423 VBEDeviceExtension->ModeInfo[CurrentMode].YResolution,
424 VBEDeviceExtension->ModeInfo[CurrentMode].BitsPerPixel);
425 }
426
427 /*
428 * Enumerate our children.
429 */
430 VideoPortEnumerateChildren(HwDeviceExtension, NULL);
431
432 return TRUE;
433}
BOOL Error
Definition: chkdsk.c:66
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define Trace(x)
Definition: inflate.c:42
Status
Definition: gdiplustypes.h:25
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
unsigned short USHORT
Definition: pedump.c:61
struct _VIDEO_PORT_INT10_INTERFACE VIDEO_PORT_INT10_INTERFACE
@ Warn
Definition: video.h:589
LONG VP_STATUS
Definition: video.h:153
VPAPI VP_STATUS NTAPI VideoPortEnumerateChildren(IN PVOID HwDeviceExtension, IN PVOID Reserved)
Definition: videoprt.c:1444
VPAPI VP_STATUS NTAPI VideoPortQueryServices(IN PVOID HwDeviceExtension, IN VIDEO_PORT_SERVICES ServicesType, IN OUT PINTERFACE Interface)
Definition: services.c:40
#define VIDEO_PORT_INT10_INTERFACE_VERSION_1
Definition: video.h:127
VPAPI PVOID NTAPI VideoPortAllocatePool(IN PVOID HwDeviceExtension, IN VP_POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: resource.c:1024
@ VideoPortServicesInt10
Definition: video.h:716
VPAPI ULONG NTAPI VideoPortCompareMemory(IN PVOID Source1, IN PVOID Source2, IN SIZE_T Length)
@ VpPagedPool
Definition: video.h:543
PVBE_MODEINFO ModeInfo
Definition: vbemp.h:206
USHORT TrampolineMemorySegment
Definition: vbemp.h:197
USHORT * ModeNumbers
Definition: vbemp.h:205
USHORT TrampolineMemoryOffset
Definition: vbemp.h:198
VBE_INFO VbeInfo
Definition: vbemp.h:201
CHAR Signature[4]
Definition: vbemp.h:109
USHORT Version
Definition: vbemp.h:110
USHORT TotalMemory
Definition: vbemp.h:114
ULONG VideoModePtr
Definition: vbemp.h:113
USHORT ModeAttributes
Definition: vbemp.h:131
UCHAR BitsPerPixel
Definition: vbemp.h:147
USHORT YResolution
Definition: vbemp.h:143
USHORT XResolution
Definition: vbemp.h:142
ULONG PhysBasePtr
Definition: vbemp.h:166
UCHAR MemoryModel
Definition: vbemp.h:149
OUT PINT10_READ_MEMORY Int10ReadMemory
Definition: video.h:788
OUT PINT10_ALLOCATE_BUFFER Int10AllocateBuffer
Definition: video.h:786
OUT PINT10_WRITE_MEMORY Int10WriteMemory
Definition: video.h:789
uint32_t ULONG
Definition: typedefs.h:59
#define LOWORD(l)
Definition: vbemp.c:36
VOID FASTCALL VBESortModes(PVBE_DEVICE_EXTENSION DeviceExtension)
Definition: vbemp.c:126
#define HIWORD(l)
Definition: vbemp.c:37
#define VBE_GET_MODE_INFORMATION
Definition: vbemp.h:47
#define VBE_MEMORYMODEL_PACKEDPIXEL
Definition: vbemp.h:88
#define VBE_GET_CONTROLLER_INFORMATION
Definition: vbemp.h:46
#define VBE_MEMORYMODEL_DIRECTCOLOR
Definition: vbemp.h:89
#define TAG_VBE
Definition: vbemp.h:31
#define VBE_MODEATTR_LINEAR
Definition: vbemp.h:86

Referenced by DriverEntry().

◆ VBEMapVideoMemory()

BOOLEAN FASTCALL VBEMapVideoMemory ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MEMORY  RequestedAddress,
PVIDEO_MEMORY_INFORMATION  MapInformation,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 769 of file vbemp.c.

774{
777
778 StatusBlock->Information = sizeof(VIDEO_MEMORY_INFORMATION);
779
780 if (DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].ModeAttributes &
782 {
783 FrameBuffer.QuadPart =
784 DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].PhysBasePtr;
785 MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress;
786 if (DeviceExtension->VbeInfo.Version < 0x300)
787 {
788 MapInformation->VideoRamLength =
789 DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].BytesPerScanLine *
790 DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].YResolution;
791 }
792 else
793 {
794 MapInformation->VideoRamLength =
795 DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].LinBytesPerScanLine *
796 DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].YResolution;
797 }
798 }
799#ifdef VBE12_SUPPORT
800 else
801 {
802 FrameBuffer.QuadPart = 0xA0000;
803 MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress;
804 MapInformation->VideoRamLength = 0x10000;
805 }
806#endif
807
808 VideoPortMapMemory(DeviceExtension, FrameBuffer,
809 &MapInformation->VideoRamLength, &inIoSpace,
810 &MapInformation->VideoRamBase);
811
812 MapInformation->FrameBufferBase = MapInformation->VideoRamBase;
813 MapInformation->FrameBufferLength = MapInformation->VideoRamLength;
814
815 return TRUE;
816}
PVOID FrameBuffer
Definition: xboxvideo.c:28
struct _VIDEO_MEMORY_INFORMATION VIDEO_MEMORY_INFORMATION
VPAPI VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN OUT PULONG Length, IN PULONG InIoSpace, IN OUT PVOID *VirtualAddress)
#define VIDEO_MEMORY_SPACE_MEMORY
Definition: video.h:132
USHORT CurrentMode
Definition: vbemp.h:207
USHORT LinBytesPerScanLine
Definition: vbemp.h:171
USHORT BytesPerScanLine
Definition: vbemp.h:139
ULONG_PTR Information
Definition: video.h:326
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:344

Referenced by VBEStartIO().

◆ VBEQueryAvailModes()

BOOLEAN FASTCALL VBEQueryAvailModes ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE_INFORMATION  ReturnedModes,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 942 of file vbemp.c.

946{
947 ULONG CurrentModeId;
948 PVIDEO_MODE_INFORMATION CurrentMode;
949 PVBE_MODEINFO CurrentVBEMode;
950
951 for (CurrentModeId = 0, CurrentMode = ReturnedModes,
952 CurrentVBEMode = DeviceExtension->ModeInfo;
953 CurrentModeId < DeviceExtension->ModeCount;
954 CurrentModeId++, CurrentMode++, CurrentVBEMode++)
955 {
956 VBEQueryMode(DeviceExtension, CurrentMode, CurrentModeId);
957 }
958
959 StatusBlock->Information =
960 sizeof(VIDEO_MODE_INFORMATION) * DeviceExtension->ModeCount;
961
962 return TRUE;
963}
struct _VIDEO_MODE_INFORMATION VIDEO_MODE_INFORMATION
VOID FASTCALL VBEQueryMode(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoMode, ULONG VideoModeId)
Definition: vbemp.c:863

Referenced by VBEStartIO().

◆ VBEQueryCurrentMode()

BOOLEAN FASTCALL VBEQueryCurrentMode ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE_INFORMATION  VideoModeInfo,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 972 of file vbemp.c.

976{
977 StatusBlock->Information = sizeof(VIDEO_MODE_INFORMATION);
978
980 DeviceExtension,
981 VideoModeInfo,
982 DeviceExtension->CurrentMode);
983
984 return TRUE;
985}

Referenced by VBEStartIO().

◆ VBEQueryNumAvailModes()

BOOLEAN FASTCALL VBEQueryNumAvailModes ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_NUM_MODES  Modes,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 845 of file vbemp.c.

849{
850 Modes->NumModes = DeviceExtension->ModeCount;
851 Modes->ModeInformationLength = sizeof(VIDEO_MODE_INFORMATION);
852 StatusBlock->Information = sizeof(VIDEO_NUM_MODES);
853 return TRUE;
854}
struct _VIDEO_NUM_MODES VIDEO_NUM_MODES
static const VBE_MODE Modes[VBE_MODE_COUNT]
Definition: vbe.c:189

Referenced by VBEStartIO().

◆ VBEResetDevice()

BOOLEAN FASTCALL VBEResetDevice ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 745 of file vbemp.c.

748{
749 INT10_BIOS_ARGUMENTS BiosRegisters;
750
751 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
752 BiosRegisters.Eax = VBE_SET_VBE_MODE;
753 BiosRegisters.Ebx = 0x3;
754 DeviceExtension->Int10Interface.Int10CallBios(
755 DeviceExtension->Int10Interface.Context,
756 &BiosRegisters);
757
758 return VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_SUCCESS;
759}
#define VBE_SET_VBE_MODE
Definition: vbemp.h:48

Referenced by VBEStartIO().

◆ VBEResetHw()

BOOLEAN NTAPI VBEResetHw ( PVOID  DeviceExtension,
ULONG  Columns,
ULONG  Rows 
)

Definition at line 566 of file vbemp.c.

570{
571 /* Return FALSE to let HAL reset the display with INT10 */
572 return FALSE;
573}

Referenced by DriverEntry().

◆ VBESetColorRegisters()

BOOLEAN FASTCALL VBESetColorRegisters ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_CLUT  ColorLookUpTable,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 997 of file vbemp.c.

1001{
1002 INT10_BIOS_ARGUMENTS BiosRegisters;
1003 ULONG Entry;
1004 PULONG OutputEntry;
1005 ULONG OutputBuffer[256];
1006
1007 if (ColorLookUpTable->NumEntries + ColorLookUpTable->FirstEntry > 256)
1008 return FALSE;
1009
1010 /*
1011 * For VGA compatible adapters program the color registers directly.
1012 */
1013
1014 if (!(DeviceExtension->VbeInfo.Capabilities & 2))
1015 {
1016 for (Entry = ColorLookUpTable->FirstEntry;
1017 Entry < ColorLookUpTable->NumEntries + ColorLookUpTable->FirstEntry;
1018 Entry++)
1019 {
1021 VideoPortWritePortUchar((PUCHAR)0x03c9, ColorLookUpTable->LookupTable[Entry].RgbArray.Red);
1022 VideoPortWritePortUchar((PUCHAR)0x03c9, ColorLookUpTable->LookupTable[Entry].RgbArray.Green);
1023 VideoPortWritePortUchar((PUCHAR)0x03c9, ColorLookUpTable->LookupTable[Entry].RgbArray.Blue);
1024 }
1025
1026 return TRUE;
1027 }
1028 else
1029 {
1030 /*
1031 * We can't just copy the values, because we need to swap the Red
1032 * and Blue values.
1033 */
1034
1035 for (Entry = ColorLookUpTable->FirstEntry,
1036 OutputEntry = OutputBuffer;
1037 Entry < ColorLookUpTable->NumEntries + ColorLookUpTable->FirstEntry;
1038 Entry++, OutputEntry++)
1039 {
1040 *OutputEntry =
1041 (ColorLookUpTable->LookupTable[Entry].RgbArray.Red << 16) |
1042 (ColorLookUpTable->LookupTable[Entry].RgbArray.Green << 8) |
1043 (ColorLookUpTable->LookupTable[Entry].RgbArray.Blue);
1044 }
1045
1046 DeviceExtension->Int10Interface.Int10WriteMemory(
1047 DeviceExtension->Int10Interface.Context,
1048 DeviceExtension->TrampolineMemorySegment,
1049 DeviceExtension->TrampolineMemoryOffset,
1051 (OutputEntry - OutputBuffer) * sizeof(ULONG));
1052
1053 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
1054 BiosRegisters.Eax = VBE_SET_GET_PALETTE_DATA;
1055 BiosRegisters.Ebx = 0;
1056 BiosRegisters.Ecx = ColorLookUpTable->NumEntries;
1057 BiosRegisters.Edx = ColorLookUpTable->FirstEntry;
1058 BiosRegisters.Edi = DeviceExtension->TrampolineMemoryOffset;
1059 BiosRegisters.SegEs = DeviceExtension->TrampolineMemorySegment;
1060 DeviceExtension->Int10Interface.Int10CallBios(
1061 DeviceExtension->Int10Interface.Context,
1062 &BiosRegisters);
1063
1064 return VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_SUCCESS;
1065 }
1066}
VPAPI VOID NTAPI VideoPortWritePortUchar(IN PUCHAR Port, IN UCHAR Value)
base of all file and directory entries
Definition: entries.h:83
LONG Capabilities
Definition: vbemp.h:112
USHORT FirstEntry
Definition: ntddvdeo.h:590
VIDEO_CLUTDATA RgbArray
Definition: ntddvdeo.h:592
union VIDEO_CLUT::@3181 LookupTable[1]
USHORT NumEntries
Definition: ntddvdeo.h:589
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PUCHAR
Definition: typedefs.h:53
#define VBE_SET_GET_PALETTE_DATA
Definition: vbemp.h:55
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863

Referenced by VBEStartIO().

◆ VBESetCurrentMode()

BOOLEAN FASTCALL VBESetCurrentMode ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE  RequestedMode,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 705 of file vbemp.c.

709{
710 INT10_BIOS_ARGUMENTS BiosRegisters;
711
712 if (RequestedMode->RequestedMode >= DeviceExtension->ModeCount)
713 {
715 }
716
717 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
718 BiosRegisters.Eax = VBE_SET_VBE_MODE;
719 BiosRegisters.Ebx = DeviceExtension->ModeNumbers[RequestedMode->RequestedMode];
720 DeviceExtension->Int10Interface.Int10CallBios(
721 DeviceExtension->Int10Interface.Context,
722 &BiosRegisters);
723
724 if (VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_SUCCESS)
725 {
726 DeviceExtension->CurrentMode = RequestedMode->RequestedMode;
727 }
728 else
729 {
730 VideoPortDebugPrint(Error, "VBEMP: VBESetCurrentMode failed (%x)\n", BiosRegisters.Eax);
731 DeviceExtension->CurrentMode = -1;
732 }
733
734 return VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_SUCCESS;
735}
ULONG RequestedMode
Definition: ntddvdeo.h:359

Referenced by VBEStartIO().

◆ VBESetPowerState()

VP_STATUS NTAPI VBESetPowerState ( PVOID  HwDeviceExtension,
ULONG  HwId,
PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 652 of file vbemp.c.

656{
657 INT10_BIOS_ARGUMENTS BiosRegisters;
658 PVBE_DEVICE_EXTENSION VBEDeviceExtension =
659 (PVBE_DEVICE_EXTENSION)HwDeviceExtension;
660
661 if (HwId != DISPLAY_ADAPTER_HW_ID ||
662 VideoPowerControl->Length < sizeof(VIDEO_POWER_MANAGEMENT) ||
663 VideoPowerControl->PowerState < VideoPowerOn ||
664 VideoPowerControl->PowerState > VideoPowerHibernate)
666
667 if (VideoPowerControl->PowerState == VideoPowerHibernate)
668 return NO_ERROR;
669
670 /*
671 * Set current power state.
672 */
673
674 VideoPortZeroMemory(&BiosRegisters, sizeof(BiosRegisters));
675 BiosRegisters.Eax = VBE_POWER_MANAGEMENT_EXTENSIONS;
676 BiosRegisters.Ebx = 1;
677 BiosRegisters.Edi = 0;
678 BiosRegisters.SegEs = 0;
679 switch (VideoPowerControl->PowerState)
680 {
681 case VideoPowerStandBy: BiosRegisters.Ebx |= 0x100; break;
682 case VideoPowerSuspend: BiosRegisters.Ebx |= 0x200; break;
683 case VideoPowerOff: BiosRegisters.Ebx |= 0x400; break;
684 }
685
686 VBEDeviceExtension->Int10Interface.Int10CallBios(
687 VBEDeviceExtension->Int10Interface.Context,
688 &BiosRegisters);
689
690 if (VBE_GETRETURNCODE(BiosRegisters.Eax) == VBE_NOT_SUPPORTED)
691 return ERROR_DEV_NOT_EXIST;
692 if (VBE_GETRETURNCODE(BiosRegisters.Eax) != VBE_SUCCESS)
694
695 return VBE_SUCCESS;
696}
@ VideoPowerHibernate
Definition: ntddvdeo.h:407

Referenced by DriverEntry().

◆ VBEStartIO()

BOOLEAN NTAPI VBEStartIO ( PVOID  HwDeviceExtension,
PVIDEO_REQUEST_PACKET  RequestPacket 
)

Definition at line 442 of file vbemp.c.

445{
447
448 RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION;
449
450 switch (RequestPacket->IoControlCode)
451 {
453 if (RequestPacket->InputBufferLength < sizeof(VIDEO_MODE))
454 {
456 return TRUE;
457 }
459 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
460 (PVIDEO_MODE)RequestPacket->InputBuffer,
461 RequestPacket->StatusBlock);
462 break;
463
466 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
467 RequestPacket->StatusBlock);
468 break;
469
471 if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION) ||
472 RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
473 {
475 return TRUE;
476 }
478 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
479 (PVIDEO_MEMORY)RequestPacket->InputBuffer,
481 RequestPacket->StatusBlock);
482 break;
483
485 if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
486 {
488 return TRUE;
489 }
491 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
492 (PVIDEO_MEMORY)RequestPacket->InputBuffer,
493 RequestPacket->StatusBlock);
494 break;
495
497 if (RequestPacket->OutputBufferLength < sizeof(VIDEO_NUM_MODES))
498 {
500 return TRUE;
501 }
503 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
504 (PVIDEO_NUM_MODES)RequestPacket->OutputBuffer,
505 RequestPacket->StatusBlock);
506 break;
507
509 if (RequestPacket->OutputBufferLength <
510 ((PVBE_DEVICE_EXTENSION)HwDeviceExtension)->ModeCount * sizeof(VIDEO_MODE_INFORMATION))
511 {
513 return TRUE;
514 }
516 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
518 RequestPacket->StatusBlock);
519 break;
520
522 if (RequestPacket->InputBufferLength < sizeof(VIDEO_CLUT) ||
523 RequestPacket->InputBufferLength <
524 (((PVIDEO_CLUT)RequestPacket->InputBuffer)->NumEntries * sizeof(ULONG)) +
525 FIELD_OFFSET(VIDEO_CLUT, LookupTable))
526 {
528 return TRUE;
529 }
531 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
532 (PVIDEO_CLUT)RequestPacket->InputBuffer,
533 RequestPacket->StatusBlock);
534 break;
535
537 if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
538 {
540 return TRUE;
541 }
543 (PVBE_DEVICE_EXTENSION)HwDeviceExtension,
545 RequestPacket->StatusBlock);
546 break;
547
548 default:
549 RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION;
550 return FALSE;
551 }
552
553 if (Result)
554 RequestPacket->StatusBlock->Status = NO_ERROR;
555
556 return TRUE;
557}
unsigned char BOOLEAN
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:173
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:248
#define IOCTL_VIDEO_QUERY_CURRENT_MODE
Definition: ntddvdeo.h:182
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:221
#define IOCTL_VIDEO_SET_COLOR_REGISTERS
Definition: ntddvdeo.h:218
#define IOCTL_VIDEO_RESET_DEVICE
Definition: ntddvdeo.h:206
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:176
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:191
VP_STATUS Status
Definition: video.h:323
ULONG InputBufferLength
Definition: video.h:333
PSTATUS_BLOCK StatusBlock
Definition: video.h:331
ULONG OutputBufferLength
Definition: video.h:335
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
BOOLEAN FASTCALL VBEResetDevice(PVBE_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:745
BOOLEAN FASTCALL VBEQueryAvailModes(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION ReturnedModes, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:942
BOOLEAN FASTCALL VBESetCurrentMode(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:705
BOOLEAN FASTCALL VBEQueryCurrentMode(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoModeInfo, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:972
BOOLEAN FASTCALL VBEUnmapVideoMemory(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY VideoMemory, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:826
BOOLEAN FASTCALL VBESetColorRegisters(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_CLUT ColorLookUpTable, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:997
BOOLEAN FASTCALL VBEQueryNumAvailModes(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_NUM_MODES Modes, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:845
BOOLEAN FASTCALL VBEMapVideoMemory(PVBE_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY RequestedAddress, PVIDEO_MEMORY_INFORMATION MapInformation, PSTATUS_BLOCK StatusBlock)
Definition: vbemp.c:769
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by DriverEntry().

◆ VBEUnmapVideoMemory()

BOOLEAN FASTCALL VBEUnmapVideoMemory ( PVBE_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MEMORY  VideoMemory,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 826 of file vbemp.c.

830{
831 VideoPortUnmapMemory(DeviceExtension, VideoMemory->RequestedVirtualAddress,
832 NULL);
833 return TRUE;
834}
VPAPI VP_STATUS NTAPI VideoPortUnmapMemory(IN PVOID HwDeviceExtension, IN OUT PVOID VirtualAddress, IN HANDLE ProcessHandle)

Referenced by VBEStartIO().