From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: hverkuil@xs4all.nl, mchehab@kernel.org, tfiga@chromium.org,
m.szyprowski@samsung.com, matt.ranostay@konsulko.com
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev, kernel@collabora.com,
Benjamin Gaignard <benjamin.gaignard@collabora.com>
Subject: [PATCH v2 16/36] videobuf2: Add min_reqbufs_allocation field to vb2_queue structure
Date: Mon, 4 Dec 2023 14:23:03 +0100 [thread overview]
Message-ID: <20231204132323.22811-17-benjamin.gaignard@collabora.com> (raw)
In-Reply-To: <20231204132323.22811-1-benjamin.gaignard@collabora.com>
Add 'min_reqbufs_allocation' field in vb2_queue structure so drivers
can specificy the minimum number of buffers to allocate when calling
VIDIOC_REQBUFS.
Later that will help to distinguish the minimum number of buffers
needed to start streaming versus the minimum allocation requirement.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/common/videobuf2/videobuf2-core.c | 1 +
include/media/videobuf2-core.h | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 8c1df829745b..c224d13b3105 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -866,6 +866,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
* Make sure the requested values and current defaults are sane.
*/
num_buffers = max_t(unsigned int, *count, q->min_buffers_needed);
+ num_buffers = max_t(unsigned int, num_buffers, q->min_reqbufs_allocation);
num_buffers = min_t(unsigned int, num_buffers, q->max_num_buffers);
memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
/*
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 5557d78b6f20..17cacd696ab4 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -550,6 +550,9 @@ struct vb2_buf_ops {
* @start_streaming can be called. Used when a DMA engine
* cannot be started unless at least this number of buffers
* have been queued into the driver.
+ * @min_reqbufs_allocation: the minimum number of buffers allocated when
+ * calling VIDIOC_REQBUFS. Used when drivers need a to
+ * specify a minimum buffers allocation before setup a queue.
*/
/*
* Private elements (won't appear at the uAPI book):
@@ -615,6 +618,7 @@ struct vb2_queue {
u32 timestamp_flags;
gfp_t gfp_flags;
u32 min_buffers_needed;
+ u32 min_reqbufs_allocation;
struct device *alloc_devs[VB2_MAX_PLANES];
--
2.39.2
next prev parent reply other threads:[~2023-12-04 13:24 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 13:22 [PATCH v2 00/36] Clean up min_buffers_needed misusages Benjamin Gaignard
2023-12-04 13:22 ` [PATCH v2 01/36] media: usb: cx231xx: Remove useless setting of min_buffers_needed Benjamin Gaignard
2023-12-04 13:22 ` [PATCH v2 02/36] media: chips-media: coda: " Benjamin Gaignard
2023-12-04 13:45 ` Philipp Zabel
2023-12-04 13:22 ` [PATCH v2 03/36] media: microchip: " Benjamin Gaignard
2023-12-04 14:03 ` Hans Verkuil
2023-12-04 14:25 ` Eugen Hristev
2023-12-04 13:22 ` [PATCH v2 04/36] media: amphion: " Benjamin Gaignard
2023-12-04 13:22 ` [PATCH v2 05/36] media: qcom: venus: " Benjamin Gaignard
2023-12-04 13:22 ` [PATCH v2 06/36] media: i2c: video-i2c: " Benjamin Gaignard
2023-12-04 13:22 ` [PATCH v2 07/36] media: dvb-core: " Benjamin Gaignard
2023-12-04 14:23 ` Hans Verkuil
2023-12-04 13:22 ` [PATCH v2 08/36] media: atmel: " Benjamin Gaignard
2023-12-04 14:24 ` Hans Verkuil
2023-12-04 13:22 ` [PATCH v2 09/36] media: ipu3: " Benjamin Gaignard
2023-12-04 13:22 ` [PATCH v2 10/36] media: ti: am437x: " Benjamin Gaignard
2023-12-04 14:29 ` Hans Verkuil
2023-12-04 13:22 ` [PATCH v2 11/36] media: ti: davinci: " Benjamin Gaignard
2023-12-04 14:30 ` Hans Verkuil
2023-12-04 13:22 ` [PATCH v2 12/36] input: touchscreen: atmel: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 13/36] media: ti: j721e-csi2rx: " Benjamin Gaignard
2023-12-04 14:31 ` Hans Verkuil
2023-12-04 13:23 ` [PATCH v2 14/36] media: ti: omap: " Benjamin Gaignard
2023-12-04 14:32 ` Hans Verkuil
2023-12-04 13:23 ` [PATCH v2 15/36] media: pci: intel: ipu3: " Benjamin Gaignard
2023-12-04 14:36 ` Hans Verkuil
2023-12-04 13:23 ` Benjamin Gaignard [this message]
2023-12-04 13:23 ` [PATCH v2 17/36] media: test-drivers: Fix misuse of min_buffers_needed field Benjamin Gaignard
2023-12-04 14:42 ` Hans Verkuil
2023-12-04 13:23 ` [PATCH v2 18/36] media: usb: dvb-usb: cxusb-analog: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 19/36] media: usb: gspca: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 20/36] media: atmel: " Benjamin Gaignard
2023-12-04 14:52 ` Hans Verkuil
2023-12-04 13:23 ` [PATCH v2 21/36] media: imx7-media-csi: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 22/36] media: nuvoton: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 23/36] media: sti: hva: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 24/36] media: rockchip: rkisp1: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 25/36] media: aspeed: " Benjamin Gaignard
2023-12-04 14:59 ` Hans Verkuil
2023-12-04 13:23 ` [PATCH v2 26/36] media: sun4i-csi: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 27/36] media: sunxi: sun8i-di: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 28/36] media: sun8i-rotate: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 29/36] media: sunxi: sun6i-csi: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 30/36] media: imx: " Benjamin Gaignard
2023-12-04 13:52 ` Philipp Zabel
2023-12-04 13:23 ` [PATCH v2 31/36] media: starfive: " Benjamin Gaignard
2023-12-04 15:07 ` Hans Verkuil
2023-12-04 13:23 ` [PATCH v2 32/36] media: tegra-video: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 33/36] media: ti: cal: " Benjamin Gaignard
2023-12-04 15:10 ` Hans Verkuil
2023-12-04 13:23 ` [PATCH v2 34/36] media: saa7146: " Benjamin Gaignard
2023-12-04 13:23 ` [PATCH v2 35/36] input: touchscreen: sur40: " Benjamin Gaignard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231204132323.22811-17-benjamin.gaignard@collabora.com \
--to=benjamin.gaignard@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=m.szyprowski@samsung.com \
--cc=matt.ranostay@konsulko.com \
--cc=mchehab@kernel.org \
--cc=tfiga@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox