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>
This commit is contained in:
PulkoMandy 2022-07-24 13:41:32 +02:00 committed by Jérôme Duval
parent 216bcf7a3d
commit 9fec431f60
3 changed files with 32 additions and 5 deletions

View File

@ -1,9 +1,16 @@
#vesa resolution configuration:
# mode {x-resolution} {y-resolution} {bitdepth},
# for example:
# VESA resolution configuration.
# mode {x-resolution} {y-resolution} {bitdepth}
# For example, uncomment the line below to use 1280x1024 with 32bit colors (if available):
#mode 1280 1024 32
# Set NVIDIA scaling mode
# Set NVIDIA scaling mode.
# 1: disable scaling completely
# other modes are available depending on the BIOS
#nvidia_scaling 1
# Enable bios patching.
# On some video cards, the VESA driver is able to inject custom video resolutions in the BIOS.
# This does not modify the BIOS in the hardware, the changes are erased on reboot. However,
# this is outside of VESA specifications and sometimes results in a black screen. As a result,
# this feature is disabled by default.
#bios_patching true

View File

@ -142,6 +142,9 @@ device_ioctl(void* cookie, uint32 msg, void* buffer, size_t bufferLength)
if (bufferLength != sizeof(display_mode))
return B_BAD_VALUE;
if (info->shared_info->bios_type == kUnknownBiosType)
return B_NOT_ALLOWED;
display_mode mode;
if (user_memcpy(&mode, buffer, sizeof(display_mode)) != B_OK)
return B_BAD_ADDRESS;

View File

@ -8,6 +8,7 @@
#include "vesa.h"
#include <boot_item.h>
#include <driver_settings.h>
#include <frame_buffer_console.h>
#include <util/kernel_cpp.h>
#include <vm/vm.h>
@ -251,6 +252,10 @@ vbe_set_bits_per_gun(bios_state* state, vesa_info& info, uint8 bits)
}
// We used to read the existing mode set by the bootsplash to avoid setting the same mode
// when entering app_server, but this has been disabled. So now there is always a modeset
// done when app_server starts.
#if 0
static status_t
vbe_get_vesa_info(bios_state* state, vesa_info& info)
{
@ -281,6 +286,7 @@ vbe_get_vesa_info(bios_state* state, vesa_info& info)
return status;
}
#endif
/*! Remaps the frame buffer if necessary; if we've already mapped the complete
@ -414,7 +420,18 @@ vesa_init(vesa_info& info)
if (status != B_OK)
return status;
vesa_identify_bios(state, &sharedInfo);
void* settings = load_driver_settings("vesa");
bool patchingAllowed = false;
if (settings != NULL) {
patchingAllowed = get_driver_boolean_parameter(settings, "bios_patching",
patchingAllowed, true);
unload_driver_settings(settings);
}
if (patchingAllowed)
vesa_identify_bios(state, &sharedInfo);
else
sharedInfo.bios_type = kUnknownBiosType;
vbe_get_dpms_capabilities(state, info.vbe_dpms_capabilities,
sharedInfo.dpms_capabilities);