diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2021-04-08 14:53:52 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2021-04-08 15:22:49 -0400 |
commit | f992c521c382ee23e94148ad523bd5e7782f29a6 (patch) | |
tree | 6782da2108aa141657726b67b14a9e799251cd41 | |
parent | 07a0b6347208914f6b1ebf7e09bc54587dd6d49a (diff) | |
download | gstreamer-plugins-bad-f992c521c382ee23e94148ad523bd5e7782f29a6.tar.gz |
v4l2codecs: allocator: Keep dmabuf mapped
DMABuf allocator already implements DMABuf Sync, meaning that doing
mmap/munmap (unless the mode have changed) is not required. In fact, on
systems with IOMMU it makes the kernel redo the mmu table which is visible
in the CPU usage.
This change reduces CPU usage when decoding
bbb_sunflower_2160p_60fps_normal.mp4 on RK3399 SoC from over 30% to
around 15%.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2152>
-rw-r--r-- | sys/v4l2codecs/gstv4l2codecallocator.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/v4l2codecs/gstv4l2codecallocator.c b/sys/v4l2codecs/gstv4l2codecallocator.c index d18e8bb70..e2886989c 100644 --- a/sys/v4l2codecs/gstv4l2codecallocator.c +++ b/sys/v4l2codecs/gstv4l2codecallocator.c @@ -90,7 +90,8 @@ gst_v4l2_codec_buffer_new (GstAllocator * allocator, GstV4l2Decoder * decoder, buf->index = index; buf->num_mems = num_mems; for (i = 0; i < buf->num_mems; i++) { - GstMemory *mem = gst_dmabuf_allocator_alloc (allocator, fds[i], sizes[i]); + GstMemory *mem = gst_fd_allocator_alloc (allocator, fds[i], sizes[i], + GST_FD_MEMORY_FLAG_KEEP_MAPPED); gst_memory_resize (mem, offsets[i], sizes[i] - offsets[i]); GST_MINI_OBJECT (mem)->dispose = gst_v4l2_codec_allocator_release; |