media: core: Add bitmap manage bufs array entries
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Thu, 14 Mar 2024 15:32:22 +0000 (16:32 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 25 Mar 2024 11:00:44 +0000 (12:00 +0100)
commita286b0837e1390c558aabebc4f10b25b1f05bdce
tree59b319c91e67814ead79c1b78e6ce6a11769729d
parent6e423b75d0492e82fa6f057c615427ebd7ebe76c
media: core: Add bitmap manage bufs array entries

Add a bitmap field to know which of bufs array entries are
used or not.
Remove no more used num_buffers field from queue structure.
Use bitmap_find_next_zero_area() to find the first possible
range when creating new buffers to fill the gaps.
If no suitable range is found try to allocate less buffers
than requested.

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>
drivers/media/common/videobuf2/videobuf2-core.c
include/media/videobuf2-core.h