{"id":25657,"url":"https://patchwork.libcamera.org/api/1.1/patches/25657/?format=json","web_url":"https://patchwork.libcamera.org/patch/25657/","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":"<20260106170059.56193-5-bryan.odonoghue@linaro.org>","date":"2026-01-06T17:00:39","name":"[v11,04/24] qcam: viewfinder_gl: Set no-op Bayer shader values","commit_ref":"76973876b8b593352c10b766c50daaa3d575c96b","pull_url":null,"state":"accepted","archived":false,"hash":"8561489a6053424d8c8a2062b30973e6a0302cb1","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/25657/mbox/","series":[{"id":5689,"url":"https://patchwork.libcamera.org/api/1.1/series/5689/?format=json","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/25657/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25657/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 576DABDCC0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jan 2026 17:01:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9518361FD9;\n\tTue,  6 Jan 2026 18:01:11 +0100 (CET)","from mail-wr1-x432.google.com (mail-wr1-x432.google.com\n\t[IPv6:2a00:1450:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3206E61F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jan 2026 18:01:09 +0100 (CET)","by mail-wr1-x432.google.com with SMTP id\n\tffacd0b85a97d-42e2ba54a6fso452635f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 06 Jan 2026 09:01:09 -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.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 06 Jan 2026 09:01:07 -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=\"raR2DRGP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1767718868; x=1768323668;\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=Wt8h+ZjhgdR+OdkPLA1nogPcLvDpX9IavMvjc6CFwXo=;\n\tb=raR2DRGPCouq37rrYrtY3f6+YvIAJYadRjLy+llo3sHVjW6ts0UiyrxGhKKu6BKpEK\n\tsBxPKZuMEyclEEtkTFbHTpZHzkLqN8p7s1TlGoVLzjzIDEPZJ3yieGqZSu6HQS7fPiJt\n\taPjC7Hz/1DgcoD6ADnC9I9wQ6OfopvQ38GcRVGe3x/m6ME6cF4PoDQ8A34Nf/ftWk5T2\n\tdWIrg7pv3+xFVqQoaPY/0L0dWqZ1cedTIUp5rYf5SW0pudQqQdLaDYJdEghQCqcOhjSO\n\tvhapXokKBV2WPEhO/9kb7ZLOcU9BQbErRQJ1o4ofSH6qmiW4EfnC41B9XUCoLNrTym6v\n\tL6fA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1767718868; x=1768323668;\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=Wt8h+ZjhgdR+OdkPLA1nogPcLvDpX9IavMvjc6CFwXo=;\n\tb=ijBYGMyTsRQNm1/S7KxLCg0PdIFM7MhcynYmo5dPr5rtIA9WZ2YN5w286GgPcdiA7+\n\tqU+y9ifICjbG1zmxSEBj/ZlFzdC3PyPEFWCot+zox4XdJSAlv2G7DY39R1J7ZH8NufnT\n\tZQ/eq6ZJjkBurt8tOYKjuEmrd4fe/ELUqfkpOtpLG+47FujWJakqFvuQk7dWd/MFWFJa\n\tVdERCMJqccOAcG7Qaoh3pAme13GNaW34++eHur8H0m6QzleykA+APCXKXrkFEVYPJNw+\n\txQg+3GQidPKzjU5NcF8J/CIqlE0FF7z3Wy/jwx2FIFAtY3yvhxX+2HhitaLV9+HGYoY+\n\ta69Q==","X-Gm-Message-State":"AOJu0YydD8KQqcbJmkOcz2nRHyB9TXtvBQnQyCdXF8gZlskuYA2QgS0I\n\taBfUyY73ZBpnBQo0ezbSvV7TKFet34FWtswGIPy/ccmkdVPKGwuPKbZVx6szlPAgE5vVoEXCChY\n\t6O2RcY/M=","X-Gm-Gg":"AY/fxX4TfFKg1P/No0ZpNHBvcI3F/n/KYafzpABZTAKAElQcj/2MHI0FAJWwJ5wiIxr\n\tgfi1ewWuLFrK1xbCAgIhWxOFv1ZkZ943VzULUGSVb4Ls7NUc5cKxGVcZUarN1afzBg7HABqRtTp\n\t0zMAnCmdm8fnclnQRYRt6cAgVJz4vxnsE1T62dKyi3FdIViiVVlo/Oy026/2UZ3j0XKlWnwOn0/\n\tTAth17dlv+RRAI9zRf73NOzyW/onyyfzTq93RElN34EeuvO6lO4iruH7Op6aPgrUV4fF8OhT766\n\tD06fatHi2384EI4cIQW9CfXx1Nk3CE54QgHlyFmV9QeRgqckqxWHS0A+ZD8DTayyrMlj4HORGh2\n\tV62MK/L72vR8RBifLZwHNN+uAhi/06O06YPaIoGWo0MkM+Wn6XlZeP22jFMTke6LB0+9B6LnyLz\n\tTZS95uiY3hP0Fl85FJ4Ev/D3G3lmuuhRVCM3pEL073jAeh7nl7zm2re4W67agjf8z1z0A=","X-Google-Smtp-Source":"AGHT+IGuwNlFxtJKT0LojJ9vOaxxwb0+S+2F6+M8PX1Ci2e27XJ+frMVK0BNWv704U/WwbR1hT7CtQ==","X-Received":"by 2002:a5d:5d11:0:b0:42f:bab5:953d with SMTP id\n\tffacd0b85a97d-432bca50238mr5046775f8f.47.1767718867673; \n\tTue, 06 Jan 2026 09:01:07 -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 04/24] qcam: viewfinder_gl: Set no-op Bayer shader values","Date":"Tue,  6 Jan 2026 17:00:39 +0000","Message-ID":"<20260106170059.56193-5-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":"Populate qcam viewfinder_gl to set default Bayer values so that the\nshaders can be used in their original mode without conditional compilation.\n\nSet an identity CCM, identity Black Level and set Gamma and Contrast to\n1.0f respectively.\n\nOnce this change is made we can use the Bayer shaders in their original\nformat in qcam with raw streams.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/apps/qcam/viewfinder_gl.cpp | 26 ++++++++++++++++++++++++++\n src/apps/qcam/viewfinder_gl.h   | 12 ++++++++++++\n 2 files changed, 38 insertions(+)","diff":"diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp\nindex 1554c94d5..0d06122f6 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+\tcontrastExpUniformDataIn_ = shaderProgram_.uniformLocation(\"contrastExp\");\n \n \t/* Create the textures. */\n \tfor (std::unique_ptr<QOpenGLTexture> &texture : textures_) {\n@@ -542,6 +546,16 @@ 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\t0.0f, 1.0f, 0.0f,\n+\t\t\t0.0f, 0.0f, 1.0f };\n+\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 +802,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(contrastExpUniformDataIn_, 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..1aa85e4fc 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 contrastExpUniformDataIn_;\n+\n \tQMutex mutex_; /* Prevent concurrent access to image_ */\n };\n","prefixes":["v11","04/24"]}