Patch Detail
Show a patch.
GET /api/patches/26955/?format=api
{ "id": 26955, "url": "https://patchwork.libcamera.org/api/patches/26955/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26955/", "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-23-bryan.odonoghue@linaro.org>", "date": "2026-06-18T12:22:35", "name": "[22/30] libcamera: software_isp: gpu: Swtich to two pass logic", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "940451a6671c9fc3fdb54ff61b3202d2e64c6f07", "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/26955/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/26955/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26955/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 F194CC3329\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Jun 2026 12:23:34 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27098656E5;\n\tThu, 18 Jun 2026 14:23:34 +0200 (CEST)", "from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3108762C7A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 14:23:15 +0200 (CEST)", "by mail-wm1-x32c.google.com with SMTP id\n\t5b1f17b1804b1-490b8ac62baso19680925e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 05:23:15 -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.13\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 18 Jun 2026 05:23:14 -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=\"joVLJTRo\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1781785395; x=1782390195;\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=03Mx98uHM3e9ogtSRRDNl3AXJ1a3/cvpGblz2ZIrnt4=;\n\tb=joVLJTRo1VLrodB9whg6jw66eQWhk8SvPnKizuOAGxnVSWF4qm9Q2VYPGsi3eAEQe2\n\tF2y2NYzXwqGgFWThnQICgJ1BQEs93DvrCvJSRwdm+hB4BiGboAx2UKiE43TyKAfbDfPk\n\tY6lzGA2OAy82iBR5Sjz+wwlIG6e9UfYCH/gvlRKB7mOIHKYI+Ui+UUjK4xxpauniS4XJ\n\tRtYWuBXHcf4/z7pQ6U9AH417/l5djVxcUt/itd/kLrNXjoDfc+AizHb0+NVR9G7WsxHw\n\twn4kss8n8yNbPlfv7SK8sceD23jG1sXuqwtWfYYN+jNSFJdJPYWJwaLr/japX7a7lMMp\n\tDQBw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1781785395; x=1782390195;\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=03Mx98uHM3e9ogtSRRDNl3AXJ1a3/cvpGblz2ZIrnt4=;\n\tb=loGi/Gj0enl5K2X+dgBzwOpuuHGphCLKF3i6m/8A2BozSZ0iqJ5S/XVAnwl7hCMyE/\n\toPZAwqD2r9OJrkheuK6kroDk1RvNvRftjqXAO9JDxuWRx+abUO64D8T1//Eeyff4DTyo\n\tguk5cgai++FlFOGdbvP5aKM7QUWp4kW0qq/wlrhUJglxuk1KGjVWCKh70tyvu6uTQ6sx\n\tTtXg7yeOP8jgk2ITwVmnoIEduFBsUsNLVVSs8wEuEbSAW9FobD6vWGp0QB6wuO3jf67B\n\tmRqVthBVv6JLK6zJ5tO2uQf/7D5uzQtabQbO3LZBl6sVVm3OC7osamGvExJmIwfqqg1H\n\tfBMw==", "X-Gm-Message-State": "AOJu0Yz7sY+QYBKy4k6E+OZBmOgTotKDzyEQi4d8p6F0fnY+Cr/kSTsm\n\tVHqixRicEvrPzQiPljoB/rlPn3Gnv+tz/fANE57NBCxmKM8MhacxGYO4dyKuEI0Io1DxfUcqy/i\n\tbGGgOIYE=", "X-Gm-Gg": "AfdE7cntK4Beay8fe1nv4nLFjrjLVCzVHT+8VzqYSTnYFsaHvnuWXxnHa0SOB1NGPWl\n\t4dLvgmd1uLsGev1AbFqdz3aM/XsC0NufxProUy/u7YipUoszbquj4dFAf3lhHA82FWtV+/+fmb0\n\tuM94PW/ZEvKytGgUM+KpaTcUgTfZrRVhNDhmoydzxh4TwGnofeUaHoip/TNBuv1AZmq4lB0HiQC\n\tBpeD7jo+1kNHw5GuDXjfQU5C2ZvTxp/Dlp40T/jjqKqHaNXlmT9Ai0KIgxVnp1TUvk751iqKe0I\n\teRkN63QHh4uELth2eGE3KMthcAlnE71sPtzIxHutp8hISakdBgu4ou3VnwcoTbHb8gg2oKU95u3\n\tHcQpr+qmGu3B8Lj2/pCWQuM+nCsW4X7C1gJKAK9dYPN/PtgqFdLkKJihmVC2/OFRUb39ziJAZq4\n\tqCtMxlQt431fd/0jiv2Ik2Gzt93EGlq8lwWcO+LHU=", "X-Received": "by 2002:a05:600c:c8f:b0:490:b4cb:3866 with SMTP id\n\t5b1f17b1804b1-4923817fa5cmr50078885e9.10.1781785394565; \n\tThu, 18 Jun 2026 05:23:14 -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 22/30] libcamera: software_isp: gpu: Swtich to two pass logic", "Date": "Thu, 18 Jun 2026 13:22:35 +0100", "Message-ID": "<20260618122245.946138-23-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": "Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n ...gpu_pipeline_shader_pass_blc_normalise.cpp | 54 ++++++++++++++++---\n .../gpu_pipeline_shader_pass_demosiac.cpp | 49 ++++-------------\n .../gpu_pipeline_shader_pass_demosiac.h | 3 --\n .../software_isp_pipeline_gpu.cpp | 26 +++++++--\n 4 files changed, 80 insertions(+), 52 deletions(-)", "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\nindex 8e8d7b9d6..c07319ee0 100644\n--- a/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp\n+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp\n@@ -102,6 +102,8 @@ int GpuIspShaderPassBlcNormalise::selectShaders(struct ShaderConfig &shaderCfg,\n \t\tbreak;\n \t};\n \n+\tLOG(GpuShaderBlc, Info) << \"ShaderPass = \" << typeid(this).name() << \" selected shader pair \";\n+\n \treturn 0;\n }\n \n@@ -113,15 +115,14 @@ int GpuIspShaderPassBlcNormalise::getShaderVariableLocations(void)\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+\tblackLevelUniformDataIn_ = glGetUniformLocation(programId_, \"blacklevel\");\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@@ -130,6 +131,8 @@ int GpuIspShaderPassBlcNormalise::getShaderVariableLocations(void)\n \n void GpuIspShaderPassBlcNormalise::setShaderVariableValues(const DebayerParams ¶ms, eGLImage &eglImageIn)\n {\n+\tGLenum err;\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@@ -168,15 +171,34 @@ void GpuIspShaderPassBlcNormalise::setShaderVariableValues(const DebayerParams &\n \t\t{ 1.0f, 0.0f },\n \t};\n \n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables entry @ error \" << err;\n+\n \t/* vertexIn - bayer_8.vert */\n \tglEnableVertexAttribArray(attributeVertex_);\n+\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n+\n \tglVertexAttribPointer(attributeVertex_, 2, GL_FLOAT, GL_TRUE,\n \t\t\t 2 * sizeof(GLfloat), vcoordinates);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n \n \t/* textureIn - bayer_8.vert */\n \tglEnableVertexAttribArray(attributeTexture_);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n+\n \tglVertexAttribPointer(attributeTexture_, 2, GL_FLOAT, GL_TRUE,\n \t\t\t 2 * sizeof(GLfloat), tcoordinates);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n \n \t/*\n \t * Set the sampler2D to the respective texture unit for each texutre\n@@ -184,27 +206,43 @@ void GpuIspShaderPassBlcNormalise::setShaderVariableValues(const DebayerParams &\n \t * texture units\n \t */\n \tglUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\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+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n+\n \tglUniform2fv(textureUniformStep_, 1, Step);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n+\n \tglUniform1f(textureUniformStrideFactor_, Stride);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n+\n \tglUniformMatrix4fv(textureUniformProjMatrix_, 1, GL_FALSE, projMatrix);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n+\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 << \" stride_factor \" << textureUniformStrideFactor_;\n \n \tLOG(GpuShaderBlc, Debug) << \"textureUniformY_ = 0 \"\n \t\t\t << \" firstRed.x \" << firstRed[0]\n@@ -220,6 +258,10 @@ void GpuIspShaderPassBlcNormalise::setShaderVariableValues(const DebayerParams &\n \t * 0 = Red, 1 = Green, 2 = Blue\n \t */\n \tglUniform3f(blackLevelUniformDataIn_, params.blackLevel[0], params.blackLevel[1], params.blackLevel[2]);\n+\terr = glGetError();\n+\tif (err != GL_NO_ERROR)\n+\t\tLOG(GpuShaderBlc, Error) << \"setShaderVariables error \" << err << \" line \" << __LINE__;\n+\n \tLOG(GpuShaderBlc, Debug) << \" blackLevelUniformDataIn_ \" << blackLevelUniformDataIn_ << \" data \" << params.blackLevel;\n \n \treturn;\ndiff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.cpp\nindex b0c431c13..a1ca1916d 100644\n--- a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.cpp\n+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.cpp\n@@ -47,20 +47,20 @@ void GpuIspShaderPassDemosiac::stop()\n int GpuIspShaderPassDemosiac::selectShaders(struct ShaderConfig &shaderCfg, [[maybe_unused]]PixelFormat &inputFormat, [[maybe_unused]]PixelFormat &outputFormat)\n {\n \t/* Pixel location parameters */\n-\tglFormat_ = GL_LUMINANCE;\n+\tglFormat_ = GL_R16F;\n \tbytesPerPixel_ = 1;\n \tshaderStridePixels_ = passInputCfg_.stride;\n \n-\t/* Shader selection */\n+\tshaderCfg.vertexShaderData = bayer_unpacked_vert;\n+\tshaderCfg.vertexShaderDataLen = bayer_unpacked_vert_len;\n+\tshaderCfg.fragmentShaderData = bayer_glr16_to_rgba_frag;\n+\tshaderCfg.fragmentShaderDataLen = bayer_glr16_to_rgba_frag_len;\n+\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_frag;\n-\t\tshaderCfg.fragmentShaderDataLen = bayer_unpacked_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@@ -68,17 +68,9 @@ int GpuIspShaderPassDemosiac::selectShaders(struct ShaderConfig &shaderCfg, [[ma\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_frag;\n-\t\t\tshaderCfg.fragmentShaderDataLen = bayer_unpacked_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_frag;\n-\t\t\tshaderCfg.fragmentShaderDataLen = bayer_1x_packed_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@@ -88,22 +80,16 @@ int GpuIspShaderPassDemosiac::selectShaders(struct ShaderConfig &shaderCfg, [[ma\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_frag;\n-\t\t\tshaderCfg.fragmentShaderDataLen = bayer_unpacked_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_frag;\n-\t\t\tshaderCfg.fragmentShaderDataLen = bayer_1x_packed_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+\tLOG(GpuShaderDemosiac, Info) << \"ShaderPass = \" << typeid(this).name() << \" selected shader pair \";\n+\n \treturn 0;\n }\n \n@@ -112,26 +98,21 @@ int GpuIspShaderPassDemosiac::getShaderVariableLocations(void)\n \tattributeVertex_ = glGetAttribLocation(programId_, \"vertexIn\");\n \tattributeTexture_ = glGetAttribLocation(programId_, \"textureIn\");\n \n-\ttextureUniformBayerDataIn_ = glGetUniformLocation(programId_, \"tex_y\");\n \tccmUniformDataIn_ = glGetUniformLocation(programId_, \"ccm\");\n-\tblackLevelUniformDataIn_ = glGetUniformLocation(programId_, \"blacklevel\");\n \tgammaUniformDataIn_ = glGetUniformLocation(programId_, \"gamma\");\n \tcontrastExpUniformDataIn_ = glGetUniformLocation(programId_, \"contrastExp\");\n \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+\ttextureUniformBayerDataIn_ = glGetUniformLocation(programId_, \"tex_y\");\n+\ttextureUniformStep_ = glGetUniformLocation(programId_, \"tex_step\");\n+\ttextureUniformSize_ = glGetUniformLocation(programId_, \"tex_size\");\n \n \tLOG(GpuShaderDemosiac, Debug) << \"vertexIn \" << attributeVertex_ << \" textureIn \" << attributeTexture_\n-\t\t\t << \" tex_y \" << textureUniformBayerDataIn_\n \t\t\t << \" ccm \" << ccmUniformDataIn_\n-\t\t\t << \" blacklevel \" << blackLevelUniformDataIn_\n \t\t\t << \" gamma \" << gammaUniformDataIn_\n \t\t\t << \" contrastExp \" << contrastExpUniformDataIn_\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@@ -213,8 +194,6 @@ void GpuIspShaderPassDemosiac::setShaderVariableValues(const DebayerParams ¶\n \n \tLOG(GpuShaderDemosiac, 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@@ -242,12 +221,6 @@ void GpuIspShaderPassDemosiac::setShaderVariableValues(const DebayerParams ¶\n \tglUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm);\n \tLOG(GpuShaderDemosiac, Debug) << \" ccmUniformDataIn_ \" << ccmUniformDataIn_ << \" data \" << params.combinedMatrix;\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(GpuShaderDemosiac, Debug) << \" blackLevelUniformDataIn_ \" << blackLevelUniformDataIn_ << \" data \" << params.blackLevel;\n-\n \t/*\n \t * Gamma\n \t */\ndiff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h\nindex c83024bc4..2302b2ea0 100644\n--- a/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h\n+++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_demosiac.h\n@@ -50,9 +50,6 @@ private:\n \t/* Represent per-frame CCM as a uniform vector of floats 3 x 3 */\n \tGLint ccmUniformDataIn_;\n \n-\t/* Black Level compensation */\n-\tGLint blackLevelUniformDataIn_;\n-\n \t/* Gamma */\n \tGLint gammaUniformDataIn_;\n \ndiff --git a/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp b/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp\nindex 3c9b48154..14f6d2b8c 100644\n--- a/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp\n+++ b/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp\n@@ -186,9 +186,12 @@ int SoftwareIspPipelineGpu::configure(const StreamConfiguration &inputCfg,\n \n \t/* Configure for one pass */\n \tPassConfig rawSensorIn = { inputCfg.size, inputConfig_.stride, inputPixelFormat_, window };\n+\tPassConfig pingPongOut = { inputCfg.size, inputCfg.size.width, inputPixelFormat_, Rectangle(inputCfg.size) };\n+\tPassConfig pingPongIn = pingPongOut;\n \tPassConfig rgbaOut = { outputCfg.size, outputConfig_.stride, outputPixelFormat_, Rectangle(outputSize_) };\n \n-\tgpuIspShaderPassDemosiac_.configure(rawSensorIn, rgbaOut);\n+\tgpuIspShaderPassBlcNormalise_.configure(rawSensorIn, pingPongOut);\n+\tgpuIspShaderPassDemosiac_.configure(pingPongIn, rgbaOut);\n \n \treturn 0;\n }\n@@ -257,7 +260,17 @@ int SoftwareIspPipelineGpu::processGPU(FrameBuffer *input, FrameBuffer *output,\n \t/* Generate the output render framebuffer as render to texture */\n \tegl_.createOutputDMABufTexture2D(*eglImageRGBAOut_, output->planes()[0].fd.get());\n \n-\tpipelineResult = gpuIspShaderPassDemosiac_.process(*eglImageBayerIn_, *eglImageRGBAOut_, width_, height_, params);\n+\tpipelineResult = gpuIspShaderPassBlcNormalise_.process(*eglImageBayerIn_, *eglImagePingPong_[0], width_, height_, params);\n+\tif (pipelineResult) {\n+\t\tLOG(Debayer, Error) << \"BlcNormalise fail\";\n+\t\treturn pipelineResult;\n+\t}\n+\n+\tpipelineResult = gpuIspShaderPassDemosiac_.process(*eglImagePingPong_[0], *eglImageRGBAOut_, width_, height_, params);\n+\tif (pipelineResult) {\n+\t\tLOG(Debayer, Error) << \"Demosiac fail\";\n+\t\treturn pipelineResult;\n+\t}\n \n \tGLenum err = glGetError();\n \tif (err != GL_NO_ERROR) {\n@@ -337,15 +350,18 @@ int SoftwareIspPipelineGpu::start()\n \t\treturn -EINVAL;\n \n \t/* Raw bayer input as texture */\n-\teglImageBayerIn_ = std::make_unique<eGLImage>(gpuIspShaderPassDemosiac_.glFormat_, inputConfig_.stride / gpuIspShaderPassDemosiac_.getBytesPerPixel(), height_, inputConfig_.stride, GL_TEXTURE0, 0);\n+\teglImageBayerIn_ = std::make_unique<eGLImage>(gpuIspShaderPassBlcNormalise_.glFormat_, inputConfig_.stride / gpuIspShaderPassBlcNormalise_.getBytesPerPixel(), height_, inputConfig_.stride, GL_TEXTURE0, 0);\n \n \t/* Intermediary ping/pong textures */\n-\teglImagePingPong_[0] = std::make_unique<eGLImage>(gpuIspShaderPassDemosiac_.glFormat_, outputSize_.width, outputSize_.height, outputConfig_.stride, GL_TEXTURE1, 1);\n-\teglImagePingPong_[1] = std::make_unique<eGLImage>(gpuIspShaderPassDemosiac_.glFormat_, outputSize_.width, outputSize_.height, outputConfig_.stride, GL_TEXTURE2, 2);\n+\teglImagePingPong_[0] = std::make_unique<eGLImage>(gpuIspShaderPassDemosiac_.glFormat_, width_, height_, outputConfig_.stride, GL_TEXTURE1, 1);\n+\teglImagePingPong_[1] = std::make_unique<eGLImage>(gpuIspShaderPassDemosiac_.glFormat_, width_, height_, outputConfig_.stride, GL_TEXTURE2, 2);\n \n \t/* Texture we will render to */\n \teglImageRGBAOut_ = std::make_unique<eGLImage>(GL_RGBA, outputSize_.width, outputSize_.height, outputConfig_.stride, GL_TEXTURE3, 3);\n \n+\tegl_.createOutputTexture2D(*eglImagePingPong_[0]);\n+\tegl_.createOutputTexture2D(*eglImagePingPong_[1]);\n+\n \treturn 0;\n }\n \n", "prefixes": [ "22/30" ] }