mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 05:07:35 +00:00
WindowServer: Query driver for framebuffer offset
Depending on the driver, the second buffer may not be located right after the first, e.g. it may be page aligned. This removes this assumption and queries the driver for the appropriate offset.
This commit is contained in:
parent
fdae117600
commit
6e792553f2
Notes:
sideshowbarker
2024-07-18 10:25:55 +09:00
Author: https://github.com/tomuta
Commit: 6e792553f2
Pull-request: https://github.com/SerenityOS/serenity/pull/8409
Reviewed-by: https://github.com/ccapitalK
5 changed files with 47 additions and 6 deletions
|
@ -225,6 +225,19 @@ bool Screen::set_resolution(bool initial)
|
|||
|
||||
m_framebuffer = (Gfx::RGBA32*)mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebuffer_fd, 0);
|
||||
VERIFY(m_framebuffer && m_framebuffer != (void*)-1);
|
||||
|
||||
if (m_can_set_buffer) {
|
||||
unsigned buffer_offset = 0;
|
||||
rc = fb_get_buffer_offset(m_framebuffer_fd, 1, &buffer_offset);
|
||||
if (rc == 0) {
|
||||
m_back_buffer_offset = buffer_offset;
|
||||
} else {
|
||||
// fall back to assuming the second buffer starts right after the last line of the first
|
||||
m_back_buffer_offset = physical_resolution.pitch * physical_resolution.height;
|
||||
}
|
||||
} else {
|
||||
m_back_buffer_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
m_info.resolution = { physical_resolution.width, physical_resolution.height };
|
||||
|
@ -255,6 +268,15 @@ void Screen::set_buffer(int index)
|
|||
VERIFY(rc == 0);
|
||||
}
|
||||
|
||||
size_t Screen::buffer_offset(int index) const
|
||||
{
|
||||
if (index == 0)
|
||||
return 0;
|
||||
if (index == 1)
|
||||
return m_back_buffer_offset;
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void ScreenInput::set_acceleration_factor(double factor)
|
||||
{
|
||||
VERIFY(factor >= mouse_accel_min && factor <= mouse_accel_max);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue