[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231109163512.179524-57-benjamin.gaignard@collabora.com>
Date: Thu, 9 Nov 2023 17:35:12 +0100
From: Benjamin Gaignard <benjamin.gaignard@...labora.com>
To: mchehab@...nel.org, tfiga@...omium.org, m.szyprowski@...sung.com,
ming.qian@....com, ezequiel@...guardiasur.com.ar,
p.zabel@...gutronix.de, gregkh@...uxfoundation.org,
hverkuil-cisco@...all.nl, nicolas.dufresne@...labora.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
linux-rockchip@...ts.infradead.org, linux-staging@...ts.linux.dev,
kernel@...labora.com,
Benjamin Gaignard <benjamin.gaignard@...labora.com>
Subject: [PATCH v15 56/56] media: test-drivers: Use helper for DELETE_BUFS ioctl
Allow test drivers to use DELETE_BUFS by adding vb2_ioctl_delete_bufs() helper.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...labora.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
Powered by blists - more mailing lists