qcam: viewfinder_gl: Set awb GL uniform for debayer shaders
diff mbox series

Message ID 20261030142101.46288-1-johannes.goede@oss.qualcomm.com
State New
Headers show
Series
  • qcam: viewfinder_gl: Set awb GL uniform for debayer shaders
Related show

Commit Message

Hans de Goede Oct. 30, 2026, 2:21 p.m. UTC
Since commit 569e3a41e9e4 ("softisp: Split AWB from Combined Matrix")
trying to use qcam's debayer shaders results in a black picture because
of the awb GL uniform note getting set, which gets interpreted as all
AWB gains being 0.0.

Fixes: 569e3a41e9e4 ("softisp: Split AWB from Combined Matrix")
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
---
 src/apps/qcam/viewfinder_gl.cpp | 7 +++++++
 src/apps/qcam/viewfinder_gl.h   | 3 +++
 2 files changed, 10 insertions(+)

Comments

Kieran Bingham Oct. 30, 2026, 2:35 p.m. UTC | #1
Quoting Hans de Goede (2026-10-30 14:21:01)
> Since commit 569e3a41e9e4 ("softisp: Split AWB from Combined Matrix")
> trying to use qcam's debayer shaders results in a black picture because
> of the awb GL uniform note getting set, which gets interpreted as all
> AWB gains being 0.0.


s/note/not/

