Show a patch.

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

{
    "id": 26729,
    "url": "https://patchwork.libcamera.org/api/patches/26729/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26729/",
    "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": "<20260512123619.120068-7-mzamazal@redhat.com>",
    "date": "2026-05-12T12:36:10",
    "name": "[RFC,v5,06/10] libcamera: software_isp: Pass LSC availability to debayering",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "dd4e9b81e37a957be3a70c0a8af5362cf184e6f5",
    "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/26729/mbox/",
    "series": [
        {
            "id": 5936,
            "url": "https://patchwork.libcamera.org/api/series/5936/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5936",
            "date": "2026-05-12T12:36:04",
            "name": "LSC for SoftISP simple pipeline",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/5936/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26729/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26729/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 D3F10BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 May 2026 12:36:58 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5BB5E6303E;\n\tTue, 12 May 2026 14:36:58 +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 A6A6A63025\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 May 2026 14:36:54 +0200 (CEST)",
            "from mx-prod-mc-08.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-217-EHmrmKDwNo28G49owUugRA-1;\n\tTue, 12 May 2026 08:36:50 -0400",
            "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.17])\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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id DB4FB18002E3; Tue, 12 May 2026 12:36:48 +0000 (UTC)",
            "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.50.44])\n\tby mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 287901955D84; Tue, 12 May 2026 12:36:46 +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=\"LSsV1pQI\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1778589413;\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=ZRdwGsrVqJLKipOBXvy9PWGzIQYZpHLKh2ZirRSbtWc=;\n\tb=LSsV1pQIGgg3MEHH79njSyVwAJvXYOjEkmtbuHueGkFFdQNIH80KIse7sVGwDya6nXDE60\n\tB8aiBQO2krBhWvksIGpud4JNAX8XKbeUZBBC57gGjZZpUcswHARxaIOyVEYpDIIXQMYZ8q\n\tl7dmovRK3eytCRNX+7V+jInqmXbYAHM=",
        "X-MC-Unique": "EHmrmKDwNo28G49owUugRA-1",
        "X-Mimecast-MFC-AGG-ID": "EHmrmKDwNo28G49owUugRA_1778589409",
        "From": "Milan Zamazal <mzamazal@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Milan Zamazal <mzamazal@redhat.com>, Bryan O'Donoghue <bod.linux@nxsw.ie>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Subject": "[RFC PATCH v5 06/10] libcamera: software_isp: Pass LSC availability\n\tto debayering",
        "Date": "Tue, 12 May 2026 14:36:10 +0200",
        "Message-ID": "<20260512123619.120068-7-mzamazal@redhat.com>",
        "In-Reply-To": "<20260512123619.120068-1-mzamazal@redhat.com>",
        "References": "<20260512123619.120068-1-mzamazal@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "BHL4GqvRpOVuM_dEN2_xXRHW7kZJcMjRjMwFW3epGuY_1778589409",
        "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": "The lens shading algorithm may or may not be enabled in the tuning file.\nDebayering configuration needs this information to arrange things\naccordingly, e.g. to set up shader parameters.\n\nLet's add a corresponding flag that is set in the LSC algorithm (if\npresent) and passed to Debayer::configure.  This is similar to what we\nalready do with CCM availability.\n\nThe flag is ignored by CPU ISP, where LSC is not going to be implemented\nfor now.\n\nReviewed-by: Bryan O'Donoghue <bod.linux@nxsw.ie>\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n include/libcamera/internal/software_isp/software_isp.h | 1 +\n include/libcamera/ipa/soft.mojom                       | 4 +++-\n src/ipa/simple/algorithms/lsc.cpp                      | 4 +++-\n src/ipa/simple/ipa_context.h                           | 1 +\n src/ipa/simple/soft_simple.cpp                         | 7 +++++--\n src/libcamera/software_isp/debayer.cpp                 | 1 +\n src/libcamera/software_isp/debayer.h                   | 3 ++-\n src/libcamera/software_isp/debayer_cpu.cpp             | 3 ++-\n src/libcamera/software_isp/debayer_cpu.h               | 3 ++-\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            | 5 +++--\n 12 files changed, 30 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nindex 86cb8f8de..1e30b2d68 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -99,6 +99,7 @@ private:\n \tDebayerParams debayerParams_;\n \tDmaBufAllocator dmaHeap_;\n \tbool ccmEnabled_;\n+\tbool lscEnabled_;\n \n \tstd::unique_ptr<ipa::soft::IPAProxySoft> ipa_;\n \tstd::deque<FrameBuffer *> queuedInputBuffers_;\ndiff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom\nindex 77328c5fd..aaefd50c4 100644\n--- a/include/libcamera/ipa/soft.mojom\n+++ b/include/libcamera/ipa/soft.mojom\n@@ -18,7 +18,9 @@ interface IPASoftInterface {\n \t     libcamera.SharedFD fdParams,\n \t     libcamera.IPACameraSensorInfo sensorInfo,\n \t     libcamera.ControlInfoMap sensorControls)\n-\t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls, bool ccmEnabled);\n+\t\t=> (int32 ret,\n+\t\t    libcamera.ControlInfoMap ipaControls,\n+\t\t    bool ccmEnabled, bool lscEnabled);\n \tstart() => (int32 ret);\n \tstop();\n \tconfigure(IPAConfigInfo configInfo)\ndiff --git a/src/ipa/simple/algorithms/lsc.cpp b/src/ipa/simple/algorithms/lsc.cpp\nindex fac774481..4b821005f 100644\n--- a/src/ipa/simple/algorithms/lsc.cpp\n+++ b/src/ipa/simple/algorithms/lsc.cpp\n@@ -15,7 +15,7 @@ namespace ipa::soft::algorithms {\n \n LOG_DEFINE_CATEGORY(IPASoftLsc)\n \n-int Lsc::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)\n+int Lsc::init(IPAContext &context, const ValueNode &tuningData)\n {\n \tint retR = lscR_.readYaml(tuningData[\"sets\"], \"ct\", \"r\");\n \tint retG = lscG_.readYaml(tuningData[\"sets\"], \"ct\", \"g\");\n@@ -27,6 +27,8 @@ int Lsc::init([[maybe_unused]] IPAContext &context, const ValueNode &tuningData)\n \t\treturn -EINVAL;\n \t}\n \n+\tcontext.lscEnabled = true;\n+\n \treturn 0;\n }\n \ndiff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\nindex c4bd91bb0..d77bbc280 100644\n--- a/src/ipa/simple/ipa_context.h\n+++ b/src/ipa/simple/ipa_context.h\n@@ -93,6 +93,7 @@ struct IPAContext {\n \tFCQueue<IPAFrameContext> frameContexts;\n \tControlInfoMap::Map ctrlMap;\n \tbool ccmEnabled = false;\n+\tbool lscEnabled = false;\n };\n \n } /* namespace ipa::soft */\ndiff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex 629e1a32d..4c724183a 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -57,7 +57,8 @@ public:\n \t\t const IPACameraSensorInfo &sensorInfo,\n \t\t const ControlInfoMap &sensorControls,\n \t\t ControlInfoMap *ipaControls,\n-\t\t bool *ccmEnabled) override;\n+\t\t bool *ccmEnabled,\n+\t\t bool *lscEnabled) override;\n \tint configure(const IPAConfigInfo &configInfo) override;\n \n \tint start() override;\n@@ -97,7 +98,8 @@ int IPASoftSimple::init(const IPASettings &settings,\n \t\t\tconst IPACameraSensorInfo &sensorInfo,\n \t\t\tconst ControlInfoMap &sensorControls,\n \t\t\tControlInfoMap *ipaControls,\n-\t\t\tbool *ccmEnabled)\n+\t\t\tbool *ccmEnabled,\n+\t\t\tbool *lscEnabled)\n {\n \tcamHelper_ = CameraSensorHelperFactoryBase::create(settings.sensorModel);\n \tif (!camHelper_) {\n@@ -136,6 +138,7 @@ int IPASoftSimple::init(const IPASettings &settings,\n \t\treturn ret;\n \n \t*ccmEnabled = context_.ccmEnabled;\n+\t*lscEnabled = context_.lscEnabled;\n \n \tparams_ = nullptr;\n \tstats_ = nullptr;\ndiff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nindex d91a7aff5..76c66e55b 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -99,6 +99,7 @@ Debayer::~Debayer()\n  * \\param[in] inputCfg The input configuration\n  * \\param[in] outputCfgs The output configurations\n  * \\param[in] ccmEnabled Whether a color correction matrix is applied\n+ * \\param[in] lscEnabled Whether lens shading correction grid is provided\n  *\n  * \\return 0 on success, a negative errno on failure\n  */\ndiff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex a2a17ec18..f4e649417 100644\n--- a/src/libcamera/software_isp/debayer.h\n+++ b/src/libcamera/software_isp/debayer.h\n@@ -40,7 +40,8 @@ public:\n \n \tvirtual int configure(const StreamConfiguration &inputCfg,\n \t\t\t      const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs,\n-\t\t\t      bool ccmEnabled) = 0;\n+\t\t\t      bool ccmEnabled,\n+\t\t\t      bool lscEnabled) = 0;\n \n \tvirtual std::vector<PixelFormat> formats(PixelFormat inputFormat) = 0;\n \ndiff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\nindex 1f9b24da0..0a410d03d 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -543,7 +543,8 @@ int DebayerCpu::setDebayerFunctions(PixelFormat inputFormat,\n \n int DebayerCpu::configure(const StreamConfiguration &inputCfg,\n \t\t\t  const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs,\n-\t\t\t  bool ccmEnabled)\n+\t\t\t  bool ccmEnabled,\n+\t\t\t  [[maybe_unused]] bool lscEnabled)\n {\n \tif (getInputConfig(inputCfg.pixelFormat, inputConfig_) != 0)\n \t\treturn -EINVAL;\ndiff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\nindex 68da95083..6b7d8b677 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -37,7 +37,8 @@ public:\n \n \tint configure(const StreamConfiguration &inputCfg,\n \t\t      const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs,\n-\t\t      bool ccmEnabled) override;\n+\t\t      bool ccmEnabled,\n+\t\t      bool lscEnabled) override;\n \tSize patternSize(PixelFormat inputFormat) override;\n \tstd::vector<PixelFormat> formats(PixelFormat input) override;\n \tstd::tuple<unsigned int, unsigned int>\ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex 866592547..dc77d0ac6 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -282,7 +282,8 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm\n \n int DebayerEGL::configure(const StreamConfiguration &inputCfg,\n \t\t\t  const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs,\n-\t\t\t  [[maybe_unused]] bool ccmEnabled)\n+\t\t\t  [[maybe_unused]] bool ccmEnabled,\n+\t\t\t  bool lscEnabled)\n {\n \tif (getInputConfig(inputCfg.pixelFormat, inputConfig_) != 0)\n \t\treturn -EINVAL;\n@@ -299,6 +300,8 @@ int DebayerEGL::configure(const StreamConfiguration &inputCfg,\n \t\treturn -EINVAL;\n \t}\n \n+\tlscEnabled_ = lscEnabled;\n+\n \tinputConfig_.stride = inputCfg.stride;\n \tinputPixelFormat_ = inputCfg.pixelFormat;\n \twidth_ = inputCfg.size.width;\ndiff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h\nindex 141fb288f..3f5db355a 100644\n--- a/src/libcamera/software_isp/debayer_egl.h\n+++ b/src/libcamera/software_isp/debayer_egl.h\n@@ -44,7 +44,8 @@ public:\n \n \tint configure(const StreamConfiguration &inputCfg,\n \t\t      const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs,\n-\t\t      bool ccmEnabled) override;\n+\t\t      bool ccmEnabled,\n+\t\t      bool lscEnabled) override;\n \n \tSize patternSize(PixelFormat inputFormat) override;\n \n@@ -76,6 +77,7 @@ private:\n \tstd::unique_ptr<eGLImage> eglImageBayerIn_;\n \tstd::unique_ptr<eGLImage> eglImageBayerOut_;\n \n+\tbool lscEnabled_;\n \t/* Shader parameters */\n \tfloat firstRed_x_;\n \tfloat firstRed_y_;\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex 781cf02f8..e35bf10f1 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -157,7 +157,8 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n \t\t\t sensorInfo,\n \t\t\t sensor->controls(),\n \t\t\t ipaControls,\n-\t\t\t &ccmEnabled_);\n+\t\t\t &ccmEnabled_,\n+\t\t\t &lscEnabled_);\n \tif (ret) {\n \t\tLOG(SoftwareIsp, Error) << \"IPA init failed\";\n \t\tdebayer_.reset();\n@@ -273,7 +274,7 @@ int SoftwareIsp::configure(const StreamConfiguration &inputCfg,\n \tif (ret < 0)\n \t\treturn ret;\n \n-\tret = debayer_->configure(inputCfg, outputCfgs, ccmEnabled_);\n+\tret = debayer_->configure(inputCfg, outputCfgs, ccmEnabled_, lscEnabled_);\n \tif (ret < 0)\n \t\treturn ret;\n \n",
    "prefixes": [
        "RFC",
        "v5",
        "06/10"
    ]
}