Show a patch.

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

{
    "id": 26171,
    "url": "https://patchwork.libcamera.org/api/patches/26171/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26171/",
    "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-3-mzamazal@redhat.com>",
    "date": "2026-02-16T20:30:21",
    "name": "[RFC,v2,02/14] libcamera: software_isp: Introduce arguments for parameters buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2595aa55d6b944e0d927e1bfcd27771bf65febc5",
    "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/26171/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/26171/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26171/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 F0FBBC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Feb 2026 20:30:50 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A7A5362210;\n\tMon, 16 Feb 2026 21:30:50 +0100 (CET)",
            "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 A0BC562210\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Feb 2026 21:30:48 +0100 (CET)",
            "from mx-prod-mc-05.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-359-u8gMOLENM-CUVP2BdTjDYA-1;\n\tMon, 16 Feb 2026 15:30:45 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid DB86B195608A for <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Feb 2026 20:30:44 +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 AA02D180066B; Mon, 16 Feb 2026 20:30:43 +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=\"F5+YO2KW\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1771273847;\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=069YiV6lPTQgWn+eLaNl2jQZJ/ZO4zAzYLy+OVbyFyA=;\n\tb=F5+YO2KWILJwmET0brdz+z8yfEnU9K+uhAIs5JO9ILtxNWhuUsERaOvJnWEiJNJm3S1WLy\n\tSfhgLWr/DbMruYbzXxIIvZjs2HtNam3ZFRLEK58RIuJOF1Ycjog6KgX9+/29WSLiLsgct3\n\t/FZ8W/j7W7z+wjO8QlAwNtnjNOEunoQ=",
        "X-MC-Unique": "u8gMOLENM-CUVP2BdTjDYA-1",
        "X-Mimecast-MFC-AGG-ID": "u8gMOLENM-CUVP2BdTjDYA_1771273845",
        "From": "Milan Zamazal <mzamazal@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Milan Zamazal <mzamazal@redhat.com>",
        "Subject": "[RFC PATCH v2 02/14] libcamera: software_isp: Introduce arguments\n\tfor parameters buffers",
        "Date": "Mon, 16 Feb 2026 21:30:21 +0100",
        "Message-ID": "<20260216203034.27558-3-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": "aSVcvaSdaFnord6MnUnGx4bItifpnJ3I6egYBDLx93E_1771273845",
        "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": "Processing parameters in software ISP are currently passed by value.\nThis is unlike hardware pipelines, which use a ring of buffers for the\npurpose and pass references to the buffers currently selected from the\nring rather than passing the whole parameters buffers.\n\nThis is a preparatory patch to introduce a similar mechanism in software\nISP, in order to resolve TODO #5.  It adds a new argument paramsBufferId\nfor the future parameters buffer ids passed to the calls.  The buffer\nids must be passed to the following groups of methods:\n\n- IPASoftSimple::prepare, in order to create the parameters in the given\n  buffer for the corresponding frame processing.\n\n- SoftwareIsp::saveParams, in order to signal that the parameters are\n  set by the IPA.\n\n- Debayer::process, in order to get the buffer with the processing\n  parameters.\n\n- SoftwareIsp::releaseIspParams, in order to signal that the selected\n  parameters buffer from the ring is no longer needed for the given\n  frame and can be reused.  This is a newly introduced signal.\n\nThe type of the buffer id parameter is set to uint32_t because:\n\n- It can be used in mojom.\n- It is consistent with the similar types in the hardware pipelines.\n- It covers file descriptor number range, which will be used as buffer\n  ids (more on this in followup patches).\n\nThis patch doesn't do more than adding the arguments, to keep the patch\nsimple.  The buffer handling will be implemented in the followup\npatches.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n .../libcamera/internal/software_isp/software_isp.h  |  3 ++-\n include/libcamera/ipa/soft.mojom                    |  4 ++--\n src/ipa/simple/soft_simple.cpp                      |  9 ++++++---\n src/libcamera/software_isp/debayer.cpp              |  6 +++++-\n src/libcamera/software_isp/debayer.h                |  6 +++++-\n src/libcamera/software_isp/debayer_cpu.cpp          |  6 +++++-\n src/libcamera/software_isp/debayer_cpu.h            |  4 +++-\n src/libcamera/software_isp/debayer_egl.cpp          |  5 ++++-\n src/libcamera/software_isp/debayer_egl.h            |  4 +++-\n src/libcamera/software_isp/software_isp.cpp         | 13 ++++++++++---\n 10 files changed, 45 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 2ec14a3c7..30b25cddf 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -88,7 +88,8 @@ public:\n \tSignal<const ControlList &> setSensorControls;\n \n private:\n-\tvoid saveIspParams();\n+\tvoid saveIspParams(uint32_t paramsBufferId);\n+\tvoid releaseIspParams(uint32_t paramsBufferId);\n \tvoid setSensorCtrls(const ControlList &sensorControls);\n \tvoid statsReady(uint32_t frame, uint32_t bufferId);\n \tvoid inputReady(FrameBuffer *input);\ndiff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom\nindex 77328c5fd..f37c1e747 100644\n--- a/include/libcamera/ipa/soft.mojom\n+++ b/include/libcamera/ipa/soft.mojom\n@@ -25,7 +25,7 @@ interface IPASoftInterface {\n \t\t=> (int32 ret);\n \n \t[async] queueRequest(uint32 frame, libcamera.ControlList sensorControls);\n-\t[async] computeParams(uint32 frame);\n+\t[async] computeParams(uint32 frame, uint32 paramsBufferId);\n \t[async] processStats(uint32 frame,\n \t\t\t     uint32 bufferId,\n \t\t\t     libcamera.ControlList sensorControls);\n@@ -33,6 +33,6 @@ interface IPASoftInterface {\n \n interface IPASoftEventInterface {\n \tsetSensorControls(libcamera.ControlList sensorControls);\n-\tsetIspParams();\n+\tsetIspParams(uint32 paramsBufferId);\n \tmetadataReady(uint32 frame, libcamera.ControlList metadata);\n };\ndiff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex 6bef597c8..1e8b5334c 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -64,7 +64,9 @@ public:\n \tvoid stop() override;\n \n \tvoid queueRequest(const uint32_t frame, const ControlList &controls) override;\n-\tvoid computeParams(const uint32_t frame) override;\n+\tvoid computeParams(const uint32_t frame,\n+\t\t\t   const uint32_t\n+\t\t\t\t   paramsBufferId) override;\n \tvoid processStats(const uint32_t frame, const uint32_t bufferId,\n \t\t\t  const ControlList &sensorControls) override;\n \n@@ -283,7 +285,8 @@ void IPASoftSimple::queueRequest(const uint32_t frame, const ControlList &contro\n \t\talgo->queueRequest(context_, frame, frameContext, controls);\n }\n \n-void IPASoftSimple::computeParams(const uint32_t frame)\n+void IPASoftSimple::computeParams(const uint32_t frame,\n+\t\t\t\t  const uint32_t paramsBufferId)\n {\n \tcontext_.activeState.combinedMatrix = Matrix<float, 3, 3>::identity();\n \n@@ -292,7 +295,7 @@ void IPASoftSimple::computeParams(const uint32_t frame)\n \t\talgo->prepare(context_, frame, frameContext, params_);\n \tparams_->combinedMatrix = context_.activeState.combinedMatrix;\n \n-\tsetIspParams.emit();\n+\tsetIspParams.emit(paramsBufferId);\n }\n \n void IPASoftSimple::processStats(const uint32_t frame,\ndiff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nindex dccdd86b4..e2e294d3e 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -105,9 +105,10 @@ Debayer::~Debayer()\n  */\n \n /**\n- * \\fn void Debayer::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params)\n+ * \\fn void Debayer::process(uint32_t frame, const uint32_t paramsBufferId, FrameBuffer *input, FrameBuffer *output, DebayerParams params)\n  * \\brief Process the bayer data into the requested format\n  * \\param[in] frame The frame number\n+ * \\param[in] paramsBufferId The id of the params buffer in use\n  * \\param[in] input The input buffer\n  * \\param[in] output The output buffer\n  * \\param[in] params The parameters to be used in debayering\n@@ -176,6 +177,9 @@ Debayer::~Debayer()\n  *\n  * \\var Debayer::DebayerInputConfig::outputFormats\n  * List of pixel formats supported as output for this input configuration.\n+ *\n+ * \\var Signal<uint32_t> Debayer::releaseIspParams\n+ * \\brief Signals when the processing params are no longer needed\n  */\n \n /**\ndiff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex ce9350b7b..0c9627d30 100644\n--- a/src/libcamera/software_isp/debayer.h\n+++ b/src/libcamera/software_isp/debayer.h\n@@ -47,7 +47,10 @@ public:\n \tvirtual std::tuple<unsigned int, unsigned int>\n \tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0;\n \n-\tvirtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params) = 0;\n+\tvirtual void process(uint32_t frame,\n+\t\t\t     const uint32_t paramsBufferId,\n+\t\t\t     FrameBuffer *input, FrameBuffer *output,\n+\t\t\t     const DebayerParams &params) = 0;\n \tvirtual int start() { return 0; }\n \tvirtual void stop() {}\n \n@@ -59,6 +62,7 @@ public:\n \n \tSignal<FrameBuffer *> inputBufferReady;\n \tSignal<FrameBuffer *> outputBufferReady;\n+\tSignal<uint32_t> releaseIspParams;\n \n \tstruct DebayerInputConfig {\n \t\tSize patternSize;\ndiff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\nindex d09883577..5d0e780f7 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -842,7 +842,9 @@ void DebayerCpu::updateLookupTables(const DebayerParams &params)\n \tparams_ = params;\n }\n \n-void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params)\n+void DebayerCpu::process(uint32_t frame, const uint32_t paramsBufferId,\n+\t\t\t FrameBuffer *input, FrameBuffer *output,\n+\t\t\t const DebayerParams &params)\n {\n \tbench_.startFrame();\n \n@@ -852,6 +854,8 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \n \tupdateLookupTables(params);\n \n+\treleaseIspParams.emit(paramsBufferId);\n+\n \t/* Copy metadata from the input buffer */\n \tFrameMetadata &metadata = output->_d()->metadata();\n \tmetadata.status = input->metadata().status;\ndiff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\nindex 7a6517462..13253f999 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -39,7 +39,9 @@ public:\n \tstd::vector<PixelFormat> formats(PixelFormat input);\n \tstd::tuple<unsigned int, unsigned int>\n \tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size);\n-\tvoid process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params);\n+\tvoid process(uint32_t frame,\n+\t\t     const uint32_t paramsBufferId,\n+\t\t     FrameBuffer *input, FrameBuffer *output, const DebayerParams &params);\n \tSizeRange sizes(PixelFormat inputFormat, const Size &inputSize);\n \tconst SharedFD &getStatsFD() { return stats_->getStatsFD(); }\n \ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex 93f7c6946..947c05c07 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -533,7 +533,9 @@ int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParam\n \treturn 0;\n }\n \n-void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params)\n+void DebayerEGL::process(uint32_t frame, const uint32_t paramsBufferId,\n+\t\t\t FrameBuffer *input, FrameBuffer *output,\n+\t\t\t const DebayerParams &params)\n {\n \tbench_.startFrame();\n \n@@ -557,6 +559,7 @@ void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \t\tLOG(Debayer, Error) << \"debayerGPU failed\";\n \t\tgoto error;\n \t}\n+\treleaseIspParams.emit(paramsBufferId);\n \n \tbench_.finishFrame();\n \ndiff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h\nindex 59aebcc81..7f29f53e6 100644\n--- a/src/libcamera/software_isp/debayer_egl.h\n+++ b/src/libcamera/software_isp/debayer_egl.h\n@@ -50,7 +50,9 @@ public:\n \tstd::vector<PixelFormat> formats(PixelFormat input);\n \tstd::tuple<unsigned int, unsigned int> strideAndFrameSize(const PixelFormat &outputFormat, const Size &size);\n \n-\tvoid process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params);\n+\tvoid process(uint32_t frame, const uint32_t paramsBufferId,\n+\t\t     FrameBuffer *input, FrameBuffer *output,\n+\t\t     const DebayerParams &params);\n \tint start();\n \tvoid stop();\n \ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex a83986b78..0447d2171 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -123,6 +123,7 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n \n \tdebayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady);\n \tdebayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady);\n+\tdebayer_->releaseIspParams.connect(this, &SoftwareIsp::releaseIspParams);\n \n \tipa_ = IPAManager::createIPA<ipa::soft::IPAProxySoft>(pipe, 0, 0);\n \tif (!ipa_) {\n@@ -396,16 +397,22 @@ void SoftwareIsp::stop()\n  */\n void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output)\n {\n-\tipa_->computeParams(frame);\n+\t/* \\todo Provide a real value */\n+\tconstexpr uint32_t paramsBufferId = 0;\n+\tipa_->computeParams(frame, paramsBufferId);\n \tdebayer_->invokeMethod(&Debayer::process,\n-\t\t\t       ConnectionTypeQueued, frame, input, output, debayerParams_);\n+\t\t\t       ConnectionTypeQueued, frame, paramsBufferId, input, output, debayerParams_);\n }\n \n-void SoftwareIsp::saveIspParams()\n+void SoftwareIsp::saveIspParams([[maybe_unused]] uint32_t paramsBufferId)\n {\n \tdebayerParams_ = *sharedParams_;\n }\n \n+void SoftwareIsp::releaseIspParams([[maybe_unused]] uint32_t paramsBufferId)\n+{\n+}\n+\n void SoftwareIsp::setSensorCtrls(const ControlList &sensorControls)\n {\n \tsetSensorControls.emit(sensorControls);\n",
    "prefixes": [
        "RFC",
        "v2",
        "02/14"
    ]
}