mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
kmssink: Do not close the DRM prime handle twice
The prime_fds for multi planes may be the same. For example, on Intel's platform, the NV12 surface may have the same FD for the plane0 and the plane1. Then, the DRM_IOCTL_GEM_CLOSE will close the same handle twice and get an "Invalid argument 22" error the second time. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6914>
This commit is contained in:
parent
e913b4870a
commit
ea0dce26e0
1 changed files with 9 additions and 1 deletions
|
@ -427,7 +427,7 @@ gst_kms_allocator_dmabuf_import (GstAllocator * allocator, gint * prime_fds,
|
|||
GstKMSAllocator *alloc;
|
||||
GstKMSMemory *kmsmem;
|
||||
GstMemory *mem;
|
||||
gint i, ret;
|
||||
gint i, j, ret;
|
||||
guint32 gem_handle[4] = { 0, };
|
||||
|
||||
g_return_val_if_fail (n_planes <= GST_VIDEO_MAX_PLANES, FALSE);
|
||||
|
@ -456,6 +456,14 @@ done:
|
|||
if (!gem_handle[i])
|
||||
continue;
|
||||
|
||||
/* Do not close the same handle twice. */
|
||||
for (j = 0; j < i; j++) {
|
||||
if (gem_handle[j] == gem_handle[i])
|
||||
break;
|
||||
}
|
||||
if (j < i)
|
||||
continue;
|
||||
|
||||
err = drmIoctl (alloc->priv->fd, DRM_IOCTL_GEM_CLOSE, &arg);
|
||||
if (err)
|
||||
GST_WARNING_OBJECT (allocator,
|
||||
|
|
Loading…
Reference in a new issue