Patch Detail
Show a patch.
GET /api/patches/23450/?format=api
{ "id": 23450, "url": "https://patchwork.libcamera.org/api/patches/23450/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23450/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250527153732.39348-2-s.pueschel@pengutronix.de>", "date": "2025-05-27T15:14:08", "name": "libcamera: pipeline: rkisp1: Don't rely on bufferCount", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e50b9152b0424a1c0e4d48d219d5dac3d7b54b0f", "submitter": { "id": 225, "url": "https://patchwork.libcamera.org/api/people/225/?format=api", "name": "Sven Püschel", "email": "s.pueschel@pengutronix.de" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23450/mbox/", "series": [ { "id": 5197, "url": "https://patchwork.libcamera.org/api/series/5197/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5197", "date": "2025-05-27T15:14:08", "name": "libcamera: pipeline: rkisp1: Don't rely on bufferCount", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5197/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23450/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23450/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B4CA6C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 May 2025 15:38:36 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 73E1168DA0;\n\tTue, 27 May 2025 17:38:36 +0200 (CEST)", "from metis.whiteo.stw.pengutronix.de\n\t(metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E6E268D94\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 May 2025 17:38:34 +0200 (CEST)", "from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77]\n\thelo=peter.mobile.pengutronix.de)\n\tby metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92)\n\t(envelope-from <s.pueschel@pengutronix.de>)\n\tid 1uJwNu-0007VS-5R; Tue, 27 May 2025 17:38:34 +0200" ], "From": "=?utf-8?q?Sven_P=C3=BCschel?= <s.pueschel@pengutronix.de>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "graphics@pengutronix.de, stefan.klug@ideasonboard.com, =?utf-8?b?TsOt?=\n\t=?utf-8?q?colas_F=2E_R=2E_A=2E_Prado?= <nfraprado@collabora.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>, =?utf-8?q?Sven_P=C3=BCschel?=\n\t<s.pueschel@pengutronix.de>", "Subject": "[PATCH] libcamera: pipeline: rkisp1: Don't rely on bufferCount", "Date": "Tue, 27 May 2025 17:14:08 +0200", "Message-ID": "<20250527153732.39348-2-s.pueschel@pengutronix.de>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20250527153732.39348-1-s.pueschel@pengutronix.de>", "References": "<20250526214224.13631-1-stefan.klug@ideasonboard.com>\n\t<20250527153732.39348-1-s.pueschel@pengutronix.de>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "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);\n\tSAEximRunCond 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": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n\nCurrently the rkisp1 pipeline handler relies on bufferCount to decide on\nthe number of parameter and statistics buffers to allocate internally.\nInstead, the number of internal buffers should be the minimum required\nby the pipeline to keep the requests flowing, in order to avoid wasting\nmemory.\n\nStop relying on bufferCount for these numbers and instead set them to\nkPipelineDepth, as this already limits the number of buffers queued\nto the driver.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Sven Püschel <s.pueschel@pengutronix.de>\n\n---\n- Migrated from [1]\n - Removed rkisp1_path adjustments, as they are already handled by Stefan's patches\n - Removed Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n - Removed Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\n[1] https://lists.libcamera.org/pipermail/libcamera-devel/2025-April/050029.html\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 15 +++++++--------\n 1 file changed, 7 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex ea94bccd..51918f4b 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -157,6 +157,10 @@ private:\n \n namespace {\n \n+/*\n+ * This many internal buffers (or rather parameter and statistics buffer\n+ * pairs) ensures that the pipeline runs smoothly, without frame drops.\n+ */\n const unsigned int kPipelineDepth = 4;\n \n };\n@@ -991,24 +995,19 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n \tunsigned int ipaBufferId = 1;\n \tint ret;\n \n-\tunsigned int maxCount = std::max({\n-\t\tdata->mainPathStream_.configuration().bufferCount,\n-\t\tdata->selfPathStream_.configuration().bufferCount,\n-\t});\n-\n \tif (!isRaw_) {\n-\t\tret = param_->allocateBuffers(maxCount, ¶mBuffers_);\n+\t\tret = param_->allocateBuffers(kPipelineDepth, ¶mBuffers_);\n \t\tif (ret < 0)\n \t\t\tgoto error;\n \n-\t\tret = stat_->allocateBuffers(maxCount, &statBuffers_);\n+\t\tret = stat_->allocateBuffers(kPipelineDepth, &statBuffers_);\n \t\tif (ret < 0)\n \t\t\tgoto error;\n \t}\n \n \t/* If the dewarper is being used, allocate internal buffers for ISP. */\n \tif (useDewarper_) {\n-\t\tret = mainPath_.exportBuffers(maxCount, &mainPathBuffers_);\n+\t\tret = mainPath_.exportBuffers(kPipelineDepth, &mainPathBuffers_);\n \t\tif (ret < 0)\n \t\t\tgoto error;\n \n", "prefixes": [] }