diff --git a/data/settings/kernel/drivers/vesa b/data/settings/kernel/drivers/vesa index 141193f28d..da6b5c451a 100644 --- a/data/settings/kernel/drivers/vesa +++ b/data/settings/kernel/drivers/vesa @@ -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 diff --git a/src/add-ons/kernel/drivers/graphics/vesa/device.cpp b/src/add-ons/kernel/drivers/graphics/vesa/device.cpp index 508125bd52..cca94479d1 100644 --- a/src/add-ons/kernel/drivers/graphics/vesa/device.cpp +++ b/src/add-ons/kernel/drivers/graphics/vesa/device.cpp @@ -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; diff --git a/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp b/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp index 92480e6cd5..935abc2dae 100644 --- a/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp +++ b/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp @@ -8,6 +8,7 @@ #include "vesa.h" #include +#include #include #include #include @@ -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);