diff --git a/data/settings/kernel/drivers/vesa b/data/settings/kernel/drivers/vesa index 80a1366263..141193f28d 100644 --- a/data/settings/kernel/drivers/vesa +++ b/data/settings/kernel/drivers/vesa @@ -2,3 +2,8 @@ # mode {x-resolution} {y-resolution} {bitdepth}, # for example: #mode 1280 1024 32 + +# Set NVIDIA scaling mode +# 1: disable scaling completely +# other modes are available depending on the BIOS +#nvidia_scaling 1 diff --git a/src/system/boot/platform/bios_ia32/video.cpp b/src/system/boot/platform/bios_ia32/video.cpp index 4a719478f7..220db2d5a3 100644 --- a/src/system/boot/platform/bios_ia32/video.cpp +++ b/src/system/boot/platform/bios_ia32/video.cpp @@ -258,6 +258,33 @@ find_edid_mode(edid1_info& info, bool allowPalette) } +static void +vesa_fixups(void *settings) +{ + const char *oem_string = (const char *)sInfo.oem_string; + + if (!strcmp(oem_string, "NVIDIA")) { + const char *arg = NULL; + int32 scaling = -1; + + if (settings != NULL) + arg = get_driver_parameter(settings, "nvidia_scaling", NULL, "1"); + if (arg != NULL) + scaling = strtol(arg, NULL, 0); + + if (scaling > -1) { + dprintf("Setting nvidia scaling mode to %" B_PRId32 "\n", scaling); + struct bios_regs regs; + regs.eax = 0x4f14; + regs.ebx = 0x0102; + regs.ecx = scaling; + call_bios(0x10, ®s); + } + } + +} + + static bool get_mode_from_settings(void) { @@ -268,6 +295,8 @@ get_mode_from_settings(void) if (handle == NULL) return false; + vesa_fixups(handle); + bool found = false; const driver_settings *settings = get_driver_settings(handle); @@ -439,30 +468,12 @@ vesa_get_vbe_info_block(vbe_info_block *info) } -static void -vesa_fixups(vbe_info_block *info) -{ - const char *oem_string = (const char *)info->oem_string; - - if (!strcmp(oem_string, "NVIDIA")) { - dprintf("Disabling nvidia scaling.\n"); - struct bios_regs regs; - regs.eax = 0x4f14; - regs.ebx = 0x0102; - regs.ecx = 1; // centered unscaled - call_bios(0x10, ®s); - } -} - - static status_t vesa_init(vbe_info_block *info, video_mode **_standardMode) { if (vesa_get_vbe_info_block(info) != B_OK) return B_ERROR; - vesa_fixups(info); - // fill mode list and find standard video mode video_mode *standardMode = NULL;