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
This commit is contained in:
parent
0bed4dedc9
commit
25de7c1b12
@ -2,3 +2,8 @@
|
|||||||
# mode {x-resolution} {y-resolution} {bitdepth},
|
# mode {x-resolution} {y-resolution} {bitdepth},
|
||||||
# for example:
|
# for example:
|
||||||
#mode 1280 1024 32
|
#mode 1280 1024 32
|
||||||
|
|
||||||
|
# Set NVIDIA scaling mode
|
||||||
|
# 1: disable scaling completely
|
||||||
|
# other modes are available depending on the BIOS
|
||||||
|
#nvidia_scaling 1
|
||||||
|
@ -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
|
static bool
|
||||||
get_mode_from_settings(void)
|
get_mode_from_settings(void)
|
||||||
{
|
{
|
||||||
@ -268,6 +295,8 @@ get_mode_from_settings(void)
|
|||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
vesa_fixups(handle);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
const driver_settings *settings = get_driver_settings(handle);
|
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
|
static status_t
|
||||||
vesa_init(vbe_info_block *info, video_mode **_standardMode)
|
vesa_init(vbe_info_block *info, video_mode **_standardMode)
|
||||||
{
|
{
|
||||||
if (vesa_get_vbe_info_block(info) != B_OK)
|
if (vesa_get_vbe_info_block(info) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
vesa_fixups(info);
|
|
||||||
|
|
||||||
// fill mode list and find standard video mode
|
// fill mode list and find standard video mode
|
||||||
|
|
||||||
video_mode *standardMode = NULL;
|
video_mode *standardMode = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user