Commit 7964f2db authored by Philipp Zabel's avatar Philipp Zabel Committed by Nicolas Dufresne

v4l2allocator: allow importing dmabufs with vertical padding

When importing single-planar dmabufs that have padded height, the memory size
may be larger than sizeimage of the importing V4L2 queue. This is not a
problem, the importer can just ignore the padding lines at the end.
parent 53705c77
Pipeline #24472 failed with stages
in 36 seconds
......@@ -1058,7 +1058,7 @@ gst_v4l2_allocator_import_dmabuf (GstV4l2Allocator * allocator,
for (i = 0; i < group->n_mem; i++) {
gint dmafd;
gsize size, offset, maxsize;
gsize size, offset, maxsize, bytesused;
if (!gst_is_dmabuf_memory (dma_mem[i]))
goto not_dmabuf;
......@@ -1078,9 +1078,13 @@ gst_v4l2_allocator_import_dmabuf (GstV4l2Allocator * allocator,
mem->mem.size = size;
mem->dmafd = dmafd;
/* V4L2 checks that bytesused is not larger than sizeimage */
bytesused = MIN (size + offset,
/* Update v4l2 structure */
group->planes[i].length = maxsize;
group->planes[i].bytesused = size + offset;
group->planes[i].bytesused = bytesused;
group->planes[i].m.fd = dmafd;
group->planes[i].data_offset = offset;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment