From 6a0cc1371c83940bd81c8edff42e5bea1c438da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fukan=20Korkmazt=C3=BCrk?= Date: Mon, 30 Sep 2024 16:20:17 -0400 Subject: [PATCH] stage-impl: Ensure that a sync object is created in headless mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During an onscreen swap, the cogl_onscreen_swap_buffers_with_damage() function ensures that the Cogl renderer creates a sync object every frame. This sync object is later shared with the Wayland clients that utilize the explicit sync protocol. However, in headless mode, the function mentioned above is not called. As a result, the sync object the Cogl renderer stores seems to be not created. This causes cogl_context_get_latest_sync_fd() function to return an invalid sync fd, causing Mutter to not be able to materialize the sync timeline point that the clients wait for when the explicit sync protocol is in use. This change simply adds a call to the cogl_framebuffer_flush() function to the offscreen swap path to make sure that there is a sync object that can be shared with the clients, which will be signalled when all the queued operations before the swap are completed. Signed-off-by: Doğukan Korkmaztürk Part-of: --- src/backends/meta-stage-impl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backends/meta-stage-impl.c b/src/backends/meta-stage-impl.c index 6f140b1af..7229aa36c 100644 --- a/src/backends/meta-stage-impl.c +++ b/src/backends/meta-stage-impl.c @@ -320,6 +320,8 @@ swap_framebuffer (ClutterStageWindow *stage_window, meta_topic (META_DEBUG_BACKEND, "fake offscreen swap (framebuffer: %p)", framebuffer); + + cogl_framebuffer_flush (framebuffer); meta_stage_view_perform_fake_swap (view, priv->global_frame_counter); priv->global_frame_counter++; }