From patchwork Mon Apr 28 09:02:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Sven_P=C3=BCschel?= X-Patchwork-Id: 23275 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B24B7C327D for ; Mon, 28 Apr 2025 09:05:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E80B068AD5; Mon, 28 Apr 2025 11:05:14 +0200 (CEST) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8484268AD4 for ; Mon, 28 Apr 2025 11:05:06 +0200 (CEST) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=peter.guest.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1u9KQE-0001au-4G; Mon, 28 Apr 2025 11:05:06 +0200 From: =?utf-8?q?Sven_P=C3=BCschel?= To: libcamera-devel@lists.libcamera.org Cc: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Paul Elder , =?utf-8?q?Sven_P=C3=BCschel?= Subject: [PATCH v11 03/19] libcamera: pipeline: rpi: Don't rely on bufferCount Date: Mon, 28 Apr 2025 11:02:28 +0200 Message-ID: <20250428090413.38234-4-s.pueschel@pengutronix.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250428090413.38234-1-s.pueschel@pengutronix.de> References: <20250428090413.38234-1-s.pueschel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: s.pueschel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: libcamera-devel@lists.libcamera.org X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nícolas F. R. A. Prado Currently the raspberrypi pipeline handler relies on bufferCount to decide on the number of buffers to allocate internally and for the number of V4L2 buffer slots to reserve. There already exists a procedure for determining the number of buffers to reserve, so to remove reliance on bufferCount we simply replace the one instance that it is used in, as well as remove populating it in generateConfiguration(). Signed-off-by: Nícolas F. R. A. Prado Signed-off-by: Paul Elder Signed-off-by: Sven Püschel --- Changes in v11: - adapted pisp.cpp similar to vc4.cpp - corrected spelling errors in commit description Changes in v10: - completely changed, to leverage the existing buffer count calculations - the refactoring that was in v9's rebase wasn't necessary, i think - this also makes it conflict less with [1] which ought to be coming soon [1] https://patchwork.libcamera.org/project/libcamera/list/?series=3663 Changes in v9: - rebased - I've decided that the buffer allocation decisions that N?colas implemented covered the same cases that were added in PipelineHandlerRPi::prepareBuffers(), but in a slightly nicer way, especially considering that bufferCount is to be removed from StreamConfiguration in this series. Comments welcome, of course. Changes in v8: - Reworked buffer allocation handling in the raspberrypi pipeline handler - New --- src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 6 ------ src/libcamera/pipeline/rpi/pisp/pisp.cpp | 2 +- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index dc1e0a2e..bcc74052 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -388,7 +388,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, Span config = std::make_unique(data); V4L2SubdeviceFormat sensorFormat; - unsigned int bufferCount; PixelFormat pixelFormat; V4L2VideoDevice::Formats fmts; Size size; @@ -407,7 +406,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, SpanaddConfiguration(cfg); } diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp index 91e7f4c9..0f607a64 100644 --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp @@ -965,7 +965,7 @@ int PipelineHandlerPiSP::prepareBuffers(Camera *camera) for (Stream *s : camera->streams()) { if (PipelineHandlerBase::isRaw(s->configuration().pixelFormat)) { - numRawBuffers = s->configuration().bufferCount; + numRawBuffers = data->cfe_[Cfe::Output0].getBuffers().size(); break; } } diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index fe910bdf..97e7a6ff 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -224,7 +224,7 @@ int PipelineHandlerVc4::prepareBuffers(Camera *camera) for (Stream *s : camera->streams()) { if (BayerFormat::fromPixelFormat(s->configuration().pixelFormat).isValid()) { - numRawBuffers = s->configuration().bufferCount; + numRawBuffers = data->unicam_[Unicam::Image].getBuffers().size(); break; } }