Can be fixed while applying.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> 
> Fixes: 569e3a41e9e4 ("softisp: Split AWB from Combined Matrix")
> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
> ---
>  src/apps/qcam/viewfinder_gl.cpp | 7 +++++++
>  src/apps/qcam/viewfinder_gl.h   | 3 +++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp
> index 1d3f48917..fb9717ce1 100644
> --- a/src/apps/qcam/viewfinder_gl.cpp
> +++ b/src/apps/qcam/viewfinder_gl.cpp
> @@ -477,6 +477,7 @@ bool ViewFinderGL::createFragmentShader()
>         blackLevelUniformDataIn_ = shaderProgram_.uniformLocation("blacklevel");
>         gammaUniformDataIn_ = shaderProgram_.uniformLocation("gamma");
>         contrastExpUniformDataIn_ = shaderProgram_.uniformLocation("contrastExp");
> +       awbUniformDataIn_ = shaderProgram_.uniformLocation("awb");
>  
>         /* Create the textures. */
>         for (std::unique_ptr<QOpenGLTexture> &texture : textures_) {
> @@ -556,6 +557,9 @@ void ViewFinderGL::doRender()
>         /* Black Level */
>         QVector3D qBlackLevelVec(0.0f, 0.0f, 0.0f);
>  
> +       /* AWB */
> +       QVector3D qAwbVec(1.0f, 1.0f, 1.0f);
> +
>         switch (format_) {
>         case libcamera::formats::NV12:
>         case libcamera::formats::NV21:
> @@ -809,6 +813,9 @@ void ViewFinderGL::doRender()
>                 /* Black Level */
>                 shaderProgram_.setUniformValue(blackLevelUniformDataIn_, qBlackLevelVec);
>  
> +               /* AWB */
> +               shaderProgram_.setUniformValue(awbUniformDataIn_, qAwbVec);
> +
>                 /* Gamma */
>                 shaderProgram_.setUniformValue(gammaUniformDataIn_, 1.0f);
>  
> diff --git a/src/apps/qcam/viewfinder_gl.h b/src/apps/qcam/viewfinder_gl.h
> index 1aa85e4fc..8f033b407 100644
> --- a/src/apps/qcam/viewfinder_gl.h
> +++ b/src/apps/qcam/viewfinder_gl.h
> @@ -109,6 +109,9 @@ private:
>         /* Black Level compensation */
>         GLint blackLevelUniformDataIn_;
>  
> +       /* AWB */
> +       GLint awbUniformDataIn_;
> +
>         /* Gamma */
>         GLint gammaUniformDataIn_;
>  
> -- 
> 2.56.0
>
Hans de Goede Oct. 30, 2026, 3 p.m. UTC | #2
Hi,

On 30-Oct-26 15:35, Kieran Bingham wrote:
> Quoting Hans de Goede (2026-10-30 14:21:01)
>> Since commit 569e3a41e9e4 ("softisp: Split AWB from Combined Matrix")
>> trying to use qcam's debayer shaders results in a black picture because
>> of the awb GL uniform note getting set, which gets interpreted as all
>> AWB gains being 0.0.
> 
> 
> s/note/not/

Ack, if you can fix this up while applying that would be great.

Regards,

Hans


> 
> Can be fixed while applying.
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
>>
>> Fixes: 569e3a41e9e4 ("softisp: Split AWB from Combined Matrix")
>> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
>> ---
>>  src/apps/qcam/viewfinder_gl.cpp | 7 +++++++
>>  src/apps/qcam/viewfinder_gl.h   | 3 +++
>>  2 files changed, 10 insertions(+)
>>
>> diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp
>> index 1d3f48917..fb9717ce1 100644
>> --- a/src/apps/qcam/viewfinder_gl.cpp
>> +++ b/src/apps/qcam/viewfinder_gl.cpp
>> @@ -477,6 +477,7 @@ bool ViewFinderGL::createFragmentShader()
>>         blackLevelUniformDataIn_ = shaderProgram_.uniformLocation("blacklevel");
>>         gammaUniformDataIn_ = shaderProgram_.uniformLocation("gamma");
>>         contrastExpUniformDataIn_ = shaderProgram_.uniformLocation("contrastExp");
>> +       awbUniformDataIn_ = shaderProgram_.uniformLocation("awb");
>>  
>>         /* Create the textures. */
>>         for (std::unique_ptr<QOpenGLTexture> &texture : textures_) {
>> @@ -556,6 +557,9 @@ void ViewFinderGL::doRender()
>>         /* Black Level */
>>         QVector3D qBlackLevelVec(0.0f, 0.0f, 0.0f);
>>  
>> +       /* AWB */
>> +       QVector3D qAwbVec(1.0f, 1.0f, 1.0f);
>> +
>>         switch (format_) {
>>         case libcamera::formats::NV12:
>>         case libcamera::formats::NV21:
>> @@ -809,6 +813,9 @@ void ViewFinderGL::doRender()
>>                 /* Black Level */
>>                 shaderProgram_.setUniformValue(blackLevelUniformDataIn_, qBlackLevelVec);
>>  
>> +               /* AWB */
>> +               shaderProgram_.setUniformValue(awbUniformDataIn_, qAwbVec);
>> +
>>                 /* Gamma */
>>                 shaderProgram_.setUniformValue(gammaUniformDataIn_, 1.0f);
>>  
>> diff --git a/src/apps/qcam/viewfinder_gl.h b/src/apps/qcam/viewfinder_gl.h
>> index 1aa85e4fc..8f033b407 100644
>> --- a/src/apps/qcam/viewfinder_gl.h
>> +++ b/src/apps/qcam/viewfinder_gl.h
>> @@ -109,6 +109,9 @@ private:
>>         /* Black Level compensation */
>>         GLint blackLevelUniformDataIn_;
>>  
>> +       /* AWB */
>> +       GLint awbUniformDataIn_;
>> +
>>         /* Gamma */
>>         GLint gammaUniformDataIn_;
>>  
>> -- 
>> 2.56.0
>>

Patch
diff mbox series

diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp
index 1d3f48917..fb9717ce1 100644
--- a/src/apps/qcam/viewfinder_gl.cpp
+++ b/src/apps/qcam/viewfinder_gl.cpp
@@ -477,6 +477,7 @@  bool ViewFinderGL::createFragmentShader()
 	blackLevelUniformDataIn_ = shaderProgram_.uniformLocation("blacklevel");
 	gammaUniformDataIn_ = shaderProgram_.uniformLocation("gamma");
 	contrastExpUniformDataIn_ = shaderProgram_.uniformLocation("contrastExp");
+	awbUniformDataIn_ = shaderProgram_.uniformLocation("awb");
 
 	/* Create the textures. */
 	for (std::unique_ptr<QOpenGLTexture> &texture : textures_) {
@@ -556,6 +557,9 @@  void ViewFinderGL::doRender()
 	/* Black Level */
 	QVector3D qBlackLevelVec(0.0f, 0.0f, 0.0f);
 
+	/* AWB */
+	QVector3D qAwbVec(1.0f, 1.0f, 1.0f);
+
 	switch (format_) {
 	case libcamera::formats::NV12:
 	case libcamera::formats::NV21:
@@ -809,6 +813,9 @@  void ViewFinderGL::doRender()
 		/* Black Level */
 		shaderProgram_.setUniformValue(blackLevelUniformDataIn_, qBlackLevelVec);
 
+		/* AWB */
+		shaderProgram_.setUniformValue(awbUniformDataIn_, qAwbVec);
+
 		/* Gamma */
 		shaderProgram_.setUniformValue(gammaUniformDataIn_, 1.0f);
 
diff --git a/src/apps/qcam/viewfinder_gl.h b/src/apps/qcam/viewfinder_gl.h
index 1aa85e4fc..8f033b407 100644
--- a/src/apps/qcam/viewfinder_gl.h
+++ b/src/apps/qcam/viewfinder_gl.h
@@ -109,6 +109,9 @@  private:
 	/* Black Level compensation */
 	GLint blackLevelUniformDataIn_;
 
+	/* AWB */
+	GLint awbUniformDataIn_;
+
 	/* Gamma */
 	GLint gammaUniformDataIn_;