kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

Blame SOURCES/0002-renderer-native-Don-t-leak-DMA-buffer-CoglFramebuffe.patch

99364f
From 2e4d3e22aff7cc8e41fa08d798c55a39a542476c Mon Sep 17 00:00:00 2001
99364f
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
99364f
Date: Tue, 2 Jun 2020 18:34:57 +0200
99364f
Subject: [PATCH 2/2] renderer-native: Don't leak DMA buffer CoglFramebuffer
99364f
99364f
When we created the DMA buffer backed CoglFramebuffer, we handed it over
99364f
to CoglDmaBufHandle which took its own reference. What we failed to do
99364f
was to release our own reference to it, effectively leaking it.
99364f
99364f
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
99364f
(cherry picked from commit c823b5ddba18d30e1fdb74d6764cd40637dc4054)
99364f
---
99364f
 src/backends/native/meta-renderer-native.c | 8 ++++++--
99364f
 1 file changed, 6 insertions(+), 2 deletions(-)
99364f
99364f
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
99364f
index ba98de650..dbb88edb8 100644
99364f
--- a/src/backends/native/meta-renderer-native.c
99364f
+++ b/src/backends/native/meta-renderer-native.c
99364f
@@ -2633,6 +2633,7 @@ meta_renderer_native_create_dma_buf (CoglRenderer  *cogl_renderer,
99364f
     case META_RENDERER_NATIVE_MODE_GBM:
99364f
       {
99364f
         CoglFramebuffer *dmabuf_fb;
99364f
+        CoglDmaBufHandle *dmabuf_handle;
99364f
         struct gbm_bo *new_bo;
99364f
         int dmabuf_fd = -1;
99364f
 
99364f
@@ -2669,8 +2670,11 @@ meta_renderer_native_create_dma_buf (CoglRenderer  *cogl_renderer,
99364f
         if (!dmabuf_fb)
99364f
           return NULL;
99364f
 
99364f
-        return cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo,
99364f
-                                        (GDestroyNotify) gbm_bo_destroy);
99364f
+        dmabuf_handle =
99364f
+          cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo,
99364f
+                                   (GDestroyNotify) gbm_bo_destroy);
99364f
+        cogl_object_unref (dmabuf_fb);
99364f
+        return dmabuf_handle;
99364f
       }
99364f
       break;
99364f
 #ifdef HAVE_EGL_DEVICE
99364f
-- 
99364f
2.26.2
99364f