[08/10] libcamera: software_isp: debayer_egl: Pass eglImage as parameter to setShaderVariables
diff mbox series

Message ID 20260624085849.873784-9-bryan.odonoghue@linaro.org
State New
Headers show
Series
  • libcamera: software_isp: gpu: Add go faster stripes
Related show

Commit Message

Bryan O'Donoghue June 24, 2026, 8:58 a.m. UTC
We will create a cache of textures and eGLImages which means the value
assigned to the shader texture unit will come from one of those now cached
eGLImage objects.

Pass eGLImage as a parameter to facilitate future differentiation.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 src/libcamera/software_isp/debayer_egl.cpp | 6 +++---
 src/libcamera/software_isp/debayer_egl.h   | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Robert Mader June 24, 2026, 12:17 p.m. UTC | #1
On 24.06.26 10:58, Bryan O'Donoghue wrote:
> We will create a cache of textures and eGLImages which means the value
> assigned to the shader texture unit will come from one of those now cached
> eGLImage objects.
>
> Pass eGLImage as a parameter to facilitate future differentiation.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>   src/libcamera/software_isp/debayer_egl.cpp | 6 +++---
>   src/libcamera/software_isp/debayer_egl.h   | 2 +-
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp
> index cdceacf96..f6b7b11e1 100644
> --- a/src/libcamera/software_isp/debayer_egl.cpp
> +++ b/src/libcamera/software_isp/debayer_egl.cpp
> @@ -397,7 +397,7 @@ uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const
>   	return info.stride(size.width, 0, 256);
>   }
>   
> -void DebayerEGL::setShaderVariableValues(const DebayerParams &params)
> +void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerParams &params)
>   {
>   	/*
>   	 * Raw Bayer 8-bit, and packed raw Bayer 10-bit/12-bit formats
> @@ -453,7 +453,7 @@ void DebayerEGL::setShaderVariableValues(const DebayerParams &params)
>   	 * To simultaneously sample multiple textures we need to use multiple
>   	 * texture units
>   	 */
> -	glUniform1i(textureUniformBayerDataIn_, eglImageBayerIn_->texture_unit_uniform_id_);
> +	glUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_);
>   
>   	/*
>   	 * These values are:
> @@ -542,7 +542,7 @@ int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const Debaye
>   	/* Generate the output render framebuffer as render to texture */
>   	egl_.createOutputDMABufTexture2D(*eglImageBayerOut_, output->planes()[0].fd.get());
>   
> -	setShaderVariableValues(params);
> +	setShaderVariableValues(*eglImageBayerIn_, params);
>   	glViewport(0, 0, width_, height_);
>   	glClear(GL_COLOR_BUFFER_BIT);
>   	glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS);
> diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h
> index 4c7c86472..348d7305b 100644
> --- a/src/libcamera/software_isp/debayer_egl.h
> +++ b/src/libcamera/software_isp/debayer_egl.h
> @@ -65,7 +65,7 @@ private:
>   	static int getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config);
>   	int initBayerShaders(PixelFormat inputFormat, PixelFormat outputFormat);
>   	int getShaderVariableLocations();
> -	void setShaderVariableValues(const DebayerParams &params);
> +	void setShaderVariableValues(eGLImage &eGLImageIn, const DebayerParams &params);
>   	int debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams &params, std::optional<MappedFrameBuffer> *mappedInputBuffer, std::optional<DmaSyncer> *inputBufferDmaSyncer);
>   
>   	/* Shader program identifiers */

LGTM.

Reviewed-by: Robert Mader <robert.mader@collabora.com>

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp
index cdceacf96..f6b7b11e1 100644
--- a/src/libcamera/software_isp/debayer_egl.cpp
+++ b/src/libcamera/software_isp/debayer_egl.cpp
@@ -397,7 +397,7 @@  uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const
 	return info.stride(size.width, 0, 256);
 }
 
-void DebayerEGL::setShaderVariableValues(const DebayerParams &params)
+void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerParams &params)
 {
 	/*
 	 * Raw Bayer 8-bit, and packed raw Bayer 10-bit/12-bit formats
@@ -453,7 +453,7 @@  void DebayerEGL::setShaderVariableValues(const DebayerParams &params)
 	 * To simultaneously sample multiple textures we need to use multiple
 	 * texture units
 	 */
-	glUniform1i(textureUniformBayerDataIn_, eglImageBayerIn_->texture_unit_uniform_id_);
+	glUniform1i(textureUniformBayerDataIn_, eglImageIn.texture_unit_uniform_id_);
 
 	/*
 	 * These values are:
@@ -542,7 +542,7 @@  int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const Debaye
 	/* Generate the output render framebuffer as render to texture */
 	egl_.createOutputDMABufTexture2D(*eglImageBayerOut_, output->planes()[0].fd.get());
 
-	setShaderVariableValues(params);
+	setShaderVariableValues(*eglImageBayerIn_, params);
 	glViewport(0, 0, width_, height_);
 	glClear(GL_COLOR_BUFFER_BIT);
 	glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS);
diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h
index 4c7c86472..348d7305b 100644
--- a/src/libcamera/software_isp/debayer_egl.h
+++ b/src/libcamera/software_isp/debayer_egl.h
@@ -65,7 +65,7 @@  private:
 	static int getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config);
 	int initBayerShaders(PixelFormat inputFormat, PixelFormat outputFormat);
 	int getShaderVariableLocations();
-	void setShaderVariableValues(const DebayerParams &params);
+	void setShaderVariableValues(eGLImage &eGLImageIn, const DebayerParams &params);
 	int debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams &params, std::optional<MappedFrameBuffer> *mappedInputBuffer, std::optional<DmaSyncer> *inputBufferDmaSyncer);
 
 	/* Shader program identifiers */