[mutter/cherry-pick-acadf5b3] onscreen/native: Increase buffer ref count in copy_shared_framebuffer_cpu




commit 184163dc68369ecaa89f8a57e78e2d0ea691ac9c
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 00b2d9f89c..ca3752bcb3 100644
--- a/src/backends/native/meta-onscreen-native.c
+++ b/src/backends/native/meta-onscreen-native.c
@@ -872,8 +872,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]