diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2017-07-06 17:20:56 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2017-07-07 15:49:24 -0400 |
commit | e1c02e097d671c454e5e3afdad3c96b1eedebaf5 (patch) | |
tree | dff91143b101047597084b55bff7875610ff8c5e | |
parent | 8f7ce6bc6aa0730935f78dba2c21d0d0ee79f18f (diff) | |
download | gstreamer-plugins-bad-e1c02e097d671c454e5e3afdad3c96b1eedebaf5.tar.gz |
kmssink: Don't leak GEM primed from DMABuf
This otherwise breaks DMABuf reclaiming. This is not visible from
userspace, but inside the kernel, the DRM driver will hold a ref to the
DMABuf object. With a V4L2 driver allocating those DMABuf, it then
prevent changing the resolution and re-allocation new buffers.
https://bugzilla.gnome.org/show_bug.cgi?id=782774
-rw-r--r-- | sys/kms/gstkmsallocator.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c index 687ebf992..648ac2f74 100644 --- a/sys/kms/gstkmsallocator.c +++ b/sys/kms/gstkmsallocator.c @@ -478,6 +478,18 @@ gst_kms_allocator_dmabuf_import (GstAllocator * allocator, gint * prime_fds, if (!gst_kms_allocator_add_fb (alloc, tmp, offsets, vinfo)) goto failed; + for (i = 0; i < n_planes; i++) { + struct drm_gem_close arg = { tmp->gem_handle[i], }; + gint err; + + err = drmIoctl (alloc->priv->fd, DRM_IOCTL_GEM_CLOSE, &arg); + if (err) + GST_WARNING_OBJECT (allocator, + "Failed to close GEM handle: %s %d", strerror (errno), errno); + + tmp->gem_handle[i] = 0; + } + return tmp; /* ERRORS */ |