From patchwork Mon Apr 28 09:02:33 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: 23280 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 2914BC3322 for ; Mon, 28 Apr 2025 09:05:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7381B68B38; Mon, 28 Apr 2025 11:05:25 +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 6271568ADA for ; Mon, 28 Apr 2025 11:05:07 +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 1u9KQF-0001au-2P; Mon, 28 Apr 2025 11:05:07 +0200 From: =?utf-8?q?Sven_P=C3=BCschel?= To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , =?utf-8?q?Sven_P=C3=BCschel?= Subject: [PATCH v11 08/19] libcamera: pipeline: imx8-isi: Don't rely on bufferCount Date: Mon, 28 Apr 2025 11:02:33 +0200 Message-ID: <20250428090413.38234-9-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: Paul Elder Instead of using bufferCount as the number of V4L2 buffer slots to reserve in the isi pipeline handler, use a reasonably high constant: 16. Overallocating isn't a problem as buffer slots are cheap. Having too few, on the other hand, could degrade performance. It is expected that this number will be more than enough for most, if not all, use cases. Signed-off-by: Paul Elder Signed-off-by: Sven Püschel --- Changes in v11: - rebased New in v10 --- src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp index 21f44424..efb280d7 100644 --- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp +++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp @@ -144,6 +144,8 @@ private: std::unique_ptr crossbar_; std::vector pipes_; + + static constexpr unsigned int kBufferSlotCount = 16; }; /* ----------------------------------------------------------------------------- @@ -923,9 +925,8 @@ int PipelineHandlerISI::start(Camera *camera, for (const auto &stream : data->enabledStreams_) { Pipe *pipe = pipeFromStream(camera, stream); - const StreamConfiguration &config = stream->configuration(); - int ret = pipe->capture->importBuffers(config.bufferCount); + int ret = pipe->capture->importBuffers(kBufferSlotCount); if (ret) return ret;