From nobody Wed Nov 13 03:01:57 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A00E0E784AD for ; Mon, 2 Oct 2023 12:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237473AbjJBMJN (ORCPT ); Mon, 2 Oct 2023 08:09:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237246AbjJBMH1 (ORCPT ); Mon, 2 Oct 2023 08:07:27 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A269CD5; Mon, 2 Oct 2023 05:06:54 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:9537:67ca:c85e:d0ae]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id CA6A466072FF; Mon, 2 Oct 2023 13:06:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248413; bh=od83LmKhAhKbqGYrw7/WB9PaXmjqloXPSjvbzmBGKQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MwEu2RDaqNdzfCpe2lEPxAGZL1HvbPYCium4whDwOPYV6g6O+CUJ29sIdq5Nl7rKm bxIqY6eMPgTa+uKAlkJL2MwMvM+5+kf5QlRQDkcGcpD+QClZW6BdYx2FwMJ755h7p0 OYU2CJFTMtbc/wY6xLQw2QylvrSFFyt8Cd0wBxktbtc+UWE38rposle96GzcRNOycD Hp7N4cUuPLtomDdz4K3yKhp2+z8z/V16FxeEDNoyOX3RI86W8T55OKo4bY4VxKUFEh C9ite1KQkos4uB7Pf4ERm96oeNBIW1SC/6halIdiieBPN+VfznxZV7OoZ1sQzZbPnX P4HTV3kzRUl7g== From: Benjamin Gaignard 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 Subject: [PATCH v9 53/53] media: test-drivers: Use helper for DELETE_BUFS ioctl Date: Mon, 2 Oct 2023 14:06:17 +0200 Message-Id: <20231002120617.119602-54-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002120617.119602-1-benjamin.gaignard@collabora.com> References: <20231002120617.119602-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Allow test drivers to use DELETE_BUFS by adding vb2_ioctl_delete_bufs() hel= per. Signed-off-by: Benjamin Gaignard --- 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/me= dia/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 = =3D { .vidioc_prepare_buf =3D v4l2_m2m_ioctl_prepare_buf, .vidioc_create_bufs =3D v4l2_m2m_ioctl_create_bufs, .vidioc_expbuf =3D v4l2_m2m_ioctl_expbuf, + .vidioc_delete_bufs =3D v4l2_m2m_ioctl_delete_bufs, =20 .vidioc_streamon =3D v4l2_m2m_ioctl_streamon, .vidioc_streamoff =3D v4l2_m2m_ioctl_streamoff, @@ -1725,6 +1726,7 @@ static int queue_init(void *priv, struct vb2_queue *s= rc_vq, dst_vq->mem_ops =3D &vb2_vmalloc_memops; dst_vq->timestamp_flags =3D V4L2_BUF_FLAG_TIMESTAMP_COPY; dst_vq->lock =3D src_vq->lock; + dst_vq->supports_delete_bufs =3D true; =20 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_o= ps =3D { .vidioc_expbuf =3D vb2_ioctl_expbuf, .vidioc_streamon =3D vb2_ioctl_streamon, .vidioc_streamoff =3D vb2_ioctl_streamoff, + .vidioc_delete_bufs =3D vb2_ioctl_delete_bufs, }; =20 static void vimc_capture_return_all_buffers(struct vimc_capture_device *vc= apture, @@ -435,6 +436,7 @@ static struct vimc_ent_device *vimc_capture_add(struct = vimc_device *vimc, q->min_buffers_needed =3D 2; q->lock =3D &vcapture->lock; q->dev =3D v4l2_dev->dev; + q->supports_delete_bufs =3D true; =20 ret =3D vb2_queue_init(q); if (ret) { diff --git a/drivers/media/test-drivers/visl/visl-video.c b/drivers/media/t= est-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 =3D { .vidioc_prepare_buf =3D v4l2_m2m_ioctl_prepare_buf, .vidioc_create_bufs =3D v4l2_m2m_ioctl_create_bufs, .vidioc_expbuf =3D v4l2_m2m_ioctl_expbuf, + .vidioc_delete_bufs =3D v4l2_m2m_ioctl_delete_bufs, =20 .vidioc_streamon =3D v4l2_m2m_ioctl_streamon, .vidioc_streamoff =3D v4l2_m2m_ioctl_streamoff, @@ -728,6 +729,7 @@ int visl_queue_init(void *priv, struct vb2_queue *src_v= q, dst_vq->mem_ops =3D &vb2_vmalloc_memops; dst_vq->timestamp_flags =3D V4L2_BUF_FLAG_TIMESTAMP_COPY; dst_vq->lock =3D &ctx->vb_mutex; + dst_vq->supports_delete_bufs =3D true; =20 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 58a059140365..2ed8847ce86e 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 =3D { .vidioc_expbuf =3D vb2_ioctl_expbuf, .vidioc_streamon =3D vb2_ioctl_streamon, .vidioc_streamoff =3D vb2_ioctl_streamoff, + .vidioc_delete_bufs =3D vb2_ioctl_delete_bufs, =20 .vidioc_enum_input =3D vivid_enum_input, .vidioc_g_input =3D vivid_g_input, @@ -876,12 +877,18 @@ static int vivid_create_queue(struct vivid_dev *dev, q->type =3D buf_type; q->io_modes =3D VB2_MMAP | VB2_DMABUF; q->io_modes |=3D V4L2_TYPE_IS_OUTPUT(buf_type) ? VB2_WRITE : VB2_READ; - if (buf_type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (buf_type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { q->max_num_buffers =3D 64; - if (buf_type =3D=3D V4L2_BUF_TYPE_SDR_CAPTURE) + q->supports_delete_bufs =3D true; + } + if (buf_type =3D=3D V4L2_BUF_TYPE_SDR_CAPTURE) { q->max_num_buffers =3D 1024; - if (buf_type =3D=3D V4L2_BUF_TYPE_VBI_CAPTURE) + q->supports_delete_bufs =3D true; + } + if (buf_type =3D=3D V4L2_BUF_TYPE_VBI_CAPTURE) { q->max_num_buffers =3D 32768; + q->supports_delete_bufs =3D true; + } =20 if (allocators[dev->inst] !=3D 1) q->io_modes |=3D VB2_USERPTR; --=20 2.39.2