Patch Detail
Show a patch.
GET /api/patches/26834/?format=api
{ "id": 26834, "url": "https://patchwork.libcamera.org/api/patches/26834/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26834/", "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": "<20260604095105.68798-14-mzamazal@redhat.com>", "date": "2026-06-04T09:50:55", "name": "[RFC,v3,09/17] libcamera: software_isp: Allocate multiple parameters buffers", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2a32a38fe6a8a2ea26651be3523f2f29979b564e", "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/26834/mbox/", "series": [ { "id": 5976, "url": "https://patchwork.libcamera.org/api/series/5976/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5976", "date": "2026-06-04T09:50:42", "name": "Software ISP: Share params and stats buffers", "version": 3, "mbox": "https://patchwork.libcamera.org/series/5976/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26834/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26834/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 592CEC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 4 Jun 2026 09:51:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 016CC6373D;\n\tThu, 4 Jun 2026 11:51:52 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 93D4B635D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Jun 2026 11:51:50 +0200 (CEST)", "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-553-tCC9yfFdNzKbH8xMvwKK0A-1;\n\tThu, 04 Jun 2026 05:51:45 -0400", "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\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 id 788191956095; Thu, 4 Jun 2026 09:51:44 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.34.156])\n\tby mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id C99D230001A1; Thu, 4 Jun 2026 09:51:42 +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=\"cyuaDlsq\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1780566709;\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=TlKNsR/BeKHwujDXFx60lIWHMGzlR97Igis2R06KzJY=;\n\tb=cyuaDlsq/Zsi8zsQsFIRgVDfLRAXxTC2FGC0lQLk8zc+z8y/yE+BSxyAmDUZsJFSXSpjsx\n\tKGOoLSnqUzNBWRs1ypEGObu/xIqgt/DhPTsKMhdiRLeRv4p0+A2h5Cy1kNkkjG70isG56R\n\tkK4f9cjS+zVGX4Fqrvx1Xp2K6nxr5zg=", "X-MC-Unique": "tCC9yfFdNzKbH8xMvwKK0A-1", "X-Mimecast-MFC-AGG-ID": "tCC9yfFdNzKbH8xMvwKK0A_1780566704", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>, =?utf-8?b?QmFybmFiw6FzIFDFkWN6?=\n\t=?utf-8?q?e?= <barnabas.pocze@ideasonboard.com>,\n\tjohannes.goede@oss.qualcomm.com", "Subject": "[RFC PATCH v3 09/17] libcamera: software_isp: Allocate multiple\n\tparameters buffers", "Date": "Thu, 4 Jun 2026 11:50:55 +0200", "Message-ID": "<20260604095105.68798-14-mzamazal@redhat.com>", "In-Reply-To": "<20260604095105.68798-1-mzamazal@redhat.com>", "References": "<20260604095105.68798-1-mzamazal@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "4Qj7HBaIpp06SekYucbUCd7EP6rrmbsaYUsRwOdrqHU_1780566704", "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 .../internal/software_isp/software_isp.h | 6 +++---\n src/libcamera/pipeline/simple/simple.cpp | 6 ++++--\n src/libcamera/software_isp/software_isp.cpp | 18 ++++++++----------\n 3 files changed, 15 insertions(+), 15 deletions(-)", "diff": "diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nindex b77793713..e3419305b 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -48,7 +48,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@@ -90,14 +91,13 @@ public:\n private:\n \tvoid saveIspParams(const uint32_t paramsBufferId);\n \tvoid paramsBufferReady(const uint32_t paramsBufferId);\n-\tbool allocateParamsBuffers();\n+\tbool allocateParamsBuffers(const unsigned int bufferCount);\n \tvoid setSensorCtrls(const ControlList &sensorControls);\n \tvoid statsReady(uint32_t frame, uint32_t bufferId);\n \tvoid inputReady(FrameBuffer *input);\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::vector<uint32_t> availableParams_;\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 93899699e..b49f372a6 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -428,12 +428,13 @@ public:\n \tstd::shared_ptr<MediaDevice> converter() { return converter_; }\n \tbool swIspEnabled() const { return swIspEnabled_; }\n \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 +616,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 6596e6fdb..97b423434 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -72,20 +72,18 @@ 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 * handler\n * \\param[out] ipaControls The IPA controls to update\n+ * \\param[in] bufferCount Number of parameters buffers and stats buffers to allocate\n */\n-SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n-\t\t\t ControlInfoMap *ipaControls)\n+SoftwareIsp::SoftwareIsp(PipelineHandler *pipe,\n+\t\t\t const CameraSensor *sensor,\n+\t\t\t ControlInfoMap *ipaControls,\n+\t\t\t const unsigned int bufferCount)\n \t: ispWorkerThread_(\"SWIspWorker\"),\n \t dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |\n \t\t DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |\n@@ -95,7 +93,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 CameraManager &cm = *pipe->cameraManager();\n@@ -182,9 +180,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 bufferId = 0; bufferId < kParamStatBufferCount; bufferId++) {\n+\tfor (unsigned int bufferId = 0; bufferId < bufferCount; bufferId++) {\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", "v3", "09/17" ] }