v4l2bufferpool: request the maximum number of buffers for DMABUF

There are often only two buffers queued in the kernel so no new buffers are
requested.

With every qbuf, the kernel receives a new DMABUF for the specified index.
This most likely differs from the last DMABUF and the old cached entry is
released. This results in a lot of map/unmap overhead if the kernel driver
needs a mapping for the buffer.

With a larger queue, it's quite likely, that both old and new DMABUFs are
also mapped for another index. So the map/unmap is skipped, because the
mapping is reference counted.

The corresponding allocated buffers don't contain any actual memory, so
allocating them is quite cheep. So the log message is updated to clarify
this.
This commit is contained in:
Michael Olbrich 2019-11-20 15:32:29 +01:00 committed by GStreamer Merge Bot
parent 00539e1277
commit 94e323c10f

View file

@ -841,9 +841,9 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
can_allocate = GST_V4L2_ALLOCATOR_CAN_ALLOCATE (pool->vallocator, DMABUF);
GST_DEBUG_OBJECT (pool, "requesting %d DMABUF buffers", min_buffers);
GST_DEBUG_OBJECT (pool, "requesting %d DMABUF import slots", max_buffers);
count = gst_v4l2_allocator_start (pool->vallocator, min_buffers,
count = gst_v4l2_allocator_start (pool->vallocator, max_buffers,
V4L2_MEMORY_DMABUF);
/* There is no rational to not get what we asked */