mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-04 09:14:21 +03:00
WindowServer: Fix mapping the correct framebuffer size
If we don't support double buffering for a certain type of hardware, don't try to map with size calculated with (pitch * height * 2), as it will result in trying to map more memory than is available in the framebuffer memory range.
This commit is contained in:
parent
76ace3629a
commit
36f2e85823
Notes:
sideshowbarker
2024-07-17 10:10:18 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/36f2e85823 Pull-request: https://github.com/SerenityOS/serenity/pull/15326
@ -85,7 +85,11 @@ ErrorOr<void> HardwareScreenBackend::map_framebuffer()
|
||||
if (rc != 0) {
|
||||
return Error::from_syscall("graphics_connector_get_head_mode_setting"sv, rc);
|
||||
}
|
||||
m_size_in_bytes = mode_setting.horizontal_stride * mode_setting.vertical_active * 2;
|
||||
if (m_can_set_head_buffer) {
|
||||
m_size_in_bytes = mode_setting.horizontal_stride * mode_setting.vertical_active * 2;
|
||||
} else {
|
||||
m_size_in_bytes = mode_setting.horizontal_stride * mode_setting.vertical_active;
|
||||
}
|
||||
m_framebuffer = (Gfx::ARGB32*)TRY(Core::System::mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_display_connector_fd, 0));
|
||||
|
||||
if (m_can_set_head_buffer) {
|
||||
|
Loading…
Reference in New Issue
Block a user