summaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>2024-03-14 16:32:21 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2024-03-25 12:00:44 +0100
commit6e423b75d0492e82fa6f057c615427ebd7ebe76c (patch)
tree87c3045393a3565f10c94355897103b1cf04b454 /include/media
parentf5131d5ce49ef942a3bda5f4a0f6228b1ea40eee (diff)
downloadlinux-6e423b75d0492e82fa6f057c615427ebd7ebe76c.tar.gz
linux-6e423b75d0492e82fa6f057c615427ebd7ebe76c.tar.bz2
linux-6e423b75d0492e82fa6f057c615427ebd7ebe76c.zip
media: core: Rework how create_buf index returned value is computed
When REMOVE_BUFS will be introduced holes could created in bufs array. To be able to reuse these unused indices reworking how create->index is set is mandatory. Let __vb2_queue_alloc() decide which first index is correct and forward this to the caller. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/videobuf2-core.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 4a8b9135cec8..42526e289c8e 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -826,6 +826,8 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
* @count: requested buffer count.
* @requested_planes: number of planes requested.
* @requested_sizes: array with the size of the planes.
+ * @first_index: index of the first created buffer, all allocated buffers have
+ * indices in the range [first_index..first_index+count-1]
*
* Videobuf2 core helper to implement VIDIOC_CREATE_BUFS() operation. It is
* called internally by VB2 by an API-specific handler, like
@@ -842,7 +844,8 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
unsigned int flags, unsigned int *count,
unsigned int requested_planes,
- const unsigned int requested_sizes[]);
+ const unsigned int requested_sizes[],
+ unsigned int *first_index);
/**
* vb2_core_prepare_buf() - Pass ownership of a buffer from userspace