Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp525688rdb; Fri, 26 Jan 2024 03:04:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFY4kiVAqFllt37cDEzNjhgMhw4bFoI54VMnDghUFHPl0mXFYqmMzTf79yIDvz2IRw1tYYl X-Received: by 2002:a17:90a:f48f:b0:293:ad7a:c29f with SMTP id bx15-20020a17090af48f00b00293ad7ac29fmr739244pjb.97.1706267047073; Fri, 26 Jan 2024 03:04:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706267047; cv=pass; d=google.com; s=arc-20160816; b=eFFlK+QSgGUoYV0g7o6U4xLdVnitEJICH05j+oCq2Zmg9gFdUhCEOqWcA8SQpOxUab BkRWwJ0jQOILBh8BIUc8qsTKGLpCbPgqha/S5sI2snKQpla2LOLYUuBHemCTkT8refue /zJEsK8pDqlk8LkjBj3LsFsFFQQukL5v9V8cqJjhUdDp3uKs0iqHzvYnhyoHYXJyanQn tu3qLQ3lM/MGhd9RYD2UXr53hks+CIVP2kCRSIlYOmfbXbW6uivxJQxUOjShHpw4EPtq xOXawFLNIsKyvAxkaK4ew9BRMrHHsb6aPwbbpUkUqe/l6ZeEI4SwHa6Pk9L9oN1LH1iH fFmQ== 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=TATj1KrXlB9C5yoTQlmFxwMDua9T7aOLd+ef3TFzmtc=; fh=kJFWdpgao/cSBC9hXz8xDSwlGqQgdrU0x08uvgLC+qU=; b=v1g4lhjLW+u5OkstGmgV1gyEsW7LIytLPv3caU2yhizkstXQIg64Az1Udl9Wgl/O+U 1uTGEVvKtOxJnBJk+kyr88IEE2wgLuoDGwl7Do6RXd3jdEPQSdxQH9l9utTLoKdWpM2U iI1XNDd3DStPJWHcpo+K97rdDA2ZhCj0uoor8+6TaJISwa3qJWMjz8suiFVszMvGykfj 0oU0d2qS+UL+mIZM/r2BSuuT/VYh7qU6gUGbiq9h5Q3D50086YiGE4JMK26k+oAQBXzM 2yqAIZU7LJ827vCDX/KqiVv8hCPbB+xxhypAckZRkfggBl+8FBq16gikaDFl6lnOd7Ty nfLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Qun8xc4R; 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-40024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40024-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y1-20020a17090a104100b00290f824240fsi1008571pjd.80.2024.01.26.03.04.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 03:04:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Qun8xc4R; 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-40024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40024-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9361628DFA7 for ; Fri, 26 Jan 2024 11:03:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B86291BC32; Fri, 26 Jan 2024 11:01:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Qun8xc4R" 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 CC5C318E3A; Fri, 26 Jan 2024 11:01:52 +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=1706266914; cv=none; b=OFgWUHRJln5bfAOIFSBFx25n68oK31fwHkiR2JKhozu3VDSkB2Q/z72xiTkAIjqXVxlDGY7VyFbDMr3pyItP1WwlB+KEMNi5Fan0LPLnIHq9qNWjxn7p7RFlPE7NUmsXiSZxRDL9mI8TuMolkRV+X2oudSfNgnhHmluP7VeBa6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706266914; c=relaxed/simple; bh=Me0lX22ty881gD1hrvsq2lFM4h0noweFm9BxBaYyWZU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NyjS9w0e5pjkjnsuA7BmhfEZUfJ7NjdjklBIlRhE85dyhkm152F4WMxQCRJ1Dm3ep/u2p+6KfWwcukydQxRtMToWXMbE35D74WPh8LlXL28PQ41tZr5neDinUtSIDndDUG2sd3XNm/rGpyLSWE548DEeyyZ3UFstYgFTaQPCdKs= 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=Qun8xc4R; 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=1706266911; bh=Me0lX22ty881gD1hrvsq2lFM4h0noweFm9BxBaYyWZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qun8xc4RimRZsQknDydLw0IR+GhwixiaQtnevmSM0uO5wN3SDvaylebJlOFmKIjyy vxq/VxCQy5RxmqUsHeloxDUTs4yCyVZrxqKGcpwnRFusE2ZvT+AXCJHrq35Pk56FeF A1kbJF5byiraFNAtGgBBezYnN7/PIHGAzAfl7+Q0JeskZ/1O8INRiTKGSjKwvBwDm1 2FOGSnAz/OZaYlbKQ3RuE83dUZLwS+VsFic2nUrmwD2bcITYt6sR+za6kidPush0M1 D85xEuyJ+I9C08ZXnM6Vo2O8U6xs8elTBalVDptflXABO3J2tE1t6R1oS9/vhfSsrd fq24lZHrS/Y7Q== 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 C1B303782075; Fri, 26 Jan 2024 11:01:50 +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 v18 8/9] media: v4l2: Add mem2mem helpers for DELETE_BUFS ioctl Date: Fri, 26 Jan 2024 12:01:40 +0100 Message-Id: <20240126110141.135896-9-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240126110141.135896-1-benjamin.gaignard@collabora.com> References: <20240126110141.135896-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 Content-Transfer-Encoding: 8bit Create v4l2-mem2mem helpers for VIDIOC_DELETE_BUFS ioctl and make test drivers use it. Signed-off-by: Benjamin Gaignard --- version 18: - Direclty use vb2_core_delete_bufs() in v4l2_m2m_ioctl_delete_bufs(). Remove useless static functions. 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, -- 2.40.1