1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:58:11 +00:00

WindowServer: Implement support for combined buffer flipping + flushing

Some devices may require DMA transfers to flush the updated buffer
areas prior to flipping. For those devices we track the areas that
require flushing prior to the next flip. For devices that do not
support flipping, but require flushing, we'll simply flush after
updating the front buffer.

This also adds a small optimization that skips these steps entirely for
a screen that doesn't have any updates that need to be rendered.
This commit is contained in:
Tom 2021-07-03 12:43:35 -06:00 committed by Andreas Kling
parent 45a2bc27d5
commit fdae117600
7 changed files with 82 additions and 29 deletions

View file

@ -364,7 +364,7 @@ void Screen::queue_flush_display_rect(Gfx::IntRect const& flush_region)
}
}
void Screen::flush_display()
void Screen::flush_display(int buffer_index)
{
VERIFY(m_can_device_flush_buffers);
auto& fb_data = *m_framebuffer_data;
@ -380,7 +380,7 @@ void Screen::flush_display()
flush_rect.height *= scale_factor;
}
if (fb_flush_buffers(m_framebuffer_fd, fb_data.pending_flush_rects.data(), (unsigned)fb_data.pending_flush_rects.size()) < 0) {
if (fb_flush_buffers(m_framebuffer_fd, buffer_index, fb_data.pending_flush_rects.data(), (unsigned)fb_data.pending_flush_rects.size()) < 0) {
int err = errno;
if (err == ENOTSUP)
m_can_device_flush_buffers = false;