[mutter/gnome-40] onscreen/native: Increase buffer ref count in copy_shared_framebuffer_cpu



commit 24837a9663a928f5540fae0b4864fbbdabde2411
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Wed Nov 24 16:16:40 2021 +0800

    onscreen/native: Increase buffer ref count in copy_shared_framebuffer_cpu
    
    It was dropping to zero after the first frame because it hadn't been
    incremented high enough. So the second frame would crash with:
    ```
      #0 g_type_check_instance_cast
      #1 META_DRM_BUFFER
      #2 copy_shared_framebuffer_cpu
    ```
    That's the CPU-copy path (fallback-fallback) that probably no one is using
    but it does work after this fix. Exactly the same issue as was fixed
    in `copy_shared_framebuffer_primary_gpu` by 36352f44f9547ea1.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2104>
    
    
    (cherry picked from commit acadf5b3f7a30aa6744d1936762d65e367db730a)

 src/backends/native/meta-onscreen-native.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c
index 02cd5da2e8..f244c7fc1a 100644
--- a/src/backends/native/meta-onscreen-native.c
+++ b/src/backends/native/meta-onscreen-native.c
@@ -857,8 +857,7 @@ copy_shared_framebuffer_cpu (CoglOnscreen                        *onscreen,
 
   cogl_object_unref (dumb_bitmap);
 
-  g_clear_object (&secondary_gpu_state->gbm.next_fb);
-  secondary_gpu_state->gbm.next_fb = buffer;
+  g_set_object (&secondary_gpu_state->gbm.next_fb, buffer);
   secondary_gpu_state->cpu.current_dumb_fb = buffer_dumb;
 }
 


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