vesa: live BIOS patching for Intel video devices

The VESA standard does not define any way for software to set a custom
video mode, which means normally we would be constrained to whichever
modes the video card manufacturer decided to provide. However, since we
run the BIOS in an emulated environment, it is possible (and even quite
easy) to patch it and inject any video mode we want, provided we know
the format to use and where to put the info in.

This approach was used in the NewOS VESA driver, as well as in
915resolution (a tool that predates the availability of native drivers
for Linux for Intel videocards). Later on it was also used in Chameleon
and Clover, bootloaders that are used for hackintoshes (running MacOS on
unsupported hardware).

This commit implements full support for Intel cards only, AMD and NVidia
will be added later (but there is preliminary code to detect them)

Change-Id: I2c528ba18b3863f486da694860a10761efcbfb3f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4624
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Adrien Destugues
2022-03-02 22:39:02 +00:00
committed by waddlesplash
parent 6804f6c764
commit 1005a27603
7 changed files with 287 additions and 5 deletions
+13 -1
View File
@@ -23,8 +23,15 @@ struct vesa_mode {
uint8 bits_per_pixel;
};
enum bios_type_enum {
kUnknownBiosType = 0,
kIntelBiosType,
kNVidiaBiosType,
kAtomBiosType1,
kAtomBiosType2
};
struct vesa_shared_info {
int32 type;
area_id mode_list_area; // area containing display mode list
uint32 mode_count;
display_mode current_mode;
@@ -40,6 +47,10 @@ struct vesa_shared_info {
edid1_info edid_info;
bool has_edid;
bios_type_enum bios_type;
uint16 mode_table_offset;
// Atombios only: offset to the table of video modes in the bios, used for patching in
// extra video modes.
uint32 dpms_capabilities;
};
@@ -53,6 +64,7 @@ enum {
VESA_GET_DPMS_MODE,
VESA_SET_DPMS_MODE,
VESA_SET_INDEXED_COLORS,
VESA_SET_CUSTOM_DISPLAY_MODE,
VGA_PLANAR_BLIT,
};