From 647eec5f7f08e60067234899c83d60d5d44cc6bb Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 9 Jul 2020 14:03:53 +0800 Subject: [PATCH] cogl: Flush specific framebuffers This resolves a couple of FIXMEs. The FIXME comments were right in stating that not *all* journals needed flushing, only the one we are trying to put on screen needs flushing. However we can't eliminate all flushes because the winsys swap calls that follow go directly into OpenGL which knows nothing about cogl journalling. So the journal *must* be flushed before the swap, to give OpenGL the correct state. P.S. If this turns out to cause any bugs then the next best answer is to just remove the FIXME comments. Because flushing is still the right thing to do. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1362 --- cogl/cogl/cogl-onscreen.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index 4f3f48fbe..ef996017a 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -304,8 +304,7 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, info->frame_counter = onscreen->frame_counter; g_queue_push_tail (&onscreen->pending_frame_infos, info); - /* FIXME: we shouldn't need to flush *all* journals here! */ - cogl_flush (); + _cogl_framebuffer_flush_journal (framebuffer); winsys = _cogl_framebuffer_get_winsys (framebuffer); winsys->onscreen_swap_buffers_with_damage (onscreen, @@ -354,8 +353,7 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen, info->frame_counter = onscreen->frame_counter; g_queue_push_tail (&onscreen->pending_frame_infos, info); - /* FIXME: we shouldn't need to flush *all* journals here! */ - cogl_flush (); + _cogl_framebuffer_flush_journal (framebuffer); winsys = _cogl_framebuffer_get_winsys (framebuffer);