Patch Detail
Show a patch.
GET /api/1.1/patches/26526/?format=api
{ "id": 26526, "url": "https://patchwork.libcamera.org/api/1.1/patches/26526/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26526/", "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": "<20260420183949.110548-7-mzamazal@redhat.com>", "date": "2026-04-20T18:39:44", "name": "[RFC,v2,6/8] libcamera: software_isp: Pass LSC availability to debayering", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "47d06a24ce06f5abd07fdfda1d757cafc042ca64", "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/26526/mbox/", "series": [ { "id": 5883, "url": "https://patchwork.libcamera.org/api/1.1/series/5883/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5883", "date": "2026-04-20T18:39:38", "name": "LSC for SoftISP simple pipeline", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5883/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26526/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26526/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 C977DBDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Apr 2026 18:40:18 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8432F62EEF;\n\tMon, 20 Apr 2026 20:40:18 +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 D022262EEF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Apr 2026 20:40:15 +0200 (CEST)", "from mx-prod-mc-03.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-57-BQQD4NWFMo-TEB2nzgA1qw-1;\n\tMon, 20 Apr 2026 14:40:13 -0400", "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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 68AEC1956065; Mon, 20 Apr 2026 18:40:12 +0000 (UTC)", "from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.48.16])\n\tby mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id EF2ED180057E; Mon, 20 Apr 2026 18:40:10 +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=\"Gg9wm3NT\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1776710414;\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=tGG/3sDD8prPLPiC/4iWGx+QFL+iFkSGB+ZJcJDQvk0=;\n\tb=Gg9wm3NTKEHieIhLGLqsdhrDVhupLrEklkf2IbSir1ZtVnEPpZ+0bLXmjuK3sAjwFhSs0G\n\tje+AfMHZ+InhNQVXOl4aFXSEzK6WzHyikQMuaxv2B9935Ai00P2EclpYdY43p15DM0b1r4\n\tKZJP29RtSLnFGhpeAwVebkO6UCbYGPM=", "X-MC-Unique": "BQQD4NWFMo-TEB2nzgA1qw-1", "X-Mimecast-MFC-AGG-ID": "BQQD4NWFMo-TEB2nzgA1qw_1776710412", "From": "Milan Zamazal <mzamazal@redhat.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tHans de Goede <johannes.goede@oss.qualcomm.com>", "Subject": "[RFC PATCH v2 6/8] libcamera: software_isp: Pass LSC availability to\n\tdebayering", "Date": "Mon, 20 Apr 2026 20:39:44 +0200", "Message-ID": "<20260420183949.110548-7-mzamazal@redhat.com>", "In-Reply-To": "<20260420183949.110548-1-mzamazal@redhat.com>", "References": "<20260420183949.110548-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": "jXez5mrHex5EmwaxkJLBCXktLTxsWZA9WGXtvEk0H5E_1776710412", "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\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 585e0d6d9..f9bda25bd 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -100,6 +100,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 9588dc95d..e52a766d2 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 YamlObject &tuningData)\n+int Lsc::init(IPAContext &context, const YamlObject &tuningData)\n {\n \tint ret_r = lscR.readYaml(tuningData[\"grids\"], \"ct\", \"r\");\n \tint ret_g = lscG.readYaml(tuningData[\"grids\"], \"ct\", \"g\");\n@@ -27,6 +27,8 @@ int Lsc::init([[maybe_unused]] IPAContext &context, const YamlObject &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 7d25bdd26..8c7e71b22 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 b60ebcd9b..edfe313c0 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -91,6 +91,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 ea1ec6dcf..32ffc26f6 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 dd0fff871..b9656da0a 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -541,7 +541,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 05fecc8fe..f3be1222d 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -36,7 +36,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);\n+\t\t bool ccmEnabled,\n+\t\t bool lscEnabled);\n \tSize patternSize(PixelFormat inputFormat);\n \tstd::vector<PixelFormat> formats(PixelFormat input);\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 08e513eaf..399915164 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -278,7 +278,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@@ -295,6 +296,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 bdde676f2..f96077af5 100644\n--- a/src/libcamera/software_isp/debayer_egl.h\n+++ b/src/libcamera/software_isp/debayer_egl.h\n@@ -43,7 +43,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);\n+\t\t bool ccmEnabled,\n+\t\t bool lscEnabled);\n \n \tSize patternSize(PixelFormat inputFormat);\n \n@@ -84,6 +85,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 60228369f..798a06969 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -155,7 +155,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@@ -271,7 +272,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", "v2", "6/8" ] }