Show a patch.

GET /api/1.1/patches/26851/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26851,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26851/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26851/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20260608150349.134371-10-mzamazal@redhat.com>",
    "date": "2026-06-08T15:03:38",
    "name": "[RFC,v4,09/17] libcamera: software_isp: Allocate multiple parameters buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2a32a38fe6a8a2ea26651be3523f2f29979b564e",
    "submitter": {
        "id": 177,
        "url": "https://patchwork.libcamera.org/api/1.1/people/177/?format=api",
        "name": "Milan Zamazal",
        "email": "mzamazal@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26851/mbox/",
    "series": [
        {
            "id": 5982,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5982/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5982",
            "date": "2026-06-08T15:03:29",
            "name": "Software ISP: Share params and stats buffers",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/5982/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26851/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26851/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 D319DC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Jun 2026 15:04:28 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 96AA461F00;\n\tMon,  8 Jun 2026 17:04:28 +0200 (CEST)",
            "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 7D87E61EE7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Jun 2026 17:04:26 +0200 (CEST)",
            "from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-262-zouugvlLOmKsGZ5UcbEF5Q-1;\n\tMon, 08 Jun 2026 11:04:20 -0400",
            "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.111])\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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 1E5911800594; Mon,  8 Jun 2026 15:04:19 +0000 (UTC)",
            "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.51])\n\tby mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id E7DA41800361; Mon,  8 Jun 2026 15:04:16 +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=\"R8ukTjg2\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1780931065;\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=R8ukTjg2eJk0oUvlqbh3uPScbwtNmveg+kdCI89xBRFS1VcokGBuhP/OnTZsflVtAPQWtj\n\t26tw+Qqy5jdLZYXyuZVJL0pDSO1urRhycCAMYU9pJ/kc3Mhz7NtLyoEHXpyikcud2dFpPc\n\t1TbCQqvSoMt8zZWCtun5aeMTy0UjXSk=",
        "X-MC-Unique": "zouugvlLOmKsGZ5UcbEF5Q-1",
        "X-Mimecast-MFC-AGG-ID": "zouugvlLOmKsGZ5UcbEF5Q_1780931059",
        "From": "Milan Zamazal <mzamazal@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Milan Zamazal <mzamazal@redhat.com>, Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?=\n\t<barnabas.pocze@ideasonboard.com>,  johannes.goede@oss.qualcomm.com",
        "Subject": "[RFC PATCH v4 09/17] libcamera: software_isp: Allocate multiple\n\tparameters buffers",
        "Date": "Mon,  8 Jun 2026 17:03:38 +0200",
        "Message-ID": "<20260608150349.134371-10-mzamazal@redhat.com>",
        "In-Reply-To": "<20260608150349.134371-1-mzamazal@redhat.com>",
        "References": "<20260608150349.134371-1-mzamazal@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "2Dr-YqVs7d8etSp-et8XB7QCB2tJEqWwSXprolZqvzE_1780931059",
        "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",
        "v4",
        "09/17"
    ]
}