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

45 lines
1.7 KiB
Diff
Raw Permalink Normal View History

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