[mutter] renderer/native: state consistency in copy_shared_framebuffer_gpu



commit d7c9042c780cdaf6e89454cd333b4c2699859631
Author: Pekka Paalanen <pekka paalanen collabora com>
Date:   Mon Dec 2 14:00:56 2019 +0200

    renderer/native: state consistency in copy_shared_framebuffer_gpu
    
    To mirror what happens in meta_onscreen_native_swap_buffers_with_damage(), warn
    here too if next_fb is not NULL. This makes it clear to the reader of what the
    expectations are inside this function.
    
    Ensuring next_fb is NULL as the first thing in the function will make all error
    paths equal: no longer some failures reset next_fb while others don't. Removing
    such special cases should reduce surprises.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/810

 src/backends/native/meta-renderer-native.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index e6376493e..d5ba66ad0 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -1786,6 +1786,9 @@ copy_shared_framebuffer_gpu (CoglOnscreen                        *onscreen,
   COGL_TRACE_BEGIN_SCOPED (CopySharedFramebufferSecondaryGpu,
                            "FB Copy (secondary GPU)");
 
+  g_warn_if_fail (secondary_gpu_state->gbm.next_fb == NULL);
+  g_clear_object (&secondary_gpu_state->gbm.next_fb);
+
   if (!meta_egl_make_current (egl,
                               renderer_gpu_data->egl_display,
                               secondary_gpu_state->egl_surface,
@@ -1825,7 +1828,6 @@ copy_shared_framebuffer_gpu (CoglOnscreen                        *onscreen,
       return;
     }
 
-  g_clear_object (&secondary_gpu_state->gbm.next_fb);
   buffer_gbm = meta_drm_buffer_gbm_new (secondary_gpu_state->gpu_kms,
                                         secondary_gpu_state->gbm.surface,
                                         renderer_native->use_modifiers,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]