Patch Detail
Show a patch.
GET /api/1.1/patches/25674/?format=api
{ "id": 25674, "url": "https://patchwork.libcamera.org/api/1.1/patches/25674/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25674/", "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": "<20260106170059.56193-21-bryan.odonoghue@linaro.org>", "date": "2026-01-06T17:00:55", "name": "[v11,20/24] libcamera: software_isp: lut: Skip calculation lookup tables if gpuIspEnabled is true", "commit_ref": "43180e12bac330ab872e24c2a896a15df6e6fa92", "pull_url": null, "state": "accepted", "archived": false, "hash": "d3620371c1f2821862d158b1f3904242292e599f", "submitter": { "id": 175, "url": "https://patchwork.libcamera.org/api/1.1/people/175/?format=api", "name": "Bryan O'Donoghue", "email": "bryan.odonoghue@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25674/mbox/", "series": [ { "id": 5689, "url": "https://patchwork.libcamera.org/api/1.1/series/5689/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5689", "date": "2026-01-06T17:00:35", "name": "Add GLES 2.0 GPUISP to libcamera", "version": 10, "mbox": "https://patchwork.libcamera.org/series/5689/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25674/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25674/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 7817FC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 6 Jan 2026 17:01:32 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 21E6962033;\n\tTue, 6 Jan 2026 18:01:32 +0100 (CET)", "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C78CB6201C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 6 Jan 2026 18:01:29 +0100 (CET)", "by mail-wm1-x329.google.com with SMTP id\n\t5b1f17b1804b1-47bdbc90dcaso8809785e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 06 Jan 2026 09:01:29 -0800 (PST)", "from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-432bd0dadcfsm5515322f8f.3.2026.01.06.09.01.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 06 Jan 2026 09:01:27 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"tk54yVWa\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1767718889; x=1768323689;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=psNP2vqDkJBYOqosGTGOW6EtApQ+kyXWy6fpn8pZtNw=;\n\tb=tk54yVWaUgUYStdJWZyKiawG1Jvs/UqMFC4jkIxevPVasTsmhMptjrRcMRh0kZqHG8\n\tKTNSGC/LTnRzRQU7MWSIhCumIEjUvMSyKA/MIqJwJ4D31mIMTqa3picA7Gux+VFYssNB\n\t2+RXXlPUcrj/DL5UOxq6qgX74/hRHGiea2j1lgP2/yJV4RJ0sTaJUUIXqWBTTwclYulu\n\trrux4JYOLqYBXfTfUeS0QjVul4Qitfy1H0iQcnIgyVPZ+2Rwnh0CBHr4dZ8mIGVU3ksZ\n\t9E5g8up4g/EJy762Fk2QlFlpKBcMxxxS0RiLnOJviGzjPgSp0AhwuPzMDDzvDZzHvn5o\n\tHsxw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1767718889; x=1768323689;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=psNP2vqDkJBYOqosGTGOW6EtApQ+kyXWy6fpn8pZtNw=;\n\tb=AWDiRr/8Iwjt4T2mNTYbOu4PESyolW3xnEWtBMOOBOV6vbB9+ivuh41V2+dEwq7LRz\n\takGq4uW4eH9+nQZO6n8TN7P9+kDrt8tl90HKosE3a9Lsev758ONt3Q8/TVd0LZAGtn9B\n\tLHm49vPLBiQH6R+ULcMo4/lwIB7sbkpQsbqjogHTBXbGnVYDIUWR7nhVdpWathykJiF9\n\t1CkBNjnBJ2m2juK7hg1prNOVyW3T91HeMBIevj2hwRzZHJhNnk0G75t2RJqYUk+9LSYV\n\tnlyJhG0YAGvEbGsk3fxi10tvb424H0KyZj6K7ifZO9teY7UyJ9I2KC23f0rvti+cVmS+\n\tXxdQ==", "X-Gm-Message-State": "AOJu0YyLA8BpNxociNu5ZKmXnHKs+9VVb6hHRF/WhvIniv/PVBKuTvQr\n\t1PneAx058/DK35mYyfs+1rYS4n2J/T0O673O3jLlK5ZxDdS+QmXaovIbXythLYeKW4Oe7GSxp+1\n\tuL5vxESQ=", "X-Gm-Gg": "AY/fxX5r6Ca+yG/nXciW96fziiwirRfUcFSpiu/Dz7rhZk6Pqtd10OJSTZawviD3Xjy\n\tTt23XHLDsa49U+zuAChINgvFYE75WBYtgm4/oZ4GFVKbhUhRgZvFf87xJ0F/Dm43GtsiQ/91o2r\n\t34WuEUoEjz1LCze2DWWv9+EbyIvhNjrnjpxuMOE58TqfXBlRgveSGqrbubc7W7DH3yftNz54lUe\n\tdsVyMc3Q6ooAaoN/2aLtHYqiUp10n8mznFDrAHrvCsPF2t9nM9+j7QUtrHdJRj7s7z6Nuy+Yg0f\n\tNv5oVVaIQlto88Hm8SK8WHJZw9AJBCrMMIUw2HqUI3ZBAIKsHU24XRI6ic0+ElQeKw9fYm6qMCn\n\tFS9/61sijhZJHnyN+tAwUXLE3BgHj1/sH4Dj2Vkgjv7BzTVNIqMcJkK5OHQzP5XqM899XoG3RkX\n\trHPD1x7ZuWfVLUdd5A1Z4uRxCoesAj22gVh1B4ab/Ux/xNR2Dfx/r3qoKYG6EWB4Itw10=", "X-Google-Smtp-Source": "AGHT+IHQAMRlOnKgd/tLsYCT9fskVYUJH3wDT3/4tugoJhXY8VAKQ+2NQJOTimyBAPOibVneTJsgnQ==", "X-Received": "by 2002:a05:600c:1d24:b0:479:2a09:9262 with SMTP id\n\t5b1f17b1804b1-47d7f077676mr41871795e9.9.1767718887582; \n\tTue, 06 Jan 2026 09:01:27 -0800 (PST)", "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "pavel@ucw.cz, Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tMilan Zamazal <mzamazal@redhat.com>", "Subject": "[PATCH v11 20/24] libcamera: software_isp: lut: Skip calculation\n\tlookup tables if gpuIspEnabled is true", "Date": "Tue, 6 Jan 2026 17:00:55 +0000", "Message-ID": "<20260106170059.56193-21-bryan.odonoghue@linaro.org>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260106170059.56193-1-bryan.odonoghue@linaro.org>", "References": "<20260106170059.56193-1-bryan.odonoghue@linaro.org>", "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": "On my reference platform Qualcomm RB5 sm8520 the qcam application CPU\noccupancy drops from ~100% to about 95% of a single core so this one change\nsheds aprox 5% CPU usage.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/ipa/simple/algorithms/lut.cpp | 67 ++++++++++++++++---------------\n 1 file changed, 35 insertions(+), 32 deletions(-)", "diff": "diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp\nindex 7d015ac89..7418daa1e 100644\n--- a/src/ipa/simple/algorithms/lut.cpp\n+++ b/src/ipa/simple/algorithms/lut.cpp\n@@ -56,33 +56,34 @@ void Lut::queueRequest(typename Module::Context &context,\n \n void Lut::updateGammaTable(IPAContext &context)\n {\n-\tauto &gammaTable = context.activeState.gamma.gammaTable;\n \tconst auto blackLevel = context.activeState.blc.level;\n-\tconst unsigned int blackIndex = blackLevel * gammaTable.size() / 256;\n \tconst auto contrast = context.activeState.knobs.contrast.value_or(1.0);\n \t/* Convert 0..2 to 0..infinity; avoid actual inifinity at tan(pi/2) */\n \tdouble contrastExp = tan(std::clamp(contrast * M_PI_4, 0.0, M_PI_2 - 0.00001));\n \n-\tconst float divisor = gammaTable.size() - blackIndex - 1.0;\n-\tfor (unsigned int i = blackIndex; i < gammaTable.size(); i++) {\n-\t\tdouble normalized = (i - blackIndex) / divisor;\n-\t\t/* Convert 0..2 to 0..infinity; avoid actual inifinity at tan(pi/2) */\n-\t\t/* Apply simple S-curve */\n-\t\tif (normalized < 0.5)\n-\t\t\tnormalized = 0.5 * std::pow(normalized / 0.5, contrastExp);\n-\t\telse\n-\t\t\tnormalized = 1.0 - 0.5 * std::pow((1.0 - normalized) / 0.5, contrastExp);\n-\t\tgammaTable[i] = UINT8_MAX *\n-\t\t\t\tstd::pow(normalized, context.configuration.gamma);\n+\tif (!context.gpuIspEnabled) {\n+\t\tauto &gammaTable = context.activeState.gamma.gammaTable;\n+\t\tconst unsigned int blackIndex = blackLevel * gammaTable.size() / 256;\n+\t\tconst float divisor = gammaTable.size() - blackIndex - 1.0;\n+\t\tfor (unsigned int i = blackIndex; i < gammaTable.size(); i++) {\n+\t\t\tdouble normalized = (i - blackIndex) / divisor;\n+\t\t\t/* Apply simple S-curve */\n+\t\t\tif (normalized < 0.5)\n+\t\t\t\tnormalized = 0.5 * std::pow(normalized / 0.5, contrastExp);\n+\t\t\telse\n+\t\t\t\tnormalized = 1.0 - 0.5 * std::pow((1.0 - normalized) / 0.5, contrastExp);\n+\t\t\tgammaTable[i] = UINT8_MAX *\n+\t\t\t\t\tstd::pow(normalized, context.configuration.gamma);\n+\t\t}\n+\t\t/*\n+\t\t * Due to CCM operations, the table lookup may reach indices below the black\n+\t\t * level. Let's set the table values below black level to the minimum\n+\t\t * non-black value to prevent problems when the minimum value is\n+\t\t * significantly non-zero (for example, when the image should be all grey).\n+\t\t */\n+\t\tstd::fill(gammaTable.begin(), gammaTable.begin() + blackIndex,\n+\t\t\t gammaTable[blackIndex]);\n \t}\n-\t/*\n-\t * Due to CCM operations, the table lookup may reach indices below the black\n-\t * level. Let's set the table values below black level to the minimum\n-\t * non-black value to prevent problems when the minimum value is\n-\t * significantly non-zero (for example, when the image should be all grey).\n-\t */\n-\tstd::fill(gammaTable.begin(), gammaTable.begin() + blackIndex,\n-\t\t gammaTable[blackIndex]);\n \n \tcontext.activeState.gamma.blackLevel = blackLevel;\n \tcontext.activeState.gamma.contrastExp = contrastExp;\n@@ -135,17 +136,19 @@ void Lut::prepare(IPAContext &context,\n \t\tauto &green = params->greenCcm;\n \t\tauto &blue = params->blueCcm;\n \t\tparams->ccm = ccm;\n-\t\tfor (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {\n-\t\t\tred[i].r = ccmValue(i, ccm[0][0]);\n-\t\t\tred[i].g = ccmValue(i, ccm[1][0]);\n-\t\t\tred[i].b = ccmValue(i, ccm[2][0]);\n-\t\t\tgreen[i].r = ccmValue(i, ccm[0][1]);\n-\t\t\tgreen[i].g = ccmValue(i, ccm[1][1]);\n-\t\t\tgreen[i].b = ccmValue(i, ccm[2][1]);\n-\t\t\tblue[i].r = ccmValue(i, ccm[0][2]);\n-\t\t\tblue[i].g = ccmValue(i, ccm[1][2]);\n-\t\t\tblue[i].b = ccmValue(i, ccm[2][2]);\n-\t\t\tparams->gammaLut[i] = gammaTable[i / div];\n+\t\tif (!context.gpuIspEnabled) {\n+\t\t\tfor (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {\n+\t\t\t\tred[i].r = ccmValue(i, ccm[0][0]);\n+\t\t\t\tred[i].g = ccmValue(i, ccm[1][0]);\n+\t\t\t\tred[i].b = ccmValue(i, ccm[2][0]);\n+\t\t\t\tgreen[i].r = ccmValue(i, ccm[0][1]);\n+\t\t\t\tgreen[i].g = ccmValue(i, ccm[1][1]);\n+\t\t\t\tgreen[i].b = ccmValue(i, ccm[2][1]);\n+\t\t\t\tblue[i].r = ccmValue(i, ccm[0][2]);\n+\t\t\t\tblue[i].g = ccmValue(i, ccm[1][2]);\n+\t\t\t\tblue[i].b = ccmValue(i, ccm[2][2]);\n+\t\t\t\tparams->gammaLut[i] = gammaTable[i / div];\n+\t\t\t}\n \t\t}\n \t}\n \n", "prefixes": [ "v11", "20/24" ] }