Patch Detail
Show a patch.
GET /api/patches/27158/?format=api
{ "id": 27158, "url": "https://patchwork.libcamera.org/api/patches/27158/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27158/", "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": "<20260702152434.1123571-1-stefan.klug@ideasonboard.com>", "date": "2026-07-02T15:24:27", "name": "[RFC] ipa: rkisp1: lsc: Workaround ISP stalls when toggling LSC", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "88dafdecd7a75bc8538e30aa3e10ea42bbb83b3d", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27158/mbox/", "series": [ { "id": 6034, "url": "https://patchwork.libcamera.org/api/series/6034/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6034", "date": "2026-07-02T15:24:27", "name": "[RFC] ipa: rkisp1: lsc: Workaround ISP stalls when toggling LSC", "version": 1, "mbox": "https://patchwork.libcamera.org/series/6034/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/27158/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27158/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 12EF6C3302\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 2 Jul 2026 15:24:42 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1ECF165FBB;\n\tThu, 2 Jul 2026 17:24:41 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 34AFD65FB6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 2 Jul 2026 17:24:39 +0200 (CEST)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:15a:f743:880f:9f16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7647B3A2;\n\tThu, 2 Jul 2026 17:23:53 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mkNbOwdF\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783005833;\n\tbh=jmZu/4wAGs8iSqb02ZacH8F6EtEiCasfAgf/6hWah2U=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=mkNbOwdFzZI2r25xzBORKMm8GTb1Jt376xZ9BFER6sNwScaMRd2LDgcQDLzHPLVgg\n\tg7nXymYCprGDcvgA2Wg3xXDs6q1Fder50Jzl7OsJ3oc2bwFhh5jOKzTif4+MlHX6l0\n\tOYffLC3ecwIQYVTLtya0vDAHWSFBLmTu7aX3NGLM=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[RFC PATCH] ipa: rkisp1: lsc: Workaround ISP stalls when toggling\n\tLSC", "Date": "Thu, 2 Jul 2026 17:24:27 +0200", "Message-ID": "<20260702152434.1123571-1-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "ISP stalls were observed by repeatedly toggling the LSC enable bit. The\nprobability of a lockup is quite high and easily reproducible by\nmanually toggling the LensShadingCorrectionEnable control in camshark.\n\nAs no fix proper kernel side fix could be found, workaround the issue by\nkeeping LSC enabled and writing 1.0 to the gain table.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\nHi all,\n\nThe intention of this patch is merely to document the issue. A proper\nfix on the kernel side would definitely be preferable. But although I\nspent some time debugging the kernel interrupt handling I wasn't able to\ncome up with a fix.\n\nIt looks like enabling the LSC module is somehow racy.\n\nOne thing I was wondering but didn't spent the time to test: In the\ndriver the order of events is: RKISP1_CIF_ISP_FRAME ->\nrkisp1_params_isr() -> ... -> rkisp1_ext_params_lsc() -> \"write lsc\ntables\" and then shortly after, the next frame starts with\nRKISP1_CIF_ISP_V_START. I didn't test if writing the lsc tables actually\noverlapped with the V_START signal. Should we possibly write the LSC\ntables after the V_START interrupt, as these are ping pong maps anyways?\n\nBest regards,\nStefan\n\n---\n\n src/ipa/rkisp1/algorithms/lsc.cpp | 23 +++++++++++++++++++----\n 1 file changed, 19 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex faf88effde01..251a2714b617 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -532,13 +532,28 @@ void LensShadingCorrection::prepare([[maybe_unused]] IPAContext &context,\n \t}\n \n \tauto config = params->block<BlockType::Lsc>();\n-\tconfig.setEnabled(frameContext.lsc.enabled);\n-\n-\tif (!frameContext.lsc.enabled)\n-\t\treturn;\n+\t/*\n+\t * ISP lockups were observed when toggling the LSC enable bit\n+\t * repeatedly. There is no known kernel side fix. Workaround the issue\n+\t * by leaving lsc enabled all the time and setting the gain values to\n+\t * 1.0 in case lsc should be disabled.\n+\t */\n+\tconfig.setEnabled(true);\n \n \tsetParameters(*config);\n \n+\tif (!frameContext.lsc.enabled) {\n+\t\tfor (int i = 0; i < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; i++) {\n+\t\t\tfor (int j = 0; j < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; j++) {\n+\t\t\t\tconfig->r_data_tbl[i][j] = 1024;\n+\t\t\t\tconfig->gr_data_tbl[i][j] = 1024;\n+\t\t\t\tconfig->gb_data_tbl[i][j] = 1024;\n+\t\t\t\tconfig->b_data_tbl[i][j] = 1024;\n+\t\t\t}\n+\t\t}\n+\t\treturn;\n+\t}\n+\n \tconst Components &set = sets_.getInterpolated(quantizedCt);\n \tcopyTable(*config, set);\n \n", "prefixes": [ "RFC" ] }