Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2445776rdb; Wed, 21 Feb 2024 07:57:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQI/2x7bTxwilmG1dikH6yzloOrwFh/HZ0Fyo+5NreWvqhuaCzUFRBSBng+ESDjlnegU/yqr+zQK0/1ELOO5VPCgXgqcfMbW+RwxEHVw== X-Google-Smtp-Source: AGHT+IHK73ELK/15vc+s8pdy69mKUv2cPRqkIDpeuxMC/DEYJWUvKBzz7UcLyGZhn3D+6AmkjBjE X-Received: by 2002:a05:6e02:1d97:b0:365:3a69:1e1a with SMTP id h23-20020a056e021d9700b003653a691e1amr7419201ila.0.1708531039983; Wed, 21 Feb 2024 07:57:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708531039; cv=pass; d=google.com; s=arc-20160816; b=roMIjUhGBY3w47EKGPU9b1+ZSQu9/cI3YTNZxuXVi8qy54Uuv8lpvF1QpjN6ljlUNc fK3nficWSvuu7NtpnCaEzAhdKlmYaCtCFWoCcCx4aIaJSex8VgY6O3ShsOyau4cKii3A a+VVmXry2EJiy8IHrOX1Xk9S4ob0dmsjvNqDOiRYyFqZWRSdq35B/HYOggnfOD0aB9Xe hBCbAVRNBi+pHY4VVecorFDUGVVO520MXdczb43OU6BX7vrcM92lN5j8HK99KoLsvVhF PGQNXEMMbeW5b+EqD4bU3RBCdm+wFCoifS5phGTgXz2f7/eb0gwneKj6eB5Taq1dETwG poEg== 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=gEEAVEi3C+Peb2G93hhIM5JvxNnYvZs0wOTi5m0mZ9I=; fh=zOBpKhMTeRbrgfYir35sIvSkMQrxOs+orb+lNlEOd4k=; b=QtDT1Afp+xLvElgf3LV1QHFZXRNLvJNTrxpT4eVrfvXU3D46U8gPhGKwVcUE4Xu5Qb kNisdb86Sxnp8gzLkiRUFASsBMgUakiz6JjPp7ClP9C5Fowe/2CbtvMopCJOOveLF31W FpmjL+nyeAIEKVOKM39jIQVl3VG3XxE8BlN09wyCpXQEtwiXkOp5puhPRFTdccugUL86 m3VHym7VfA2k2jKNGiEqscNoYhqrrs0oTJZ2zwpRjbZ33iD21xcITx2KS2qMRaUAjm6e rR4x351ElsFZZYCwfjFExJEDg3XxQCjdtthFjKGwsp4ZeFV/CRYzKCeHRmpTOdAb650a eDlg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=2e4mvyoO; 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-75047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75047-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 m22-20020a637d56000000b005c65d0dd9a0si8296654pgn.503.2024.02.21.07.57.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 07:57:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75047-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=2e4mvyoO; 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-75047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75047-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 7AB96283D95 for ; Wed, 21 Feb 2024 15:57:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DDE4E82D95; Wed, 21 Feb 2024 15:54:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="2e4mvyoO" 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 ED2C382870; Wed, 21 Feb 2024 15:54:49 +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=1708530891; cv=none; b=CpCCmnrpF9Eytqm4+6u4PEV6S50XoaTIexFJnwTglRfrzu8NWTptZCGFeYj5SJX5wThczJ5M6Ob6aOZ3ToCurJ6UGrsnmoSvbYP8Evl0yHFufzhOHGG55NKfL7zi3s9ttlokdrC+XXulzTp56cu3w2dUiv9TXfqPz+5WHyDL5kk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708530891; c=relaxed/simple; bh=xkha4D8zVSPTP3prmB5KEcjW0rkv3j+VZiNxrnoa80M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cvm04aHZWRPjV/0RfG+Rec5d7pIwhTUTBengVfjE8Ffgflb0/X51N/Uc2UP6CUjEVuCw9s/AXTiCgujU6Of02vPY7RPeE1Rn5wxUiwcjjVwSI4X3C6RD+ry+fYeqcnqYjFfttTEMIgwNfJNbtqEamrn6tkNIfyd3OunLHHv02lI= 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=2e4mvyoO; 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=1708530888; bh=xkha4D8zVSPTP3prmB5KEcjW0rkv3j+VZiNxrnoa80M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2e4mvyoOeIXC48yaN3hIVxFb884yiG49Qk9Gl+RPrOQ5EA8QawrdcgDXnS2vNWioy 8LlxDn/GCJLV9/vF/zQ0jlyYfP78zBGSfxUAYCRPeyovNnfEpsYo3odix458VBWaeq jqiREMJ1gkYb4z0qeY/wk9mJEeryy9qFiNESySWG2zbO5MEpD5Hu5IlGsoYRwzPo90 MVq0zvglbrn5fPmTHGgkRBfNwP9vQeHcC6Sg53wJZaKi7WekI8uRWNGrjvRFwXTjrc ZHxEZ+KfFkDrAwVE+qLKGeyww+K5pPrkmWCIQckPp1j+TFSpRr9a4j1pGF5SYe3Y4K LSEPlWVSs7FpA== 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 C78D937820D5; Wed, 21 Feb 2024 15:54:47 +0000 (UTC) From: Benjamin Gaignard To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, hverkuil-cisco@xs4all.nl, nicolas@ndufresne.ca Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v20 8/9] media: v4l2: Add mem2mem helpers for REMOVE_BUFS ioctl Date: Wed, 21 Feb 2024 16:54:34 +0100 Message-Id: <20240221155435.100093-9-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240221155435.100093-1-benjamin.gaignard@collabora.com> References: <20240221155435.100093-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_REMOVE_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..3e011fe62ae1 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_remove_bufs = v4l2_m2m_ioctl_remove_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..14aff4ad576b 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_remove_bufs = v4l2_m2m_ioctl_remove_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..ba7550b8ba7e 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_remove_bufs = vb2_ioctl_remove_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..f8d970319764 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_remove_bufs = v4l2_m2m_ioctl_remove_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..771392f67dda 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_remove_bufs = vb2_ioctl_remove_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 75517134a5e9..ba21c60f1ed3 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -1386,6 +1386,16 @@ int v4l2_m2m_ioctl_create_bufs(struct file *file, void *priv, } EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_create_bufs); +int v4l2_m2m_ioctl_remove_bufs(struct file *file, void *priv, + struct v4l2_remove_buffers *remove) +{ + struct v4l2_fh *fh = file->private_data; + + return vb2_core_remove_bufs(v4l2_m2m_get_vq(fh->m2m_ctx, remove->type), + remove->index, remove->count); +} +EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_remove_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..0af330cf91c3 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_remove_bufs(struct file *file, void *priv, + struct v4l2_remove_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