1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

WindowServer: Implement mechanism to restore safe mode setting

Such mechanism will be used by the Intel Graphics driver, because we
lack support of changing the resolution on this driver currently, so,
when WindowServer will try to mode-set the display then it will fail,
and will use the safe mode-setting call instead to be able to show
something on screen.
This commit is contained in:
Liav A 2022-04-29 20:11:42 +03:00 committed by Andreas Kling
parent d9a2706079
commit 6d7e2596e0
3 changed files with 15 additions and 3 deletions

View file

@ -66,8 +66,15 @@ ErrorOr<void> HardwareScreenBackend::set_head_resolution(FBHeadResolution resolu
mode_setting.vertical_active = resolution.height;
mode_setting.horizontal_stride = resolution.pitch;
auto rc = fb_set_head_mode_setting(m_framebuffer_fd, &mode_setting);
if (rc != 0)
return Error::from_syscall("fb_set_head_mode_setting", rc);
if (rc != 0) {
dbgln("Failed to set backend mode setting: falling back to safe resolution");
rc = fb_set_safe_head_mode_setting(m_framebuffer_fd);
if (rc != 0) {
dbgln("Failed to set backend safe mode setting: aborting");
return Error::from_syscall("fb_set_safe_head_mode_setting", rc);
}
dbgln("Failed to set backend mode setting: falling back to safe resolution - success.");
}
}
return {};