{"id":25312,"url":"https://patchwork.libcamera.org/api/1.1/patches/25312/?format=json","web_url":"https://patchwork.libcamera.org/patch/25312/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251202134544.662446-4-bryan.odonoghue@linaro.org>","date":"2025-12-02T13:45:23","name":"[v6,03/24] qcam: viewfinder_gl: Set no-op Bayer shader values","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5523ea4e22ef19f64d9b4b4cb6bd15ead3f0d056","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/1.1/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25312/mbox/","series":[{"id":5631,"url":"https://patchwork.libcamera.org/api/1.1/series/5631/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5631","date":"2025-12-02T13:45:20","name":"Add GLES 2.0 GPUISP to libcamera","version":6,"mbox":"https://patchwork.libcamera.org/series/5631/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25312/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25312/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 3F79FC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Dec 2025 13:46:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 51A1B60C91;\n\tTue,  2 Dec 2025 14:46:00 +0100 (CET)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AA63660C77\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Dec 2025 14:45:56 +0100 (CET)","by mail-wm1-x331.google.com with SMTP id\n\t5b1f17b1804b1-477770019e4so46195725e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Dec 2025 05:45:56 -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\t5b1f17b1804b1-47926f0ec69sm19383375e9.1.2025.12.02.05.45.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 02 Dec 2025 05:45:54 -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=\"wrwhyC1d\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1764683156; x=1765287956;\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=amMoQCO1WpNVR7VV2kItwg29g4ljwGAnIqXk1bcdxT4=;\n\tb=wrwhyC1djZOoIgYgv6Pu6zHhrb3J1BX9/NvsKj0n5tkOd35GDpkcNsNXeFae/YA/3v\n\tQkjUHqE6nSfcRJUq/rQ/cDjyVBjAu746reyeK2QOcwB1xV+PuaxEodVpnd9gSWtlQ+Yw\n\tu0wWZ7AjmjCqqR98lUA2LAhr3GSASr9Xe+WfUrEQnL1RKBYxN9Rc0csjtC09Pac1tyEm\n\t9V3FZhPs7SsbAaFLUJGvii44n+ZORZ+IxddaSbLmK256WKS5k028UfyiPLH4GnzBvtow\n\tW+2Diek7iiXQj+DpriI8Uv8+qWpBMesWTlb90sgJwhLyhy83elgkJr7WToLoDTJvvycg\n\tBx8Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764683156; x=1765287956;\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=amMoQCO1WpNVR7VV2kItwg29g4ljwGAnIqXk1bcdxT4=;\n\tb=EUJq32FJZgPTV3SDYzigPAvszfk6MTDVDuUZviuZQk6b6Ew4cSL2MTPxM2VSJ2tQxV\n\tVcX+8ZdnWsPlTnlUisJmORNEy6wV2MrBHUsUK25ylu9+Br//sBbpwGF/xX26X3LKiLRe\n\t6ABeB/jRx4Z2MmxoNMkKuVZgomk/L1C+BYzsKwjwJy6xDhwXluoqLlEd8wG64QHTZY5m\n\tPElu0NvoJx9936Nd24B7OjxoaKAW98/D956flxGRsdbJws+4BOjRpFQpgXxPdxTRSuAF\n\tmeo6FtmfiiOoctvIO3bR1ovCUl3enDGUsxaR23IZllaASAYsg0LKsSwv+qkI8JrmmFIy\n\t17rQ==","X-Gm-Message-State":"AOJu0Yx++mlxWHfT0hWrkTb+nKUxi1g+wTWMeWBpWbBZ+fbCbmOhmOaT\n\tWNB4B+qxD/wnU0bYeXyl1a1HSvilHrCWEecmIK9OzDUw+0E7Xbnel3RY5aunOHxIdD4r0TgpGQb\n\toa9+N","X-Gm-Gg":"ASbGnctR79E7Gd2mQh4CZ1+quxkfB7Qv/UczVWx2dnDclFo/YGFd3zQ6Rx/g/LIxoDs\n\t3GyXSFumqdYXMzFY1u8QDcx5K+l4NFJVSr3n7poXv3yiHJ2t7GDS0J56I4iW7hJ4YY/zL2SBudz\n\t3o+L5zMf8LeF7lxgs/+xCQmN+HQBP+bHWcrO3PA35l1t5+HhPX6vVcCP0h7Pb4Ckee1uzmdT/WG\n\tAPVye6K+hVGplZ4inw95kCuNER/hmzUCM2+1XbSJarJ2NXIjc4L0bdV3l7H5ts3mvLDlO91tZu2\n\t5i9kYcBbneG9lhkUbrMrY48jALzPqs1fp8bWP/IhlUXX7ASExaf1uq34BN8HrGgN6Q/PPOEBsXI\n\t9KsN7L8V2iCiyLopBXTOiYHbqibnHUAG1Lyu03bkBxEMm8aocff8qHNR8aMu+YhU+SYnFj+Z7Wl\n\trLhpDL2mPq3qufT59QmtRUUOhPWVVq+d+83p+NzDacoIVAyRyA5MC+XHK1dJc9h9UUxJU=","X-Google-Smtp-Source":"AGHT+IGRDiF22iUsZjPGDrX8ZcsDo4jDMYlPfSU3itkTff+gWN94oVIndJv4kPDXwjb6tuOpqLJn5w==","X-Received":"by 2002:a05:600c:4f48:b0:471:115e:87bd with SMTP id\n\t5b1f17b1804b1-47904b2494cmr306646675e9.26.1764683155786; \n\tTue, 02 Dec 2025 05:45:55 -0800 (PST)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"pavel@ucw.cz,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>","Subject":"[PATCH v6 03/24] qcam: viewfinder_gl: Set no-op Bayer shader values","Date":"Tue,  2 Dec 2025 13:45:23 +0000","Message-ID":"<20251202134544.662446-4-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251202134544.662446-1-bryan.odonoghue@linaro.org>","References":"<20251202134544.662446-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 src/apps/qcam/viewfinder_gl.cpp | 25 +++++++++++++++++++++++++\n src/apps/qcam/viewfinder_gl.h   | 12 ++++++++++++\n 2 files changed, 37 insertions(+)","diff":"diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp\nindex 1554c94d5..69b7c6e59 100644\n--- a/src/apps/qcam/viewfinder_gl.cpp\n+++ b/src/apps/qcam/viewfinder_gl.cpp\n@@ -473,6 +473,10 @@ bool ViewFinderGL::createFragmentShader()\n \ttextureUniformSize_ = shaderProgram_.uniformLocation(\"tex_size\");\n \ttextureUniformStrideFactor_ = shaderProgram_.uniformLocation(\"stride_factor\");\n \ttextureUniformBayerFirstRed_ = shaderProgram_.uniformLocation(\"tex_bayer_first_red\");\n+\tccmUniformDataIn_ = shaderProgram_.uniformLocation(\"ccm\");\n+\tblackLevelUniformDataIn_ = shaderProgram_.uniformLocation(\"blacklevel\");\n+\tgammaUniformDataIn_ = shaderProgram_.uniformLocation(\"gamma\");\n+\tcontrastUniformDataIn_ = shaderProgram_.uniformLocation(\"contrast\");\n \n \t/* Create the textures. */\n \tfor (std::unique_ptr<QOpenGLTexture> &texture : textures_) {\n@@ -542,6 +546,15 @@ void ViewFinderGL::doRender()\n \t/* Stride of the first plane, in pixels. */\n \tunsigned int stridePixels;\n \n+\t/* Identity CCM */\n+\tfloat ccm[] = {1.0f, 0.0f, 0.0f,\n+\t\t       0.0f, 1.0f, 0.0f,\n+\t\t       0.0f, 0.0f, 1.0f };\n+\tQMatrix3x3 qCcmMat(ccm);\n+\n+\t/* Black Level */\n+\tQVector3D qBlackLevelVec(0.0f, 0.0f, 0.0f);\n+\n \tswitch (format_) {\n \tcase libcamera::formats::NV12:\n \tcase libcamera::formats::NV21:\n@@ -788,6 +801,18 @@ void ViewFinderGL::doRender()\n \t\t * the generic stride factor to 1.0.\n \t\t */\n \t\tstridePixels = size_.width();\n+\n+\t\t /* Colour Correction Matrix */\n+\t\tshaderProgram_.setUniformValue(ccmUniformDataIn_, qCcmMat);\n+\n+\t\t/* Black Level */\n+\t\tshaderProgram_.setUniformValue(blackLevelUniformDataIn_, qBlackLevelVec);\n+\n+\t\t/* Gamma */\n+\t\tshaderProgram_.setUniformValue(gammaUniformDataIn_, 1.0f);\n+\n+\t\t/* Contrast */\n+\t\tshaderProgram_.setUniformValue(contrastUniformDataIn_, 1.0f);\n \t\tbreak;\n \n \tdefault:\ndiff --git a/src/apps/qcam/viewfinder_gl.h b/src/apps/qcam/viewfinder_gl.h\nindex 23c657bcf..c1b2d9d51 100644\n--- a/src/apps/qcam/viewfinder_gl.h\n+++ b/src/apps/qcam/viewfinder_gl.h\n@@ -103,5 +103,17 @@ private:\n \tGLuint textureUniformBayerFirstRed_;\n \tQPointF firstRed_;\n \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+\n+\t// Contrast\n+\tGLint contrastUniformDataIn_;\n+\n \tQMutex mutex_; /* Prevent concurrent access to image_ */\n };\n","prefixes":["v6","03/24"]}