From 61ae9eedb6283324f2596b1f6b665f78901f29e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 4 Jul 2024 18:07:21 +0200 Subject: [PATCH] cogl: Update latest sync fd also from cogl_gl_framebuffer_flush/finish This ensures that any drawing for screen casting is reflected in the sync fd. Fixes: 99209958b90b ("cogl: Store latest GPU work completed sync fd") Part-of: --- cogl/cogl/cogl-onscreen.c | 5 ++--- cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index ce07145c7..3bcb23307 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -291,11 +291,10 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, _cogl_framebuffer_flush_journal (framebuffer); - /* Update our "latest" sync fd to contain all previous work */ - _cogl_context_update_sync (context); - if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SYNC_FRAME))) cogl_framebuffer_finish (framebuffer); + else + _cogl_context_update_sync (context); cogl_framebuffer_discard_buffers (framebuffer, COGL_BUFFER_BIT_DEPTH | diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index 8c80d9a25..35f811100 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -294,6 +294,9 @@ cogl_gl_framebuffer_finish (CoglFramebufferDriver *driver) { CoglContext *ctx = context_from_driver (driver); + /* Update our "latest" sync fd to contain all previous work */ + _cogl_context_update_sync (ctx); + ctx->glFinish (); } @@ -302,6 +305,9 @@ cogl_gl_framebuffer_flush (CoglFramebufferDriver *driver) { CoglContext *ctx = context_from_driver (driver); + /* Update our "latest" sync fd to contain all previous work */ + _cogl_context_update_sync (ctx); + ctx->glFlush (); }