Message ID | 20240825232449.25905-1-laurent.pinchart+renesas@ideasonboard.com (mailing list archive) |
---|---|
State | Accepted |
Headers |
Received: from am.mirrors.kernel.org ([147.75.80.249]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <linux-media+bounces-16739-patchwork=linuxtv.org@vger.kernel.org>) id 1siMba-0005tu-0l for patchwork@linuxtv.org; Sun, 25 Aug 2024 23:25:06 +0000 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0AF721F216BB for <patchwork@linuxtv.org>; Sun, 25 Aug 2024 23:25:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCEF07441F; Sun, 25 Aug 2024 23:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lQ/zF7gO" X-Original-To: linux-media@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 4858677F0B; Sun, 25 Aug 2024 23:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724628297; cv=none; b=RHXWDXR590dKTcuXSzp8vtKS4+3VGuBGF4MMmWoIIy6z9nEQrLKq4K72Fef/1GjSmSeF5QbUEvTDVyJR9fqfB5SDKHUFcMQ7X1/FDAXWycvZbiRNJjFsWHlE00brwH0wuuvyXSipPkSGhlL77ji7PsaCoFesLb9o36M4/rFvOxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724628297; c=relaxed/simple; bh=BtEmP7XCP89NdrFr0Te3lEv4YA76R/vK8gwWYECrkPE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Rt9U9cUJ/pYYz0cfxKkclnU6T5BMxHqUV1YB7bkH3OyYl6+zSkQalriKksoNEGljfBlVIy6bSyEHUol6y16skaynqmb9Ftscw/f2wxApsetg3Lyvx/3rmw0fXFQ1USG5go2e0DjsRxZ6zpz4jx351ZgFN0DsNetNgwEJ0sH+lVg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=lQ/zF7gO; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 86D063D5; Mon, 26 Aug 2024 01:23:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1724628227; bh=BtEmP7XCP89NdrFr0Te3lEv4YA76R/vK8gwWYECrkPE=; h=From:To:Cc:Subject:Date:From; b=lQ/zF7gO5gAVWyVZibqH9wlvKPUGEabxFYCn6oOoWOxm4cDXglQTfwF2fr0elx56J LCWBV+r/91cDXtX/m9OhB73vymiFYYOUrz+VipKoU8rbQf+VfFdvAax6z3YDqmIVpT bL9zvY1iWehTKnQxt+zaej2VX39xNnMRZOoCxB+U= From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> To: linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Tomasz Figa <tfiga@chromium.org>, Marek Szyprowski <m.szyprowski@samsung.com>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Benjamin Gaignard <benjamin.gaignard@collabora.com>, stable@vger.kernel.org Subject: [PATCH] media: videobuf2: Drop minimum allocation requirement of 2 buffers Date: Mon, 26 Aug 2024 02:24:49 +0300 Message-ID: <20240825232449.25905-1-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.44.2 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-LSpam-Score: -6.3 (------) X-LSpam-Report: No, score=-6.3 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DMARC_MISSING=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_VALIDITY_CERTIFIED=-3,RCVD_IN_VALIDITY_RPBL=1.31,RCVD_IN_VALIDITY_SAFE=-2,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no |
Series |
media: videobuf2: Drop minimum allocation requirement of 2 buffers
|
|
Commit Message
Laurent Pinchart
Aug. 25, 2024, 11:24 p.m. UTC
When introducing the ability for drivers to indicate the minimum number
of buffers they require an application to allocate, commit 6662edcd32cc
("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue
structure") also introduced a global minimum of 2 buffers. It turns out
this breaks the Renesas R-Car VSP test suite, where a test that
allocates a single buffer fails when two buffers are used.
One may consider debatable whether test suite failures without failures
in production use cases should be considered as a regression, but
operation with a single buffer is a valid use case. While full frame
rate can't be maintained, memory-to-memory devices can still be used
with a decent efficiency, and requiring applications to allocate
multiple buffers for single-shot use cases with capture devices would
just waste memory.
For those reasons, fix the regression by dropping the global minimum of
buffers. Individual drivers can still set their own minimum.
Fixes: 6662edcd32cc ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue structure")
Cc: stable@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/media/common/videobuf2/videobuf2-core.c | 7 -------
1 file changed, 7 deletions(-)
base-commit: a043ea54bbb975ca9239c69fd17f430488d33522
Comments
On 26/08/2024 01:24, Laurent Pinchart wrote: > When introducing the ability for drivers to indicate the minimum number > of buffers they require an application to allocate, commit 6662edcd32cc > ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue > structure") also introduced a global minimum of 2 buffers. It turns out > this breaks the Renesas R-Car VSP test suite, where a test that > allocates a single buffer fails when two buffers are used. > > One may consider debatable whether test suite failures without failures > in production use cases should be considered as a regression, but > operation with a single buffer is a valid use case. While full frame > rate can't be maintained, memory-to-memory devices can still be used > with a decent efficiency, and requiring applications to allocate > multiple buffers for single-shot use cases with capture devices would > just waste memory. > > For those reasons, fix the regression by dropping the global minimum of > buffers. Individual drivers can still set their own minimum. > > Fixes: 6662edcd32cc ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue structure") > Cc: stable@vger.kernel.org > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Regards, Hans > --- > drivers/media/common/videobuf2/videobuf2-core.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > index 500a4e0c84ab..29a8d876e6c2 100644 > --- a/drivers/media/common/videobuf2/videobuf2-core.c > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > @@ -2632,13 +2632,6 @@ int vb2_core_queue_init(struct vb2_queue *q) > if (WARN_ON(q->supports_requests && q->min_queued_buffers)) > return -EINVAL; > > - /* > - * The minimum requirement is 2: one buffer is used > - * by the hardware while the other is being processed by userspace. > - */ > - if (q->min_reqbufs_allocation < 2) > - q->min_reqbufs_allocation = 2; > - > /* > * If the driver needs 'min_queued_buffers' in the queue before > * calling start_streaming() then the minimum requirement is > > base-commit: a043ea54bbb975ca9239c69fd17f430488d33522
On Mon, Aug 26, 2024 at 8:24 AM Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> wrote: > > When introducing the ability for drivers to indicate the minimum number > of buffers they require an application to allocate, commit 6662edcd32cc > ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue > structure") also introduced a global minimum of 2 buffers. It turns out > this breaks the Renesas R-Car VSP test suite, where a test that > allocates a single buffer fails when two buffers are used. > > One may consider debatable whether test suite failures without failures > in production use cases should be considered as a regression, but > operation with a single buffer is a valid use case. While full frame > rate can't be maintained, memory-to-memory devices can still be used > with a decent efficiency, and requiring applications to allocate > multiple buffers for single-shot use cases with capture devices would > just waste memory. > > For those reasons, fix the regression by dropping the global minimum of > buffers. Individual drivers can still set their own minimum. > > Fixes: 6662edcd32cc ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue structure") > Cc: stable@vger.kernel.org > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > drivers/media/common/videobuf2/videobuf2-core.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > index 500a4e0c84ab..29a8d876e6c2 100644 > --- a/drivers/media/common/videobuf2/videobuf2-core.c > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > @@ -2632,13 +2632,6 @@ int vb2_core_queue_init(struct vb2_queue *q) > if (WARN_ON(q->supports_requests && q->min_queued_buffers)) > return -EINVAL; > > - /* > - * The minimum requirement is 2: one buffer is used > - * by the hardware while the other is being processed by userspace. > - */ > - if (q->min_reqbufs_allocation < 2) > - q->min_reqbufs_allocation = 2; > - > /* > * If the driver needs 'min_queued_buffers' in the queue before > * calling start_streaming() then the minimum requirement is > > base-commit: a043ea54bbb975ca9239c69fd17f430488d33522 Thanks for the patch! Acked-by: Tomasz Figa <tfiga@chromium.org> Best regards, Tomasz
Hi Hans, Please let me know if you expect a pull request, otherwise I'll consider you will take this in your tree. On Mon, Aug 26, 2024 at 08:31:13AM +0200, Hans Verkuil wrote: > On 26/08/2024 01:24, Laurent Pinchart wrote: > > When introducing the ability for drivers to indicate the minimum number > > of buffers they require an application to allocate, commit 6662edcd32cc > > ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue > > structure") also introduced a global minimum of 2 buffers. It turns out > > this breaks the Renesas R-Car VSP test suite, where a test that > > allocates a single buffer fails when two buffers are used. > > > > One may consider debatable whether test suite failures without failures > > in production use cases should be considered as a regression, but > > operation with a single buffer is a valid use case. While full frame > > rate can't be maintained, memory-to-memory devices can still be used > > with a decent efficiency, and requiring applications to allocate > > multiple buffers for single-shot use cases with capture devices would > > just waste memory. > > > > For those reasons, fix the regression by dropping the global minimum of > > buffers. Individual drivers can still set their own minimum. > > > > Fixes: 6662edcd32cc ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue structure") > > Cc: stable@vger.kernel.org > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > > Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > > > --- > > drivers/media/common/videobuf2/videobuf2-core.c | 7 ------- > > 1 file changed, 7 deletions(-) > > > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > > index 500a4e0c84ab..29a8d876e6c2 100644 > > --- a/drivers/media/common/videobuf2/videobuf2-core.c > > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > > @@ -2632,13 +2632,6 @@ int vb2_core_queue_init(struct vb2_queue *q) > > if (WARN_ON(q->supports_requests && q->min_queued_buffers)) > > return -EINVAL; > > > > - /* > > - * The minimum requirement is 2: one buffer is used > > - * by the hardware while the other is being processed by userspace. > > - */ > > - if (q->min_reqbufs_allocation < 2) > > - q->min_reqbufs_allocation = 2; > > - > > /* > > * If the driver needs 'min_queued_buffers' in the queue before > > * calling start_streaming() then the minimum requirement is > > > > base-commit: a043ea54bbb975ca9239c69fd17f430488d33522
On 8/27/24 11:15, Laurent Pinchart wrote: > Hi Hans, > > Please let me know if you expect a pull request, otherwise I'll consider > you will take this in your tree. Can you add it to your "Miscellaneous V4L2 patches" PR and post a v2 of that today? Regards, Hans > > On Mon, Aug 26, 2024 at 08:31:13AM +0200, Hans Verkuil wrote: >> On 26/08/2024 01:24, Laurent Pinchart wrote: >>> When introducing the ability for drivers to indicate the minimum number >>> of buffers they require an application to allocate, commit 6662edcd32cc >>> ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue >>> structure") also introduced a global minimum of 2 buffers. It turns out >>> this breaks the Renesas R-Car VSP test suite, where a test that >>> allocates a single buffer fails when two buffers are used. >>> >>> One may consider debatable whether test suite failures without failures >>> in production use cases should be considered as a regression, but >>> operation with a single buffer is a valid use case. While full frame >>> rate can't be maintained, memory-to-memory devices can still be used >>> with a decent efficiency, and requiring applications to allocate >>> multiple buffers for single-shot use cases with capture devices would >>> just waste memory. >>> >>> For those reasons, fix the regression by dropping the global minimum of >>> buffers. Individual drivers can still set their own minimum. >>> >>> Fixes: 6662edcd32cc ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue structure") >>> Cc: stable@vger.kernel.org >>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> >> >> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> >> >>> --- >>> drivers/media/common/videobuf2/videobuf2-core.c | 7 ------- >>> 1 file changed, 7 deletions(-) >>> >>> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c >>> index 500a4e0c84ab..29a8d876e6c2 100644 >>> --- a/drivers/media/common/videobuf2/videobuf2-core.c >>> +++ b/drivers/media/common/videobuf2/videobuf2-core.c >>> @@ -2632,13 +2632,6 @@ int vb2_core_queue_init(struct vb2_queue *q) >>> if (WARN_ON(q->supports_requests && q->min_queued_buffers)) >>> return -EINVAL; >>> >>> - /* >>> - * The minimum requirement is 2: one buffer is used >>> - * by the hardware while the other is being processed by userspace. >>> - */ >>> - if (q->min_reqbufs_allocation < 2) >>> - q->min_reqbufs_allocation = 2; >>> - >>> /* >>> * If the driver needs 'min_queued_buffers' in the queue before >>> * calling start_streaming() then the minimum requirement is >>> >>> base-commit: a043ea54bbb975ca9239c69fd17f430488d33522 >
On Tue, Aug 27, 2024 at 11:19:22AM +0200, Hans Verkuil wrote: > On 8/27/24 11:15, Laurent Pinchart wrote: > > Hi Hans, > > > > Please let me know if you expect a pull request, otherwise I'll consider > > you will take this in your tree. > > Can you add it to your "Miscellaneous V4L2 patches" PR and post a v2 > of that today? I'd rather not, as I don't want to rebase and retest that one. I'll send a separate pull request for this patch. > > On Mon, Aug 26, 2024 at 08:31:13AM +0200, Hans Verkuil wrote: > >> On 26/08/2024 01:24, Laurent Pinchart wrote: > >>> When introducing the ability for drivers to indicate the minimum number > >>> of buffers they require an application to allocate, commit 6662edcd32cc > >>> ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue > >>> structure") also introduced a global minimum of 2 buffers. It turns out > >>> this breaks the Renesas R-Car VSP test suite, where a test that > >>> allocates a single buffer fails when two buffers are used. > >>> > >>> One may consider debatable whether test suite failures without failures > >>> in production use cases should be considered as a regression, but > >>> operation with a single buffer is a valid use case. While full frame > >>> rate can't be maintained, memory-to-memory devices can still be used > >>> with a decent efficiency, and requiring applications to allocate > >>> multiple buffers for single-shot use cases with capture devices would > >>> just waste memory. > >>> > >>> For those reasons, fix the regression by dropping the global minimum of > >>> buffers. Individual drivers can still set their own minimum. > >>> > >>> Fixes: 6662edcd32cc ("media: videobuf2: Add min_reqbufs_allocation field to vb2_queue structure") > >>> Cc: stable@vger.kernel.org > >>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > >> > >> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > >> > >>> --- > >>> drivers/media/common/videobuf2/videobuf2-core.c | 7 ------- > >>> 1 file changed, 7 deletions(-) > >>> > >>> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > >>> index 500a4e0c84ab..29a8d876e6c2 100644 > >>> --- a/drivers/media/common/videobuf2/videobuf2-core.c > >>> +++ b/drivers/media/common/videobuf2/videobuf2-core.c > >>> @@ -2632,13 +2632,6 @@ int vb2_core_queue_init(struct vb2_queue *q) > >>> if (WARN_ON(q->supports_requests && q->min_queued_buffers)) > >>> return -EINVAL; > >>> > >>> - /* > >>> - * The minimum requirement is 2: one buffer is used > >>> - * by the hardware while the other is being processed by userspace. > >>> - */ > >>> - if (q->min_reqbufs_allocation < 2) > >>> - q->min_reqbufs_allocation = 2; > >>> - > >>> /* > >>> * If the driver needs 'min_queued_buffers' in the queue before > >>> * calling start_streaming() then the minimum requirement is > >>> > >>> base-commit: a043ea54bbb975ca9239c69fd17f430488d33522
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index 500a4e0c84ab..29a8d876e6c2 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -2632,13 +2632,6 @@ int vb2_core_queue_init(struct vb2_queue *q) if (WARN_ON(q->supports_requests && q->min_queued_buffers)) return -EINVAL; - /* - * The minimum requirement is 2: one buffer is used - * by the hardware while the other is being processed by userspace. - */ - if (q->min_reqbufs_allocation < 2) - q->min_reqbufs_allocation = 2; - /* * If the driver needs 'min_queued_buffers' in the queue before * calling start_streaming() then the minimum requirement is