vesa BIOS patching: try to use modes reported as invalid by the BIOS

It seems some versions of Intel BIOS report the mode as invalid after
patching (probably there is not enough patching), but setting the mode
will actually work. So, if we detect no mode with our patches, and we
detect a broken mode, attempt to use that.

May fix #17929

Change-Id: Icb9259a79b5a49d18946b682af89dda16176e854
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5628
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
PulkoMandy 2022-09-08 18:40:36 +02:00 committed by waddlesplash
parent e89a5cc418
commit 134fa6111f

View File

@ -364,6 +364,8 @@ status_t
vesa_set_custom_display_mode(vesa_info& info, display_mode& mode)
{
int32 modeIndex = -1;
int32 brokenModeIndex = -1;
if (info.shared_info->bios_type == kUnknownBiosType)
return B_NOT_SUPPORTED;
@ -404,10 +406,11 @@ vesa_set_custom_display_mode(vesa_info& info, display_mode& mode)
for (uint32 i = 0; i < info.shared_info->vesa_mode_count; i++) {
status = vbe_get_mode_info(state, info.modes[i].mode, &modeInfo);
if (status != B_OK) {
// Sometimes the patching prevents us from getting the mode info?
// Sometimes the patching prevents us from getting the mode info. The modesetting
// still works, so we can detect the "broken" mode this way and then activate it.
dprintf(DEVICE_NAME ": vesa_set_custom_display_mode(): cannot get mode info for %x\n",
info.modes[i].mode);
// Just ignore modes that turn out to be invalid...
brokenModeIndex = info.modes[i].mode;
continue;
}
@ -418,6 +421,9 @@ vesa_set_custom_display_mode(vesa_info& info, display_mode& mode)
}
}
if (modeIndex < 0)
modeIndex = brokenModeIndex;
if (modeIndex >= 0) {
dprintf(DEVICE_NAME ": custom mode resolution %dx%d succesfully patched at index %"
B_PRIx32 "\n", modeInfo.width, modeInfo.height, modeIndex);