{"id":24271,"url":"https://patchwork.libcamera.org/api/patches/24271/?format=json","web_url":"https://patchwork.libcamera.org/patch/24271/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250831165243.36652-1-robert.mader@collabora.com>","date":"2025-08-31T16:52:43","name":"pipeline: simple: Allow buffer counts from 1 to 16 for swISP","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ee5ad038913234eaecbbeb067e470d87ed9100ac","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/?format=json","name":"Robert Mader","email":"robert.mader@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24271/mbox/","series":[{"id":5416,"url":"https://patchwork.libcamera.org/api/series/5416/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5416","date":"2025-08-31T16:52:43","name":"pipeline: simple: Allow buffer counts from 1 to 16 for swISP","version":1,"mbox":"https://patchwork.libcamera.org/series/5416/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24271/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24271/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 A5791BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 31 Aug 2025 16:53:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3B90669322;\n\tSun, 31 Aug 2025 18:53:06 +0200 (CEST)","from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 82E7E613AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 31 Aug 2025 18:53:04 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1756659178048835.429730755252;\n\tSun, 31 Aug 2025 09:52:58 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"UIcJvtYt\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1756659180; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=bEPB11UTC9rSUIINZ+hfQBjOxsxbc7JTnHRlDyblwH1w/Y5PM/pHu0jt/042md9AKip6Wn2xcdNqQxl6pWVyNnGCRs45EL6qFhE4+hk2JQyAeoANYuTrjQSdIvsPnsf7XT3eH+paBuQ+4oE8nNyLnv+UfN10Urmjv569kIzhWOo=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1756659180;\n\th=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=lNRPFsZeBwd4qMEQSvEwWx3roM8Fb6spUWxP1sjHmsE=; \n\tb=ng4YoIM24Z5JagPdqSH6vTjTENOiGge/JTOOtDCFaTUTdVWhEx+cVQ5Ck1IC3rtnfiKvQ/WLIHlT3dPJXLwbZv+f3TByYUS8f0jYFl+v8TDrKaqPOMbFj0pnSUposaWXEvO781kPimwkXPV7MlXQHtJhAxF8XruoWC5LVUV/xE4=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1756659180;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=lNRPFsZeBwd4qMEQSvEwWx3roM8Fb6spUWxP1sjHmsE=;\n\tb=UIcJvtYt+SOLI977tMQVa/2WDSDzeZkHl/yKF1aJr2nI0wevGzrflzPWJavMiKQ0\n\tyVtVUKtJTT05ksgswCNd+ad6HRSdtGiTqx8AxS5Phw7lM+uPtdbueAmNcZSctcHX+DS\n\tTYE6M0CWG/b7wXwQTiI0ciLnnRs+9wvJw1eB9CyY=","From":"Robert Mader <robert.mader@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Robert Mader <robert.mader@collabora.com>","Subject":"[PATCH] pipeline: simple: Allow buffer counts from 1 to 16 for swISP","Date":"Sun, 31 Aug 2025 18:52:43 +0200","Message-ID":"<20250831165243.36652-1-robert.mader@collabora.com>","X-Mailer":"git-send-email 2.51.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"When using the softwareISP we allocate the output buffers ourselves,\nusually from system memory. There's thus no strong reason to limit\nchoices for client. Situations where this might be useful include:\n1. Video encoding, e.g. encoding multiple buffers in parallel.\n2. Clients requesting a single buffer - e.g. in multi-stream scenarios.\n\nThus allow up to 16 buffers - arbitrarily decided - while keeping the\ndefault to the previous 4.\n\nWhile on it, mark the config as adjusted if we did so.\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 38 ++++++++++++++++++++++--\n 1 file changed, 36 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 9b24a0db9..da871c7fb 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -375,6 +375,9 @@ public:\n \tconst Transform &combinedTransform() const { return combinedTransform_; }\n \n private:\n+\tstatic constexpr unsigned int kNumBuffersDefault = 4;\n+\tstatic constexpr unsigned int kNumBuffersSwISPMax = 16;\n+\n \t/*\n \t * The SimpleCameraData instance is guaranteed to be valid as long as\n \t * the corresponding Camera instance is valid. In order to borrow a\n@@ -1246,6 +1249,31 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t\t\t\t\t\t\t\t\t    cfg.size);\n \t\t\tif (cfg.stride == 0)\n \t\t\t\treturn Invalid;\n+\n+\t\t\tif (data_->converter_) {\n+\t\t\t\tif (cfg.bufferCount != kNumBuffersDefault) {\n+\t\t\t\t\tLOG(SimplePipeline, Debug)\n+\t\t\t\t\t\t<< \"Adjusting bufferCount from \" << cfg.bufferCount\n+\t\t\t\t\t\t<< \" to \" << kNumBuffersDefault;\n+\t\t\t\t\tcfg.bufferCount = kNumBuffersDefault;\n+\t\t\t\t\tstatus = Adjusted;\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tif (cfg.bufferCount == 0) {\n+\t\t\t\t\tLOG(SimplePipeline, Debug)\n+\t\t\t\t\t\t<< \"Adjusting bufferCount from \" << cfg.bufferCount\n+\t\t\t\t\t\t<< \" to \" << kNumBuffersDefault;\n+\t\t\t\t\tcfg.bufferCount = kNumBuffersDefault;\n+\t\t\t\t\tstatus = Adjusted;\n+\t\t\t\t}\n+\t\t\t\tif (cfg.bufferCount > kNumBuffersSwISPMax) {\n+\t\t\t\t\tLOG(SimplePipeline, Debug)\n+\t\t\t\t\t\t<< \"Adjusting bufferCount from \" << cfg.bufferCount\n+\t\t\t\t\t\t<< \" to \" << kNumBuffersSwISPMax;\n+\t\t\t\t\tcfg.bufferCount = kNumBuffersSwISPMax;\n+\t\t\t\t\tstatus = Adjusted;\n+\t\t\t\t}\n+\t\t\t}\n \t\t} else {\n \t\t\tV4L2DeviceFormat format;\n \t\t\tformat.fourcc = data_->video_->toV4L2PixelFormat(cfg.pixelFormat);\n@@ -1257,9 +1285,15 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \n \t\t\tcfg.stride = format.planes[0].bpl;\n \t\t\tcfg.frameSize = format.planes[0].size;\n-\t\t}\n \n-\t\tcfg.bufferCount = 4;\n+\t\t\tif (cfg.bufferCount != kNumBuffersDefault) {\n+\t\t\t\tLOG(SimplePipeline, Debug)\n+\t\t\t\t\t<< \"Adjusting bufferCount from \" << cfg.bufferCount\n+\t\t\t\t\t<< \" to \" << kNumBuffersDefault;\n+\t\t\t\tcfg.bufferCount = kNumBuffersDefault;\n+\t\t\t\tstatus = Adjusted;\n+\t\t\t}\n+\t\t}\n \t}\n \n \treturn status;\n","prefixes":[]}