Show a patch.

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

{
    "id": 26947,
    "url": "https://patchwork.libcamera.org/api/patches/26947/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26947/",
    "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": "<20260618122245.946138-15-bryan.odonoghue@linaro.org>",
    "date": "2026-06-18T12:22:27",
    "name": "[14/30] libcamera: software_isp: gpu: Add GpuIspShaderPassBlcNormalise",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "51097b146288db1904200dc55c49e50ae6029174",
    "submitter": {
        "id": 175,
        "url": "https://patchwork.libcamera.org/api/people/175/?format=api",
        "name": "Bryan O'Donoghue",
        "email": "bryan.odonoghue@linaro.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26947/mbox/",
    "series": [
        {
            "id": 6005,
            "url": "https://patchwork.libcamera.org/api/series/6005/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6005",
            "date": "2026-06-18T12:22:13",
            "name": "RFC/RFT: gpuisp: Multipass with speed optimisations on top",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6005/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26947/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26947/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 86C2FC330A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Jun 2026 12:23:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9746B656D2;\n\tThu, 18 Jun 2026 14:23:25 +0200 (CEST)",
            "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 50FAB62C70\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 14:23:08 +0200 (CEST)",
            "by mail-wm1-x32b.google.com with SMTP id\n\t5b1f17b1804b1-490ace40f4bso8810835e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 05:23:08 -0700 (PDT)",
            "from inspiron14p-linux ([109.76.144.236])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4922fa3a4easm275198015e9.3.2026.06.18.05.23.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 18 Jun 2026 05:23:07 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"rcJylJk8\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1781785388; x=1782390188;\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=1GdJ+uFZzBx4VjBnnpCYkMDySJLH5xPvIqmnSSSWAlo=;\n\tb=rcJylJk8NM3QPIU/ACfBHgWLhOq128giTgFDLYX/DWHFGaGJhvMEf8ftKSqr71//Zp\n\tw45ZVz/eV3ey/qLEERi7oPIB78u3VG622amMJb1ricGgIwZovas2LRiFfVjFYFNWgXcy\n\t/OLfvLztsuh28fyqvLTTxbgcCQdYk4Qa4MB7P/KkcasEhf4zi7jaDI7OJr5wVX/qdcSa\n\t2kNy4mp86z2teRIqZZg6Zopj2b3J0ijq9/Tc5Si5uAJWB0FVvGIEeiDyDVSHaZPO4odv\n\tsA4EEDNVYlmijpWAXHWE74+wvhNFdmAwyYLl+C230rYdC++7lGHGRzY+m6BBZddCUZko\n\t5Gmg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1781785388; x=1782390188;\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=1GdJ+uFZzBx4VjBnnpCYkMDySJLH5xPvIqmnSSSWAlo=;\n\tb=jMFkK+EXXO9voF0PDju9r6jp8xxxVkN79Jig5EN41FYJkcx4nquEiTBvTU55vXO8uj\n\trublQZZgRZTPZcBRul/Je/OQuUsfr78UfGujHPTYfq4FFO8deTaVrxMvNOjUrBLlXYUC\n\tLubdm/k7jWtNv/95VaLHeswQZnaivz9Dme9xdB5EZEZ9BCmzH3+4AFZD1j3ncYB64oS1\n\t5jHk8DUN8PijLbHjWGPSroz1K9GWu6CSXLd5QUFtLVvtcxd0ksplGrHqqnqLbmdWR69F\n\tmRlo1iEm6algX7xbiNTpxWzc7+aqjPovY7Bqm7Zygy4ar9m9jkAJ9piB6wfZMJX+Q9k6\n\tNx7w==",
        "X-Gm-Message-State": "AOJu0YyIi6/DIkDd5lRHKRZEf8FEfJJ2HpnXM4cRW+13TB86BH+oPkPT\n\tpzqJ13YNxyky+5l6IOMq7mHGcMk1T1tnmVGAM0v3Z1NHnQucYn6+4c6ckSKmKVrUqlDRZ1tlBmr\n\tsXdp6ZxE=",
        "X-Gm-Gg": "AfdE7ckXq0tBZbJJi9Uqx2MJPDfNi5ZWZTJKVLo70n6Z+ngCPjpHbBIeOFajX/ivuIP\n\tlfIIw1yBW0ojcFJGowCqWG122wX+WD37mGvbGAaicmZAtEqzmqTAodg+v45po9h+evbHZWNanky\n\t4jExOGhjRokNXkOSKMeLmx5B6wWz/oVMQWWLfUvP7nrXWABISLtWfbMadOr/dW1SUwRlO+YTOBl\n\tnwaNGWN2uoaFcqTdeiywLJcNOf8tI3qaPIzNPkHP/MnXGgJrQlvNIyW6hSVVPf+TFhpfErFhyd+\n\tDT6dIKZEifHJaMf+mhc7DMOEh+pjICWnghOTQtyhN6h6Ksr/ttFv5is66f41jvXY3MuJbUjhTXm\n\tJ4aLek4N3orO9K4OwIZB+DxGt/eYhSB3/8/saCMYpYoQlwvLtbuqQVj2qnCRkB4bAzRAqemAA/p\n\tWxPEu1ZZjQFa+vCVU9tt4CckYLVQrk",
        "X-Received": "by 2002:a05:600c:630e:b0:490:d38c:7836 with SMTP id\n\t5b1f17b1804b1-492381e8599mr54707075e9.3.1781785387785; \n\tThu, 18 Jun 2026 05:23:07 -0700 (PDT)",
        "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "bryan.odonoghue@linaro.org,\n\tpavel@ucw.cz",
        "Subject": "[PATCH 14/30] libcamera: software_isp: gpu: Add\n\tGpuIspShaderPassBlcNormalise",
        "Date": "Thu, 18 Jun 2026 13:22:27 +0100",
        "Message-ID": "<20260618122245.946138-15-bryan.odonoghue@linaro.org>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260618122245.946138-1-bryan.odonoghue@linaro.org>",
        "References": "<20260618122245.946138-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": "Make GpuIspShaderPassBlcNormalise which takes existing logic to select\nfragment/vertex shaders based on the incoming CSI2 packign but, select new\nshaders whose task in life is to apply our blacklevel normalisation step\nand output a normalised 16 bit float.\n\nThe unpacked 16f will then be fed into the existing unpacked demosiac\nshader. This patch compiles but doesn't do anything useful yet.\n\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n ...gpu_pipeline_shader_pass_blc_normalise.cpp | 228 ++++++++++++++++++\n .../gpu_pipeline_shader_pass_blc_normalise.h  |  55 +++++\n src/libcamera/software_isp/meson.build        |   1 +\n 3 files changed, 284 insertions(+)\n create mode 100644 src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp\n create mode 100644 src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.h",
    "diff": "diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp\nnew file mode 100644\nindex 000000000..8e8d7b9d6\n--- /dev/null\n+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp\n@@ -0,0 +1,228 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2026, Linaro Ltd\n+ *\n+ * Authors:\n+ * Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n+ *\n+ * GpuIspShaderPassBlcNormalise base class\n+ */\n+\n+#include <stdint.h>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/object.h>\n+#include <libcamera/base/signal.h>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/formats.h>\n+#include <libcamera/stream.h>\n+\n+#include \"libcamera/internal/bayer_format.h\"\n+#include \"libcamera/internal/egl.h\"\n+#include \"libcamera/internal/software_isp/debayer_params.h\"\n+\n+#include \"gpu_pipeline_shader_pass_blc_normalise.h\"\n+\n+/**\n+ * \\file software_isp.cpp\n+ * \\brief Simple software ISP implementation\n+ */\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(GpuShaderBlc)\n+\n+int GpuIspShaderPassBlcNormalise::start()\n+{\n+\treturn 0;\n+}\n+\n+void GpuIspShaderPassBlcNormalise::stop()\n+{\n+}\n+\n+int GpuIspShaderPassBlcNormalise::selectShaders(struct ShaderConfig &shaderCfg, [[maybe_unused]]PixelFormat &inputFormat, [[maybe_unused]]PixelFormat &outputFormat)\n+{\n+\t/* Pixel location parameters */\n+\tglFormat_ = GL_LUMINANCE;\n+\tbytesPerPixel_ = 1;\n+\tshaderStridePixels_ = passInputCfg_.stride;\n+\n+\t/* Shader selection */\n+\tswitch (inputFormat) {\n+\tcase libcamera::formats::SBGGR8:\n+\tcase libcamera::formats::SGBRG8:\n+\tcase libcamera::formats::SGRBG8:\n+\tcase libcamera::formats::SRGGB8:\n+\t\tshaderCfg.fragmentShaderData = bayer_unpacked_to_blc_glr16f_frag;\n+\t\tshaderCfg.fragmentShaderDataLen = bayer_unpacked_to_blc_glr16f_frag_len;\n+\t\tshaderCfg.vertexShaderData = bayer_unpacked_vert;\n+\t\tshaderCfg.vertexShaderDataLen = bayer_unpacked_vert_len;\n+\t\tbreak;\n+\tcase libcamera::formats::SBGGR10_CSI2P:\n+\tcase libcamera::formats::SGBRG10_CSI2P:\n+\tcase libcamera::formats::SGRBG10_CSI2P:\n+\tcase libcamera::formats::SRGGB10_CSI2P:\n+\t\tegl_.pushEnv(shaderCfg.shaderEnv, \"#define RAW10P\");\n+\t\tif (BayerFormat::fromPixelFormat(inputFormat).packing == BayerFormat::Packing::None) {\n+\t\t\tshaderCfg.fragmentShaderData = bayer_unpacked_to_blc_glr16f_frag;\n+\t\t\tshaderCfg.fragmentShaderDataLen = bayer_unpacked_to_blc_glr16f_frag_len;\n+\t\t\tshaderCfg.vertexShaderData = bayer_unpacked_vert;\n+\t\t\tshaderCfg.vertexShaderDataLen = bayer_unpacked_vert_len;\n+\t\t\tglFormat_ = GL_RG;\n+\t\t\tbytesPerPixel_ = 2;\n+\t\t} else {\n+\t\t\tshaderCfg.fragmentShaderData = bayer_1x_packed_to_blc_glr16f_frag;\n+\t\t\tshaderCfg.fragmentShaderDataLen = bayer_1x_packed_to_blc_glr16f_frag_len;\n+\t\t\tshaderCfg.vertexShaderData = identity_vert;\n+\t\t\tshaderCfg.vertexShaderDataLen = identity_vert_len;\n+\t\t\tshaderStridePixels_ = passInputCfg_.size.width;\n+\t\t}\n+\t\tbreak;\n+\tcase libcamera::formats::SBGGR12_CSI2P:\n+\tcase libcamera::formats::SGBRG12_CSI2P:\n+\tcase libcamera::formats::SGRBG12_CSI2P:\n+\tcase libcamera::formats::SRGGB12_CSI2P:\n+\t\tegl_.pushEnv(shaderCfg.shaderEnv, \"#define RAW12P\");\n+\t\tif (BayerFormat::fromPixelFormat(inputFormat).packing == BayerFormat::Packing::None) {\n+\t\t\tshaderCfg.fragmentShaderData = bayer_unpacked_to_blc_glr16f_frag;\n+\t\t\tshaderCfg.fragmentShaderDataLen = bayer_unpacked_to_blc_glr16f_frag_len;\n+\t\t\tshaderCfg.vertexShaderData = bayer_unpacked_vert;\n+\t\t\tshaderCfg.vertexShaderDataLen = bayer_unpacked_vert_len;\n+\t\t\tglFormat_ = GL_RG;\n+\t\t\tbytesPerPixel_ = 2;\n+\t\t} else {\n+\t\t\tshaderCfg.fragmentShaderData = bayer_1x_packed_to_blc_glr16f_frag;\n+\t\t\tshaderCfg.fragmentShaderDataLen = bayer_1x_packed_to_blc_glr16f_frag_len;\n+\t\t\tshaderCfg.vertexShaderData = identity_vert;\n+\t\t\tshaderCfg.vertexShaderDataLen = identity_vert_len;\n+\t\t\tshaderStridePixels_ = passInputCfg_.size.width;\n+\t\t}\n+\t\tbreak;\n+\t};\n+\n+\treturn 0;\n+}\n+\n+int GpuIspShaderPassBlcNormalise::getShaderVariableLocations(void)\n+{\n+\tattributeVertex_ = glGetAttribLocation(programId_, \"vertexIn\");\n+\tattributeTexture_ = glGetAttribLocation(programId_, \"textureIn\");\n+\ttextureUniformBayerDataIn_ = glGetUniformLocation(programId_, \"tex_y\");\n+\ttextureUniformStep_ = glGetUniformLocation(programId_, \"tex_step\");\n+\ttextureUniformSize_ = glGetUniformLocation(programId_, \"tex_size\");\n+\ttextureUniformStrideFactor_ = glGetUniformLocation(programId_, \"stride_factor\");\n+\ttextureUniformBayerFirstRed_ = glGetUniformLocation(programId_, \"tex_bayer_first_red\");\n+\ttextureUniformProjMatrix_ = glGetUniformLocation(programId_, \"proj_matrix\");\n+\n+\tLOG(GpuShaderBlc, Debug) << \"vertexIn \" << attributeVertex_ << \" textureIn \" << attributeTexture_\n+\t\t\t    << \" tex_y \" << textureUniformBayerDataIn_\n+\t\t\t    << \" tex_step \" << textureUniformStep_\n+\t\t\t    << \" tex_size \" << textureUniformSize_\n+\t\t\t    << \" stride_factor \" << textureUniformStrideFactor_\n+\t\t\t    << \" tex_bayer_first_red \" << textureUniformBayerFirstRed_\n+\t\t\t    << \" proj_matrix \" << textureUniformProjMatrix_;\n+\n+\t/* TODO: trap errors */\n+\treturn 0;\n+}\n+\n+void GpuIspShaderPassBlcNormalise::setShaderVariableValues(const DebayerParams &params, eGLImage &eglImageIn)\n+{\n+\t/*\n+\t * Raw Bayer 8-bit, and packed raw Bayer 10-bit/12-bit formats\n+\t * are stored in a GL_LUMINANCE texture. The texture width is\n+\t * equal to the stride.\n+\t */\n+\tGLfloat firstRed[] = { firstRed_x_, firstRed_y_ };\n+\tGLfloat imgSize[] = { (GLfloat)passInputCfg_.size.width,\n+\t\t\t      (GLfloat)passInputCfg_.size.height };\n+\tGLfloat Step[] = { static_cast<float>(bytesPerPixel_) / (passInputCfg_.stride - 1),\n+\t\t\t   1.0f / (passInputCfg_.size.height - 1) };\n+\tGLfloat Stride = (GLfloat)passInputCfg_.size.width / (shaderStridePixels_ / bytesPerPixel_);\n+\t/*\n+\t * Scale input to output size, keeping the aspect ratio and preferring\n+\t * cropping over black bars.\n+\t */\n+\tGLfloat scale = std::max((GLfloat)passInputCfg_.window.width / passInputCfg_.size.width,\n+\t\t\t\t (GLfloat)passInputCfg_.window.height / passInputCfg_.size.height);\n+\tGLfloat trans = -(1.0f - scale);\n+\tGLfloat projMatrix[] = {\n+\t\tscale, 0, 0, 0,\n+\t\t0, scale, 0, 0,\n+\t\t0, 0, 1, 0,\n+\t\ttrans, trans, 0, 1\n+\t};\n+\t/* Static const coordinates */\n+\tstatic const GLfloat vcoordinates[4][2] = {\n+\t\t{ -1.0f, -1.0f },\n+\t\t{ -1.0f, +1.0f },\n+\t\t{ +1.0f, +1.0f },\n+\t\t{ +1.0f, -1.0f },\n+\t};\n+\tstatic const GLfloat tcoordinates[4][2] = {\n+\t\t{ 0.0f, 0.0f },\n+\t\t{ 0.0f, 1.0f },\n+\t\t{ 1.0f, 1.0f },\n+\t\t{ 1.0f, 0.0f },\n+\t};\n+\n+\t/* vertexIn - bayer_8.vert */\n+\tglEnableVertexAttribArray(attributeVertex_);\n+\tglVertexAttribPointer(attributeVertex_, 2, GL_FLOAT, GL_TRUE,\n+\t\t\t      2 * sizeof(GLfloat), vcoordinates);\n+\n+\t/* textureIn - bayer_8.vert */\n+\tglEnableVertexAttribArray(attributeTexture_);\n+\tglVertexAttribPointer(attributeTexture_, 2, GL_FLOAT, GL_TRUE,\n+\t\t\t      2 * sizeof(GLfloat), tcoordinates);\n+\n+\t/*\n+\t * Set the sampler2D to the respective texture unit for each texutre\n+\t * To simultaneously sample multiple textures we need to use multiple\n+\t * texture units\n+\t */\n+\tglUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_);\n+\n+\t/*\n+\t * These values are:\n+\t * firstRed = tex_bayer_first_red - bayer_8.vert\n+\t * imgSize = tex_size - bayer_8.vert\n+\t * step = tex_step - bayer_8.vert\n+\t * Stride = stride_factor identity.vert\n+\t * textureUniformProjMatri = No scaling\n+\t */\n+\tglUniform2fv(textureUniformBayerFirstRed_, 1, firstRed);\n+\tglUniform2fv(textureUniformSize_, 1, imgSize);\n+\tglUniform2fv(textureUniformStep_, 1, Step);\n+\tglUniform1f(textureUniformStrideFactor_, Stride);\n+\tglUniformMatrix4fv(textureUniformProjMatrix_, 1, GL_FALSE, projMatrix);\n+\n+\tLOG(GpuShaderBlc, Debug) << \"vertexIn \" << attributeVertex_ << \" textureIn \" << attributeTexture_\n+\t\t\t    << \" tex_y \" << textureUniformBayerDataIn_\n+\t\t\t    << \" tex_step \" << textureUniformStep_\n+\t\t\t    << \" tex_size \" << textureUniformSize_\n+\t\t\t    << \" stride_factor \" << textureUniformStrideFactor_\n+\t\t\t    << \" tex_bayer_first_red \" << textureUniformBayerFirstRed_;\n+\n+\tLOG(GpuShaderBlc, Debug) << \"textureUniformY_ = 0 \"\n+\t\t\t    << \" firstRed.x \" << firstRed[0]\n+\t\t\t    << \" firstRed.y \" << firstRed[1]\n+\t\t\t    << \" textureUniformSize_.width \" << imgSize[0]\n+\t\t\t    << \" textureUniformSize_.height \" << imgSize[1]\n+\t\t\t    << \" textureUniformStep_.x \" << Step[0]\n+\t\t\t    << \" textureUniformStep_.y \" << Step[1]\n+\t\t\t    << \" textureUniformStrideFactor_ \" << Stride\n+\t\t\t    << \" textureUniformProjMatrix_ \" << textureUniformProjMatrix_;\n+\n+\t/*\n+\t * 0 = Red, 1 = Green, 2 = Blue\n+\t */\n+\tglUniform3f(blackLevelUniformDataIn_, params.blackLevel[0], params.blackLevel[1], params.blackLevel[2]);\n+\tLOG(GpuShaderBlc, Debug) << \" blackLevelUniformDataIn_ \" << blackLevelUniformDataIn_ << \" data \" << params.blackLevel;\n+\n+\treturn;\n+}\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.h\nnew file mode 100644\nindex 000000000..64ea2fc11\n--- /dev/null\n+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.h\n@@ -0,0 +1,55 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2026, Linaro Ltd\n+ *\n+ * Authors:\n+ * Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n+ *\n+ * GpuIspPipelineShaderPass base class\n+ */\n+\n+#pragma once\n+\n+#include <stdint.h>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/object.h>\n+#include <libcamera/base/signal.h>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/stream.h>\n+\n+#include \"libcamera/internal/egl.h\"\n+#include \"libcamera/internal/software_isp/debayer_params.h\"\n+\n+#include \"gpu_pipeline_shader_pass.h\"\n+\n+namespace libcamera {\n+\n+class FrameBuffer;\n+\n+class GpuIspShaderPassBlcNormalise : public GpuIspShaderPass\n+{\n+public:\n+\tGpuIspShaderPassBlcNormalise(eGL& egl) : GpuIspShaderPass(egl) {};\n+\n+\tint start();\n+\tvoid stop();\n+\n+\t/* Things that every ISP pipeline pass will need to do */\n+\tint getShaderVariableLocations(void);\n+\tvoid setShaderVariableValues(const DebayerParams &params, eGLImage &eglImageIn);\n+\tint selectShaders(struct ShaderConfig &shaderCfg, PixelFormat &inputFormat, PixelFormat &outputFormat);\n+\tconst char *name() const override { return \"GpuIspShaderPassBlcNormalise\"; }\n+\n+private:\n+\t/* Shader parameters */\n+\tGLint textureUniformStep_;\n+\tGLint textureUniformSize_;\n+\n+\t/* Black Level compensation */\n+\tGLint blackLevelUniformDataIn_;\n+\n+};\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build\nindex 3e7d21318..e9caa3629 100644\n--- a/src/libcamera/software_isp/meson.build\n+++ b/src/libcamera/software_isp/meson.build\n@@ -34,6 +34,7 @@ if mesa_works\n         'software_isp_pipeline_gpu.cpp',\n         'gpu_pipeline_shader_pass.cpp',\n         'gpu_pipeline_shader_pass_demosiac.cpp',\n+\t'gpu_pipeline_shader_pass_blc_normalise.cpp',\n     ])\n     libcamera_deps += [\n         libegl,\n",
    "prefixes": [
        "14/30"
    ]
}