History log of /haiku/src/add-ons/kernel/drivers/graphics/vesa/device.cpp
Revision Date Author Comments
# 9fec431f 24-Jul-2022 PulkoMandy <pulkomandy@pulkomandy.tk>

vesa: disable the livepatching code by default

It can be enabled by putting "bios_patching true" in the VESA settings
file.

This patching does not work yet on modern hardware, but the detection
code to decide if we should try patching still says it found the
modetables. In this situation we can crash the BIOS or other weird
things can happen.

To avoid these problems, and because VESA is supposed to be the failsafe
option, disable this code by default, and let people who want to
experiment with it first enable it in the settings file.

Should fix #17633.

Change-Id: I4d89ff6dfeb7d02e39cd3da7b22ddd5411b10822
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5499
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 1005a276 19-Oct-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

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 <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 87784caf 27-Jan-2014 Alexander von Gluck IV <kallisti5@unixzen.com>

vesa: Fix tracking of device opens / closes

* Don't raise the open_count when the open fails


# 4ea01167 24-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Turned the benaphore into a mutex, and removed the now unused lock.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34205 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b2a75cf5 14-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed mixup of the VGA compatibility layer - if the bit is set, it means the
device is not compatible, after all.
* No longer accept color changes if the mode is not an 8 bit one. I think that
BWindowScreen does that after changing the mode, so that is messes up the
colors, at least that's the theory, will test on real iron now.
* Use VGA as a fallback if setting the palette via VBE failed. This brings back
the colors for ParticlesII in Qemu (but not in VirtualBox, which seems to be
completely broken in this regard).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bb693d77 14-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added VESA capabilities field to the kernel args.
* The vesa driver no longer uses VGA programming if the chip does not support
VGA compatibility.
* The VESA driver now tries to set the DAC to 8 bits per color gun.
* In VESA modes, the driver no longer tries to use VGA programming; introduced
the new vesa_set_indexed_colors() that is now used for palette programming.
This should fix wrong colors of 8 bit BWindowScreen users with VESA on real
hardware (emulators usually didn't mind either way).
* Note that the app_server needs to maintain a palette per 8 bit screen, as
right now, the colors are garbled after a workspace switch. Stefano, are you
looking into that already?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32347 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bfd4c59b 05-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Added DPMS support to the VESA driver, in case the hardware/BIOS supports it.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30974 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9f161845 28-May-2008 Axel Dörfler <axeld@pinc-software.de>

Patch by Jan Klötzke with minor changes by myself:
* Use vm86 mode to call the VESA BIOS to do the actual mode switching by
providing an ioctl in the vesa driver.
* Fix vm86.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25680 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6328832f 30-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed get_boot_item() API: it now also can retrieve the size of the boot
item entry.
* The bios_ia32 video platform code now stores the available VESA modes in
the new vesa_modes kernel_args field.
* When configuring a VESA mode via settings file, it's no longer needed to
specify the exact mode - the closest available mode is now used. This should
help with bug #1962.
* frame_buffer_console_init() now also creates a boot_item for the VESA modes
in the kernel_args.
* The VESA accelerant now filters the mode list to only contain modes that
are actually supported.
* Moved non-shared vesa driver data into its own file vesa_private.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24675 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c6f7795 19-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Moved VGA planar mode blitting into the VESA kernel driver.
* In grayscale mode, the AccelerantHWInterface now sets the palette correctly.
* HWInterface now has a fVGADevice set by AccelerantHWInterface which will be used
to talk to the VESA driver.
* Completed planar blitting for all 4 planes; we now have a perfect 16 color
grayscale mode when you choose "Standard VGA mode" in the boot loader with
an unsupported graphics card (such as in Qemu).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19567 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e5b4782b 26-May-2005 Axel Dörfler <axeld@pinc-software.de>

Made some necessary enhancements to class Screen; the app_server also
has to care about refresh rates. Also changed Screen::GetMode() (formerly
Resolution()) to return all interesting values, so that hopefully no one
will call it anymore like RootLayer::SetScreens() did.
Greatly improved the horrible RootLayer::SetScreens().
The app_server is now able to deal with failing HWInterface::SetMode() calls;
in this case, it will fall back to the hardware's current mode. This now
also works correctly in combination with the vesa driver, so that you don't
have to compile the app_server with the same resolution you boot in anymore.
SetMode() now always returns if it succeeded or not.
Renamed RootLayer::fScreenXYResolution to fScreenWidth/Height respectively.
Removed the useless DisplayDriver::DisplayMode() method.
Added B_GET_DISPLAY_MODE to the required accelerant hooks.
Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12831 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93ee2104 08-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Added very basic VESA driver. Will be improved in the future (right now
it doesn't really do anything, it just passes the initial frame buffer
on to the app_server).
While it seems to work on real hardware (if you set the video mode to
640x480x32, app_server restriction), under Bochs, the app_server crashes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12273 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 87784cafb89306b7e11440470a23302c14469c28 27-Jan-2014 Alexander von Gluck IV <kallisti5@unixzen.com>

vesa: Fix tracking of device opens / closes

* Don't raise the open_count when the open fails


# 4ea01167bd2382520e8bb9ffc8eb9fc075b3a843 24-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Turned the benaphore into a mutex, and removed the now unused lock.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34205 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b2a75cf56cafe2cf4b9258311e1d331bd48ab081 14-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed mixup of the VGA compatibility layer - if the bit is set, it means the
device is not compatible, after all.
* No longer accept color changes if the mode is not an 8 bit one. I think that
BWindowScreen does that after changing the mode, so that is messes up the
colors, at least that's the theory, will test on real iron now.
* Use VGA as a fallback if setting the palette via VBE failed. This brings back
the colors for ParticlesII in Qemu (but not in VirtualBox, which seems to be
completely broken in this regard).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bb693d77643c7bc4b2b10847007a94af5e84b953 14-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added VESA capabilities field to the kernel args.
* The vesa driver no longer uses VGA programming if the chip does not support
VGA compatibility.
* The VESA driver now tries to set the DAC to 8 bits per color gun.
* In VESA modes, the driver no longer tries to use VGA programming; introduced
the new vesa_set_indexed_colors() that is now used for palette programming.
This should fix wrong colors of 8 bit BWindowScreen users with VESA on real
hardware (emulators usually didn't mind either way).
* Note that the app_server needs to maintain a palette per 8 bit screen, as
right now, the colors are garbled after a workspace switch. Stefano, are you
looking into that already?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32347 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bfd4c59b639308dc5bc06f8273c4bb0c5e4e4598 05-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Added DPMS support to the VESA driver, in case the hardware/BIOS supports it.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30974 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9f16184577a3506b927dbc5cfff47ab03500deda 28-May-2008 Axel Dörfler <axeld@pinc-software.de>

Patch by Jan Klötzke with minor changes by myself:
* Use vm86 mode to call the VESA BIOS to do the actual mode switching by
providing an ioctl in the vesa driver.
* Fix vm86.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25680 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6328832fba8f149074dbe7502dc0c180ff013263 30-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed get_boot_item() API: it now also can retrieve the size of the boot
item entry.
* The bios_ia32 video platform code now stores the available VESA modes in
the new vesa_modes kernel_args field.
* When configuring a VESA mode via settings file, it's no longer needed to
specify the exact mode - the closest available mode is now used. This should
help with bug #1962.
* frame_buffer_console_init() now also creates a boot_item for the VESA modes
in the kernel_args.
* The VESA accelerant now filters the mode list to only contain modes that
are actually supported.
* Moved non-shared vesa driver data into its own file vesa_private.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24675 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c6f77951ed2366737266cae1bf0c2f98842e6f5 19-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Moved VGA planar mode blitting into the VESA kernel driver.
* In grayscale mode, the AccelerantHWInterface now sets the palette correctly.
* HWInterface now has a fVGADevice set by AccelerantHWInterface which will be used
to talk to the VESA driver.
* Completed planar blitting for all 4 planes; we now have a perfect 16 color
grayscale mode when you choose "Standard VGA mode" in the boot loader with
an unsupported graphics card (such as in Qemu).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19567 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e5b4782b4ee7663decea60a4385fce3122c2b16d 26-May-2005 Axel Dörfler <axeld@pinc-software.de>

Made some necessary enhancements to class Screen; the app_server also
has to care about refresh rates. Also changed Screen::GetMode() (formerly
Resolution()) to return all interesting values, so that hopefully no one
will call it anymore like RootLayer::SetScreens() did.
Greatly improved the horrible RootLayer::SetScreens().
The app_server is now able to deal with failing HWInterface::SetMode() calls;
in this case, it will fall back to the hardware's current mode. This now
also works correctly in combination with the vesa driver, so that you don't
have to compile the app_server with the same resolution you boot in anymore.
SetMode() now always returns if it succeeded or not.
Renamed RootLayer::fScreenXYResolution to fScreenWidth/Height respectively.
Removed the useless DisplayDriver::DisplayMode() method.
Added B_GET_DISPLAY_MODE to the required accelerant hooks.
Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12831 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93ee21046d225f4f58eeeade87a937b8c10da6f1 08-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Added very basic VESA driver. Will be improved in the future (right now
it doesn't really do anything, it just passes the initial frame buffer
on to the app_server).
While it seems to work on real hardware (if you set the video mode to
640x480x32, app_server restriction), under Bochs, the app_server crashes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12273 a95241bf-73f2-0310-859d-f6bbb57e9c96