Patch Detail
Show a patch.
GET /api/patches/26175/?format=api
{ "id": 26175, "url": "https://patchwork.libcamera.org/api/patches/26175/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26175/", "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": "<20260216203034.27558-7-mzamazal@redhat.com>", "date": "2026-02-16T20:30:25", "name": "[RFC,v2,06/14] libcamera: software_isp: Allocate multiple parameters buffers", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f8ea6ea3fbc5a69498316c42cd5908587741753f", "submitter": { "id": 177, "url": "https://patchwork.libcamera.org/api/people/177/?format=api", "name": "Milan Zamazal", "email": "mzamazal@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26175/mbox/", "series": [ { "id": 5795, "url": "https://patchwork.libcamera.org/api/series/5795/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5795", "date": "2026-02-16T20:30:19", "name": "Software ISP: Share params and stats buffers", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5795/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26175/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26175/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 D824AC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Feb 2026 20:30:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 951F262220;\n\tMon, 16 Feb 2026 21:30:56 +0100 (CET)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 99E676221A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Feb 2026 21:30:55 +0100 (CET)", "from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-202-J5JjY4moMoKDxjOxyaYJDA-1;\n\tMon, 16 Feb 2026 15:30:52 -0500", "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.93])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid D18511955DDF for <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Feb 2026 20:30:51 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.25])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 940FF1800464; Mon, 16 Feb 2026 20:30:50 +0000 (UTC)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"J/4Ax2dO\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1771273854;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=Gdu6LfsyVcCj28wb76kIQZpoG81Uao3Kk/9avHTprZY=;\n\tb=J/4Ax2dOaKEQYffJ4dkBwcUGbzsIZ44gDn2KblDVA3KT6AY24WjiV9sesmuD7Pp0SnHc18\n\te3VQ6Wbt8R1cl2+L+JJVYhMkGUZAipoqcSCmWAgq+IZU9JPEzQSWVNeDYwC5o/MfA4fZ8C\n\tY50PPdWP4GSkzzvjTrDcWf6V+wxufBQ=", "X-MC-Unique": "J5JjY4moMoKDxjOxyaYJDA-1", "X-Mimecast-MFC-AGG-ID": "J5JjY4moMoKDxjOxyaYJDA_1771273851", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>", "Subject": "[RFC PATCH v2 06/14] libcamera: software_isp: Allocate multiple\n\tparameters buffers", "Date": "Mon, 16 Feb 2026 21:30:25 +0100", "Message-ID": "<20260216203034.27558-7-mzamazal@redhat.com>", "In-Reply-To": "<20260216203034.27558-1-mzamazal@redhat.com>", "References": "<20260216203034.27558-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "kLVktF3DdG1aZiBq6tLyr98xviYJX2M7_3giQMSH6S8_1771273851", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true", "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": "We want to use more than one parameters buffer. Processing statistics\n(and setting the corresponding parameters) is asynchronous and may work\nwith a parameters buffer while the last parameters buffer may be in or\nwait for use in debayering.\n\nThe question is how many buffer we need. A starting idea might be to\nuse the same number as for input and output buffers. This may not be\nnecessarily the best or even correct idea, but if the number of those\nbuffers is sufficient now then perhaps the same number of the parameters\nbuffers (and later statistics buffers) would work. Unless multiple\nstreams are used...\n\nNevertheless, the number of the input and output buffers is currently\nfixed, which makes it possible to use in init, before configure, where\nthe current single buffer is allocated. It just requires to make the\ngiven constant public in SimplePipelineHandler so that it can be passed\nto the SoftwareIsp constructor.\n\nAnother alternative would be to determine the right number of buffers in\nSoftwareIsp::configure. This would be more complicated as it would\nrequire some more refactoring, allocating the buffers in configure and\npassing their file descriptors to the IPA and debayering on demand.\n\nOnly the first allocated buffer is actually used at the moment. This\nwill be changed in the followup patches once support for multiple\nbuffers is added to the IPA and debayering.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n .../libcamera/internal/software_isp/software_isp.h | 6 +++---\n src/libcamera/pipeline/simple/simple.cpp | 5 +++--\n src/libcamera/software_isp/software_isp.cpp | 14 +++++---------\n 3 files changed, 11 insertions(+), 14 deletions(-)", "diff": "diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nindex f809e6be8..65348e213 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -49,7 +49,8 @@ class SoftwareIsp : public Object\n {\n public:\n \tSoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n-\t\t ControlInfoMap *ipaControls);\n+\t\t ControlInfoMap *ipaControls,\n+\t\t const unsigned int bufferCount);\n \t~SoftwareIsp();\n \n \tint loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }\n@@ -97,11 +98,10 @@ private:\n \tvoid outputReady(FrameBuffer *output);\n \tstd::unique_ptr<Debayer> debayer_;\n \tThread ispWorkerThread_;\n-\tstatic constexpr unsigned int kParamStatBufferCount = 1;\n \tstd::map<uint32_t, SharedMemObject<DebayerParams>> sharedParams_;\n \tDebayerParams debayerParams_;\n \tstd::queue<uint32_t> availableParams_;\n-\tbool allocateParamsBuffers();\n+\tbool allocateParamsBuffers(const unsigned int bufferCount);\n \tDmaBufAllocator dmaHeap_;\n \tbool ccmEnabled_;\n \ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 4a0b9f58d..dc9176c29 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -427,13 +427,13 @@ public:\n \tV4L2Subdevice *subdev(const MediaEntity *entity);\n \tstd::shared_ptr<MediaDevice> converter() { return converter_; }\n \tbool swIspEnabled() const { return swIspEnabled_; }\n+\tstatic constexpr unsigned int kNumInternalBuffers = 4;\n \n protected:\n \tint queueRequestDevice(Camera *camera, Request *request) override;\n \n private:\n \tstatic constexpr unsigned int kMaxQueuedRequestsDevice = 4;\n-\tstatic constexpr unsigned int kNumInternalBuffers = 4;\n \n \tstruct EntityData {\n \t\tstd::unique_ptr<V4L2VideoDevice> video;\n@@ -615,7 +615,8 @@ int SimpleCameraData::init()\n \t * Instantiate Soft ISP if this is enabled for the given driver and no converter is used.\n \t */\n \tif (!converter_ && pipe->swIspEnabled()) {\n-\t\tswIsp_ = std::make_unique<SoftwareIsp>(pipe, sensor_.get(), &controlInfo_);\n+\t\tswIsp_ = std::make_unique<SoftwareIsp>(pipe, sensor_.get(), &controlInfo_,\n+\t\t\t\t\t\t pipe->kNumInternalBuffers);\n \t\tif (!swIsp_->isValid()) {\n \t\t\tLOG(SimplePipeline, Warning)\n \t\t\t\t<< \"Failed to create software ISP, disabling software debayering\";\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex 79d5dfe0e..02d1c4c12 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -70,20 +70,16 @@ LOG_DEFINE_CATEGORY(SoftwareIsp)\n * ready\n */\n \n-/**\n- * \\var SoftwareIsp::kParamStatBufferCount\n- * \\brief The number of stats and params buffers (each of them)\n- */\n-\n /**\n * \\brief Constructs SoftwareIsp object\n * \\param[in] pipe The pipeline handler in use\n * \\param[in] sensor Pointer to the CameraSensor instance owned by the pipeline\n * \\param[out] ipaControls The IPA controls to update\n+ * \\param[in] bufferCount Number of parameters buffers and stats buffers to allocate\n * handler\n */\n SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n-\t\t\t ControlInfoMap *ipaControls)\n+\t\t\t ControlInfoMap *ipaControls, const unsigned bufferCount)\n \t: ispWorkerThread_(\"SWIspWorker\"),\n \t dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |\n \t\t DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |\n@@ -93,7 +89,7 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n \t\tLOG(SoftwareIsp, Error) << \"Failed to create DmaBufAllocator object\";\n \t\treturn;\n \t}\n-\tif (!allocateParamsBuffers())\n+\tif (!allocateParamsBuffers(bufferCount))\n \t\treturn;\n \n \tconst GlobalConfiguration &configuration = pipe->cameraManager()->_d()->configuration();\n@@ -177,9 +173,9 @@ SoftwareIsp::~SoftwareIsp()\n \tdebayer_.reset();\n }\n \n-bool SoftwareIsp::allocateParamsBuffers()\n+bool SoftwareIsp::allocateParamsBuffers(const unsigned int bufferCount)\n {\n-\tfor (unsigned int i = 0; i < kParamStatBufferCount; i++) {\n+\tfor (unsigned int i = 0; i < bufferCount; i++) {\n \t\tauto params = SharedMemObject<DebayerParams>(\"softIsp_params\");\n \t\tif (!params) {\n \t\t\tLOG(SoftwareIsp, Error) << \"Failed to create shared memory for parameters\";\n", "prefixes": [ "RFC", "v2", "06/14" ] }