summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-04-29 20:11:42 +0300
committerAndreas Kling <kling@serenityos.org>2022-05-05 20:55:57 +0200
commit6d7e2596e00c0edc570ddc438b14e2ccce153762 (patch)
tree31b63c94f9a422f0988319577640f140343f862a /Userland
parentd9a2706079d314416353148cc9822e997c37b680 (diff)
downloadserenity-6d7e2596e00c0edc570ddc438b14e2ccce153762.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Services/WindowServer/HardwareScreenBackend.cpp11
-rw-r--r--Userland/Services/WindowServer/ScreenLayout.ipp2
2 files changed, 10 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/HardwareScreenBackend.cpp b/Userland/Services/WindowServer/HardwareScreenBackend.cpp
index 36469a5cd6..f0bf2912b5 100644
--- a/Userland/Services/WindowServer/HardwareScreenBackend.cpp
+++ b/Userland/Services/WindowServer/HardwareScreenBackend.cpp
@@ -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 {};
diff --git a/Userland/Services/WindowServer/ScreenLayout.ipp b/Userland/Services/WindowServer/ScreenLayout.ipp
index 3d5f32f1cd..f52a4096f2 100644
--- a/Userland/Services/WindowServer/ScreenLayout.ipp
+++ b/Userland/Services/WindowServer/ScreenLayout.ipp
@@ -250,7 +250,7 @@ bool ScreenLayout::load_config(const Core::ConfigFile& config_file, String* erro
*this = {};
return false;
}
- auto device = (mode == Screen::Mode::Device) ? config_file.read_entry(group_name, "Device") : Optional<String> {};
+ auto device = (mode == Screen::Mode::Device || mode == Screen::Mode::DisplayConnectorDevice) ? config_file.read_entry(group_name, "Device") : Optional<String> {};
screens.append({ mode, device,
{ config_file.read_num_entry(group_name, "Left"), config_file.read_num_entry(group_name, "Top") },
{ config_file.read_num_entry(group_name, "Width"), config_file.read_num_entry(group_name, "Height") },