mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
WindowServer: Flush display buffer when flashing
If the device requires a flush and we modify the front buffer, we need to flush those changes to the front buffer. This makes the flashing work using the VirtIOGPU. Also fix a minor bug where we flushed the front buffer instead of the back buffer after flipping, which caused the VirtIOGPU to not work as expected when using the SDL backend and disabling buffer flipping.
This commit is contained in:
parent
02651f8dc6
commit
83b512789c
Notes:
sideshowbarker
2024-07-18 09:24:11 +09:00
Author: https://github.com/tomuta
Commit: 83b512789c
Pull-request: https://github.com/SerenityOS/serenity/pull/8612
3 changed files with 40 additions and 5 deletions
|
@ -413,4 +413,25 @@ void Screen::flush_display(int buffer_index)
|
|||
fb_data.too_many_pending_flush_rects = false;
|
||||
fb_data.pending_flush_rects.clear_with_capacity();
|
||||
}
|
||||
|
||||
void Screen::flush_display_front_buffer(int front_buffer_index, Gfx::IntRect& rect)
|
||||
{
|
||||
VERIFY(m_can_device_flush_buffers);
|
||||
auto scale_factor = this->scale_factor();
|
||||
FBRect flush_rect {
|
||||
x : (unsigned)(rect.x() * scale_factor),
|
||||
y : (unsigned)(rect.y() * scale_factor),
|
||||
width : (unsigned)(rect.width() * scale_factor),
|
||||
height : (unsigned)(rect.height() * scale_factor)
|
||||
};
|
||||
|
||||
if (fb_flush_buffers(m_framebuffer_fd, front_buffer_index, &flush_rect, 1) < 0) {
|
||||
int err = errno;
|
||||
if (err == ENOTSUP)
|
||||
m_can_device_flush_buffers = false;
|
||||
else
|
||||
dbgln("Screen #{}: Error ({}) flushing display front buffer: {}", index(), err, strerror(err));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue