linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com,
	ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar,
	p.zabel@pengutronix.de, gregkh@linuxfoundation.org,
	hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-staging@lists.linux.dev, kernel@collabora.com,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>
Subject: [PATCH v13 56/56] media: test-drivers: Use helper for DELETE_BUFS ioctl
Date: Thu, 19 Oct 2023 14:52:22 +0200	[thread overview]
Message-ID: <20231019125222.21370-57-benjamin.gaignard@collabora.com> (raw)
In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com>

Allow test drivers to use DELETE_BUFS by adding vb2_ioctl_delete_bufs() helper.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
 drivers/media/test-drivers/vicodec/vicodec-core.c |  2 ++
 drivers/media/test-drivers/vimc/vimc-capture.c    |  2 ++
 drivers/media/test-drivers/visl/visl-video.c      |  2 ++
 drivers/media/test-drivers/vivid/vivid-core.c     | 13 ++++++++++---
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
index 69cbe2c094e1..f14a8fd506d0 100644
--- a/drivers/media/test-drivers/vicodec/vicodec-core.c
+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
@@ -1339,6 +1339,7 @@ static const struct v4l2_ioctl_ops vicodec_ioctl_ops = {
 	.vidioc_prepare_buf	= v4l2_m2m_ioctl_prepare_buf,
 	.vidioc_create_bufs	= v4l2_m2m_ioctl_create_bufs,
 	.vidioc_expbuf		= v4l2_m2m_ioctl_expbuf,
+	.vidioc_delete_bufs	= v4l2_m2m_ioctl_delete_bufs,
 
 	.vidioc_streamon	= v4l2_m2m_ioctl_streamon,
 	.vidioc_streamoff	= v4l2_m2m_ioctl_streamoff,
@@ -1725,6 +1726,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	dst_vq->mem_ops = &vb2_vmalloc_memops;
 	dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	dst_vq->lock = src_vq->lock;
+	dst_vq->supports_delete_bufs = true;
 
 	return vb2_queue_init(dst_vq);
 }
diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c
index aa944270e716..fda7ea3a6cb6 100644
--- a/drivers/media/test-drivers/vimc/vimc-capture.c
+++ b/drivers/media/test-drivers/vimc/vimc-capture.c
@@ -221,6 +221,7 @@ static const struct v4l2_ioctl_ops vimc_capture_ioctl_ops = {
 	.vidioc_expbuf = vb2_ioctl_expbuf,
 	.vidioc_streamon = vb2_ioctl_streamon,
 	.vidioc_streamoff = vb2_ioctl_streamoff,
+	.vidioc_delete_bufs = vb2_ioctl_delete_bufs,
 };
 
 static void vimc_capture_return_all_buffers(struct vimc_capture_device *vcapture,
@@ -435,6 +436,7 @@ static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc,
 	q->min_buffers_needed = 2;
 	q->lock = &vcapture->lock;
 	q->dev = v4l2_dev->dev;
+	q->supports_delete_bufs = true;
 
 	ret = vb2_queue_init(q);
 	if (ret) {
diff --git a/drivers/media/test-drivers/visl/visl-video.c b/drivers/media/test-drivers/visl/visl-video.c
index 7cac6a6456eb..bd6c112f7846 100644
--- a/drivers/media/test-drivers/visl/visl-video.c
+++ b/drivers/media/test-drivers/visl/visl-video.c
@@ -521,6 +521,7 @@ const struct v4l2_ioctl_ops visl_ioctl_ops = {
 	.vidioc_prepare_buf		= v4l2_m2m_ioctl_prepare_buf,
 	.vidioc_create_bufs		= v4l2_m2m_ioctl_create_bufs,
 	.vidioc_expbuf			= v4l2_m2m_ioctl_expbuf,
+	.vidioc_delete_bufs		= v4l2_m2m_ioctl_delete_bufs,
 
 	.vidioc_streamon		= v4l2_m2m_ioctl_streamon,
 	.vidioc_streamoff		= v4l2_m2m_ioctl_streamoff,
@@ -728,6 +729,7 @@ int visl_queue_init(void *priv, struct vb2_queue *src_vq,
 	dst_vq->mem_ops = &vb2_vmalloc_memops;
 	dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	dst_vq->lock = &ctx->vb_mutex;
+	dst_vq->supports_delete_bufs = true;
 
 	return vb2_queue_init(dst_vq);
 }
diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index 353f035fcd19..06b18d8e2248 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -769,6 +769,7 @@ static const struct v4l2_ioctl_ops vivid_ioctl_ops = {
 	.vidioc_expbuf			= vb2_ioctl_expbuf,
 	.vidioc_streamon		= vb2_ioctl_streamon,
 	.vidioc_streamoff		= vb2_ioctl_streamoff,
+	.vidioc_delete_bufs		= vb2_ioctl_delete_bufs,
 
 	.vidioc_enum_input		= vivid_enum_input,
 	.vidioc_g_input			= vivid_g_input,
@@ -883,12 +884,18 @@ static int vivid_create_queue(struct vivid_dev *dev,
 	 * PAGE_SHIFT > 12, but then max_num_buffers will be clamped by
 	 * videobuf2-core.c to MAX_BUFFER_INDEX.
 	 */
-	if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+	if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 		q->max_num_buffers = 64;
-	if (buf_type == V4L2_BUF_TYPE_SDR_CAPTURE)
+		q->supports_delete_bufs = true;
+	}
+	if (buf_type == V4L2_BUF_TYPE_SDR_CAPTURE) {
 		q->max_num_buffers = 1024;
-	if (buf_type == V4L2_BUF_TYPE_VBI_CAPTURE)
+		q->supports_delete_bufs = true;
+	}
+	if (buf_type == V4L2_BUF_TYPE_VBI_CAPTURE) {
 		q->max_num_buffers = 32768;
+		q->supports_delete_bufs = true;
+	}
 
 	if (allocators[dev->inst] != 1)
 		q->io_modes |= VB2_USERPTR;
-- 
2.39.2


  parent reply	other threads:[~2023-10-19 12:55 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 12:51 [PATCH v13 00/56] Add DELETE_BUF ioctl Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 01/56] media: videobuf2: Rename offset parameter Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 02/56] media: videobuf2: Rework offset 'cookie' encoding pattern Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 03/56] media: videobuf2: Stop spamming kernel log with all queue counter Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 04/56] media: videobuf2: Use vb2_buffer instead of index Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 05/56] media: videobuf2: Access vb2_queue bufs array through helper functions Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 06/56] media: videobuf2: Remove duplicated index vs q->num_buffers check Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 07/56] media: videobuf2: Add helper to get queue number of buffers Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 08/56] media: videobuf2: Use vb2_get_num_buffers() helper Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 09/56] media: amphion: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 10/56] media: amphion: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 11/56] media: mediatek: jpeg: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 12/56] media: mediatek: vdec: Remove useless loop Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 13/56] media: mediatek: vcodec: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 14/56] media: sti: hva: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 15/56] media: visl: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 16/56] media: atomisp: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 17/56] media: atomisp: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 18/56] media: dvb-core: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 19/56] media: dvb-core: Do not initialize twice queue num_buffer field Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 20/56] media: dvb-frontends: rtl2832: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 21/56] media: pci: dt3155: Remove useless check Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 22/56] media: pci: tw686x: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 23/56] media: pci: cx18: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 24/56] media: pci: netup_unidvb: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 25/56] media: pci: tw68: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 26/56] media: i2c: video-i2c: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 27/56] media: coda: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 28/56] media: nxp: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 29/56] media: verisilicon: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 30/56] media: test-drivers: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 31/56] media: imx: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 32/56] media: meson: vdec: " Benjamin Gaignard
2023-10-19 12:51 ` [PATCH v13 33/56] touchscreen: sur40: " Benjamin Gaignard
2023-10-29  2:29   ` Dmitry Torokhov
2023-10-19 12:52 ` [PATCH v13 34/56] sample: v4l: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 35/56] media: cedrus: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 36/56] media: nuvoton: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 37/56] media: renesas: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 38/56] media: ti: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 39/56] media: usb: airspy: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 40/56] media: usb: cx231xx: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 41/56] media: usb: hackrf: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 42/56] media: usb: usbtv: " Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 43/56] media: videobuf2: Be more flexible on the number of queue stored buffers Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 44/56] media: core: Report the maximum possible number of buffers for the queue Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 45/56] media: test-drivers: vivid: Increase max supported buffers for capture queues Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 46/56] media: test-drivers: vicodec: Increase max supported capture queue buffers Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 47/56] media: verisilicon: Refactor postprocessor to store more buffers Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 48/56] media: verisilicon: Store chroma and motion vectors offset Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 49/56] media: verisilicon: g2: Use common helpers to compute chroma and mv offsets Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 50/56] media: verisilicon: vp9: Allow to change resolution while streaming Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 51/56] media: core: Rework how create_buf index returned value is computed Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 52/56] media: core: Add bitmap manage bufs array entries Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 53/56] media: core: Free range of buffers Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 54/56] media: v4l2: Add DELETE_BUFS ioctl Benjamin Gaignard
2023-10-19 12:52 ` [PATCH v13 55/56] media: v4l2: Add mem2mem helpers for " Benjamin Gaignard
2023-10-19 12:52 ` Benjamin Gaignard [this message]
2023-10-25 12:17 ` [PATCH v13 00/56] Add DELETE_BUF ioctl Hans Verkuil
2023-10-31  9:04 ` Hans Verkuil
2023-10-31 16:37   ` 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=20231019125222.21370-57-benjamin.gaignard@collabora.com \
    --to=benjamin.gaignard@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).