From patchwork Tue Feb 6 08:02:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 197242 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1388318dyb; Tue, 6 Feb 2024 00:06:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHT7aB0G4W6KwI6EggegFJxE4OBG2/qbcrnu25SPhdCsT1ho764bpxJa3UyNC/NCLrMd8G0 X-Received: by 2002:a37:c243:0:b0:785:6fea:92f9 with SMTP id j3-20020a37c243000000b007856fea92f9mr2117107qkm.50.1707206760212; Tue, 06 Feb 2024 00:06:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707206760; cv=pass; d=google.com; s=arc-20160816; b=rBsD1JTr2YHrJG75AcPItwVs98tOWyafyPtHCZNxFQqo2qvIsRackK5JFq8Y77iQCq TUDfb1a98U2RI6/xzVY3gOu9warEh4/GWkdz5uFKE6QK/4g8LRaHcrF71XLxndR+Xm9W loIP9mTLRiSnpHTKkkR2dLwS5JtXdceInpyGF3X7HPWxfzz3rCjdkhOpgu4eM47Nq4km SmJ1FJNftLA1Szh7V//WDP4+CuprEOs86JyGHoAqS/Yub1f7OHgNmgfeABTp32BKNtXS yauOHDSQOv7FLWgCAKFe9aBM0SKs+KmvIU+QWI+xmrstXbfBsrWWmbtLzNfYRDrztF1t lPSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TGa5gSWTYAE4LSjW7TidjRIiyis2v3gkCyIk3gO8qHE=; fh=DDz5PBczCjwSfppDtf5Iwwu5ASrW7yiuDCpOsHGByps=; b=SH1QZ6yiaF59s8p7Tfd7OXGnytZELzgAXnm7Y71WNcbL3afvr+vXkkI/p7DW26jYNt 55coMMrAEiL4xMg7I3KxyeEGjFf37kK3y/CxBVf0H1GXTRt0pZ0aivG7xDlPP1NplTK+ jy0wk/IbSMRhn4gGo37+v0kFPcH+h37DhI/aB7EfPR8fzfstak1OvuPiB9+EBdhdHFBl zpi/16eZI6TAk+M6SnI+dHVCQ3X6WN+xySKN+33+VJKBnJuSrLQlxGLUf5bajRnBCLK7 EA1WATYooVZvK8n606fSfbJkBzfQNcHCbBn1XTti3Lm+tzrM2H0NYpixyjCVqFguSEfQ klHg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aTgTCdut; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-54463-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54463-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=1; AJvYcCUd4ceavEFq0LxUFhlua1YinmkadyuZcaKow+N/+KrIyJcNml7WfOL0sjjMY9/A3qwG8Myjt1RUujCm0qNihboUL7MQGQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a7-20020a05620a124700b00783c132204dsi1728918qkl.328.2024.02.06.00.06.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 00:06:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54463-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aTgTCdut; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-54463-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54463-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DF1621C2299D for ; Tue, 6 Feb 2024 08:05:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A55C12E1E7; Tue, 6 Feb 2024 08:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="aTgTCdut" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCD7C12BE94; Tue, 6 Feb 2024 08:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707206558; cv=none; b=tj8lPwz5FYFy/2ANYOTkmGDH+Jzq2BDUqgD7p2mb7jCciCrV/uBvvWWVth4pYImJV2Wn5R5GgfpXNTvEx0Vk0xcyu1vspyOCtgrW76HxJbyr4/ZTxH6RaYl+3Q11X/nCM38K5ZrKVbnmyj446/DTTTjQf2JwdptsxME89XGjzK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707206558; c=relaxed/simple; bh=g77D8zO1tvvK6jlsUohRwg17Stiy+Yb2awskG4k7f58=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OFuBu4GJfDJhVwbe/fBpSAqq9keAJl9ktSFALUJ3I9sdm08+HcPJibOjRvVpVKlt08bSRP3X4HzYAXsOoObxFQw3RPkmCOmWkyfa2wDZob6ZcrD6tHP8xTPFjBLhJJNEWwFKZMsjUuKba7CbfXLzvcXFtopafUwSa9frdDPjrWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=aTgTCdut; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1707206550; bh=g77D8zO1tvvK6jlsUohRwg17Stiy+Yb2awskG4k7f58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aTgTCdutmtIfv1sIs+ebKRAamXn2cWiWoUVSKjmxhXdyrkxuDuov+uv6IFsC0jfpS I8Spgb9sprEFGVtrKQlwy5ho0L008QV1VadVSXpKCWfCJ0fErT/0P6o/2cIHEAbape myYFnM4G119aM4Ks0/PJ3gJKz4XUgt0HbUqhAzulfYaVV/3XgkS6GyXOuRDhHBTsyQ CTXPIBNtcP/BZA6gtUvXbXOeDR7xTlvod3m+XFoC/CwAjKxS0nc+V6syYJBFQA6EWI 9REBoRkUZe/r1nD9Hmq2foUfU3DiNCH4l2yiEEi3fskzm6Fhg8NaN7kI6wTkti0nym wuGf7yB3e/Rzg== Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (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 madrid.collaboradmins.com (Postfix) with ESMTPSA id A55093782085; Tue, 6 Feb 2024 08:02:29 +0000 (UTC) From: Benjamin Gaignard To: hverkuil@xs4all.nl, mchehab@kernel.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v19 8/9] media: v4l2: Add mem2mem helpers for DELETE_BUFS ioctl Date: Tue, 6 Feb 2024 09:02:18 +0100 Message-Id: <20240206080219.11951-9-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240206080219.11951-1-benjamin.gaignard@collabora.com> References: <20240206080219.11951-1-benjamin.gaignard@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790136035543911869 X-GMAIL-MSGID: 1790136035543911869 Create v4l2-mem2mem helpers for VIDIOC_DELETE_BUFS ioctl and make test drivers use it. Signed-off-by: Benjamin Gaignard --- drivers/media/test-drivers/vicodec/vicodec-core.c | 1 + drivers/media/test-drivers/vim2m.c | 1 + drivers/media/test-drivers/vimc/vimc-capture.c | 1 + drivers/media/test-drivers/visl/visl-video.c | 1 + drivers/media/test-drivers/vivid/vivid-core.c | 1 + drivers/media/v4l2-core/v4l2-mem2mem.c | 10 ++++++++++ include/media/v4l2-mem2mem.h | 2 ++ 7 files changed, 17 insertions(+) diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c index e13f5452b927..5a2d34ac12c2 100644 --- a/drivers/media/test-drivers/vicodec/vicodec-core.c +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c @@ -1345,6 +1345,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, diff --git a/drivers/media/test-drivers/vim2m.c b/drivers/media/test-drivers/vim2m.c index 3e3b424b4860..10bd8c92e340 100644 --- a/drivers/media/test-drivers/vim2m.c +++ b/drivers/media/test-drivers/vim2m.c @@ -960,6 +960,7 @@ static const struct v4l2_ioctl_ops vim2m_ioctl_ops = { .vidioc_dqbuf = v4l2_m2m_ioctl_dqbuf, .vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf, .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, + .vidioc_delete_bufs = v4l2_m2m_ioctl_delete_bufs, .vidioc_expbuf = v4l2_m2m_ioctl_expbuf, .vidioc_streamon = v4l2_m2m_ioctl_streamon, diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c index 97693561f1e4..adeb7727fade 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, diff --git a/drivers/media/test-drivers/visl/visl-video.c b/drivers/media/test-drivers/visl/visl-video.c index b9a4b44bd0ed..e8c4216e7526 100644 --- a/drivers/media/test-drivers/visl/visl-video.c +++ b/drivers/media/test-drivers/visl/visl-video.c @@ -539,6 +539,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, diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index 11b8520d9f57..f772069fb1a4 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, diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 9e983176542b..6e36a04d415c 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -1380,6 +1380,16 @@ int v4l2_m2m_ioctl_create_bufs(struct file *file, void *priv, } EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_create_bufs); +int v4l2_m2m_ioctl_delete_bufs(struct file *file, void *priv, + struct v4l2_delete_buffers *d) +{ + struct v4l2_fh *fh = file->private_data; + + return vb2_core_delete_bufs(v4l2_m2m_get_vq(fh->m2m_ctx, d->type), + d->index, d->count); +} +EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_delete_bufs); + int v4l2_m2m_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *buf) { diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 7f1af1f7f912..402bea36093b 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -867,6 +867,8 @@ int v4l2_m2m_ioctl_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *rb); int v4l2_m2m_ioctl_create_bufs(struct file *file, void *fh, struct v4l2_create_buffers *create); +int v4l2_m2m_ioctl_delete_bufs(struct file *file, void *priv, + struct v4l2_delete_buffers *d); int v4l2_m2m_ioctl_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf); int v4l2_m2m_ioctl_expbuf(struct file *file, void *fh,