[haiku-commits] haiku: hrev53109 - src/system/boot/platform/bios_ia32 data/settings/kernel/drivers

  • From: François Revol <revol@xxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 7 May 2019 22:44:42 -0400 (EDT)

hrev53109 adds 1 changeset to branch 'master'
old head: 0bed4dedc95e76802976173c049888f1abf4b77b
new head: 25de7c1b120b83598170e6be810058447db802fd
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=25de7c1b120b+%5E0bed4dedc95e

----------------------------------------------------------------------------

25de7c1b120b: loader: VESA: make nvidia scaling fixup a driver setting
  
  Since not everyone likes the default, make it an option in the vesa
  settings file. Note setting a mode with the Screen prefs overwrites
  the file so it will discard the option.
  
  Also move the code to get_mode_from_settings() since we can't load driver
  settings as early as vesa_init().
  
  Change-Id: I93080bd1fbc064dab053624ad37935268b1ed17d

                                          [ François Revol <revol@xxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53109
Commit:      25de7c1b120b83598170e6be810058447db802fd
URL:         https://git.haiku-os.org/haiku/commit/?id=25de7c1b120b
Author:      François Revol <revol@xxxxxxx>
Date:        Wed May  8 02:32:08 2019 UTC

----------------------------------------------------------------------------

2 files changed, 34 insertions(+), 18 deletions(-)
data/settings/kernel/drivers/vesa            |  5 +++
src/system/boot/platform/bios_ia32/video.cpp | 47 +++++++++++++++---------

----------------------------------------------------------------------------

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, &regs);
+               }
+       }
+
+}
+
+
 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, &regs);
-       }
-}
-
-
 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;


Other related posts: