Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp38438lqb; Thu, 14 Mar 2024 05:04:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV43+Uv2kVaXx9Mdox6E+DagVrVCVe3AlV8XxnSq9yw5K2DQLk6k0oZHoMlTQsHE5umd1myacJhN5JSQge0dMQGOQCk8QGMs6qXzhZPZg== X-Google-Smtp-Source: AGHT+IGU+kxcAs/9ERei5rURr8cAVHpAN9iSPsms3eBHI8nG2YtvSw8TBkC75/nuSk0jhPEjf502 X-Received: by 2002:a0c:eb06:0:b0:690:ba6e:f0b5 with SMTP id j6-20020a0ceb06000000b00690ba6ef0b5mr1644705qvp.28.1710417890123; Thu, 14 Mar 2024 05:04:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710417890; cv=pass; d=google.com; s=arc-20160816; b=iaf7YvNS+A4uYHrmwGyaaacTU2zaXN140hUUph9YRkbxWTX0qI5lB3LcArjp7PUXo3 Q7df2lQLzKUhNlU6eMDsJ1A2GLqzZ/9AYQ8dKu5PGMoMGfSu5gtE6n1xZOZ6LUpmP80F NcEZZuKkqdJH2RQxn4jdh+vhZT3gZwvgIhigt7zcm75CjFL19ryrLP1fFNuTabcK3EXh +OfmiYzhaaaYmKnxxPp8GNmJRgEAc0p2X/5mPq9aGY62o+ej+bqLi1Ua4whsFGHno2c0 Uuby77CAqxmu+u0NazNvN3gECqmcOX1ZrRNKVU6JTZKncloSQHnFi8SWWeb6uPi90XT5 aMdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=eVMwdfOh47oReczqTHBPYcMjg99cZobOt0HelGbmGnk=; fh=Iw2X+XCBF3bEFkcduZ02pbj7SLQsAyRqiwYsV/hjARQ=; b=tOjqMHG+1US6MVAqC8dFJ4lAO1BrxVhd2UyahHaHsv3kuH3Ene4V8rFwalGmaFmRnU b8CBVpCJuEEwlTegKAMGaW1/W+SEuurRBvt59TvtFDRoSdtjE/oOVYovPlptmKasIL8R v+5OC63qlPj4kIr/KEanskz0+Nhpb8LaehykXZETJ6QO8+U956buagKYUwsf82Ksvf2k 1eCh/sE2vpwmIkswyAsz0aWTV5xAtaJ5WglQQWBm0wcAHQOpJiE+lX2q0RsVPQ55AfGZ lclqQ1ABHM38N6UHBjiGhmG05qFA50vElLYMKxHy3PPzEqCuKa3pM3l+OHzmwGmDIfmM cXQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-103214-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gw6-20020a0562140f0600b0068efa58259bsi511859qvb.157.2024.03.14.05.04.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 05:04:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103214-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-103214-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl 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 9140F1C20B3E for ; Thu, 14 Mar 2024 12:04:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95F466F507; Thu, 14 Mar 2024 12:04:40 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 056C26F074; Thu, 14 Mar 2024 12:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710417880; cv=none; b=nrgdKpdfDqJZLPtTPNWPBako4ngM4Dv3bD8eS7jYnQobPYZaVvDLCfaMntd35AOMPjE+QQfJaS/90xXWdjci12EfgckFZQSZVBQP3yyqZakr5PHDTtJVm8JsL+9GcHoFmtcv3em+kg0/4WoTujQYWdvd3Y8ljIyP+IYvk8CdEyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710417880; c=relaxed/simple; bh=cONaQ7d7Q2GLBQPyhquHIdTOVLFCZyNi9PQTrGVS8Gs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JOIatDrPncCp19r6c+7Uv0g5rrGMJ8bSKduknmkgI78ORC6ImOqEEsi1uuWZoQ9d7a8+bMFCGYa1ZAduzDZr6tZfGpVjhvEB976/tDhgim1QBsEjAmJM+OltRyiwEpI2TtmOioxRV/5jRq6msxtArbPi9PiVsXLSuEDUupSa/4Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 331BEC43390; Thu, 14 Mar 2024 12:04:37 +0000 (UTC) Message-ID: Date: Thu, 14 Mar 2024 13:04:35 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v20 8/9] media: v4l2: Add mem2mem helpers for REMOVE_BUFS ioctl Content-Language: en-US, nl To: Benjamin Gaignard , mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, nicolas@ndufresne.ca Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, kernel@collabora.com References: <20240221155435.100093-1-benjamin.gaignard@collabora.com> <20240221155435.100093-9-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20240221155435.100093-9-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 21/02/2024 4:54 pm, Benjamin Gaignard wrote: > 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; > + Check if remove->type matches the type of the vb2_queue and return -EINVAL if it isn't. Regards, Hans > + 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, Regards, Hans