[v6,3/6] libcamera: egl: Add createOutputTexture2D
diff mbox series

Message ID 20260706222245.247396-4-bryan.odonoghue@linaro.org
State Accepted
Headers show
Series
  • libcamera: software_isp: gpu: Add go faster stripes
Related show

Commit Message

Bryan O'Donoghue July 6, 2026, 10:22 p.m. UTC
Creates a non-dmabuf texture attached to a frame-buffer-object FBO, which
allows for render-to-texture.

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/libcamera/internal/egl.h |  1 +
 src/libcamera/egl.cpp            | 13 +++++++++++++
 2 files changed, 14 insertions(+)

Comments

Robert Mader July 7, 2026, 7:37 a.m. UTC | #1
On 07.07.26 00:22, Bryan O'Donoghue wrote:
> Creates a non-dmabuf texture attached to a frame-buffer-object FBO, which
> allows for render-to-texture.
>
> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Robert Mader <robert.mader@collabora.com>
> ---
>   include/libcamera/internal/egl.h |  1 +
>   src/libcamera/egl.cpp            | 13 +++++++++++++
>   2 files changed, 14 insertions(+)
>
> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
> index 085a371f3..1955d09c5 100644
> --- a/include/libcamera/internal/egl.h
> +++ b/include/libcamera/internal/egl.h
> @@ -108,6 +108,7 @@ public:
>   	int createInputDMABufTexture2D(eGLImage &eglImage, int fd);
>   	int createOutputDMABufTexture2D(eGLImage &eglImage, int fd);
>   	void createTexture2D(eGLImage &eglImage, void *data);
> +	void createOutputTexture2D(eGLImage &eglImage);
>   
>   	int attachTextureToFBO(eGLImage &eglImage);
>   
> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
> index ed67aca7b..c1b5514b6 100644
> --- a/src/libcamera/egl.cpp
> +++ b/src/libcamera/egl.cpp
> @@ -329,6 +329,19 @@ bool eGL::isAvailable()
>   	return true;
>   }
>   
> +/**
> + * \brief Create a 2D texture attached to an FBO for render-to-texture
> + * \param[in,out] eglImage EGL image to associate with the texture
> + *
> + * Creates a 2D texture in VRAM. Subsequetly attach the texture to the
> + * texture unit specified in the eGLImage object.
> + */
> +void eGL::createOutputTexture2D(eGLImage &eglImage)
> +{
> +	createTexture2D(eglImage, NULL);
> +	attachTextureToFBO(eglImage);
> +}
> +
>   /**
>    * \brief Initialise the EGL context
>    *
Barnabás Pőcze July 15, 2026, 9:38 a.m. UTC | #2
2026. 07. 07. 0:22 keltezéssel, Bryan O'Donoghue írta:
> Creates a non-dmabuf texture attached to a frame-buffer-object FBO, which
> allows for render-to-texture.
> 
> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>   include/libcamera/internal/egl.h |  1 +
>   src/libcamera/egl.cpp            | 13 +++++++++++++
>   2 files changed, 14 insertions(+)
> 
> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
> index 085a371f3..1955d09c5 100644
> --- a/include/libcamera/internal/egl.h
> +++ b/include/libcamera/internal/egl.h
> @@ -108,6 +108,7 @@ public:
>   	int createInputDMABufTexture2D(eGLImage &eglImage, int fd);
>   	int createOutputDMABufTexture2D(eGLImage &eglImage, int fd);
>   	void createTexture2D(eGLImage &eglImage, void *data);
> +	void createOutputTexture2D(eGLImage &eglImage);
>   
>   	int attachTextureToFBO(eGLImage &eglImage);
>   
> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
> index ed67aca7b..c1b5514b6 100644
> --- a/src/libcamera/egl.cpp
> +++ b/src/libcamera/egl.cpp
> @@ -329,6 +329,19 @@ bool eGL::isAvailable()
>   	return true;
>   }
>   
> +/**
> + * \brief Create a 2D texture attached to an FBO for render-to-texture
> + * \param[in,out] eglImage EGL image to associate with the texture
> + *
> + * Creates a 2D texture in VRAM. Subsequetly attach the texture to the
> + * texture unit specified in the eGLImage object.
> + */
> +void eGL::createOutputTexture2D(eGLImage &eglImage)
> +{
> +	createTexture2D(eglImage, NULL);

nullptr


> +	attachTextureToFBO(eglImage);
> +}
> +
>   /**
>    * \brief Initialise the EGL context
>    *

Patch
diff mbox series

diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
index 085a371f3..1955d09c5 100644
--- a/include/libcamera/internal/egl.h
+++ b/include/libcamera/internal/egl.h
@@ -108,6 +108,7 @@  public:
 	int createInputDMABufTexture2D(eGLImage &eglImage, int fd);
 	int createOutputDMABufTexture2D(eGLImage &eglImage, int fd);
 	void createTexture2D(eGLImage &eglImage, void *data);
+	void createOutputTexture2D(eGLImage &eglImage);
 
 	int attachTextureToFBO(eGLImage &eglImage);
 
diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
index ed67aca7b..c1b5514b6 100644
--- a/src/libcamera/egl.cpp
+++ b/src/libcamera/egl.cpp
@@ -329,6 +329,19 @@  bool eGL::isAvailable()
 	return true;
 }
 
+/**
+ * \brief Create a 2D texture attached to an FBO for render-to-texture
+ * \param[in,out] eglImage EGL image to associate with the texture
+ *
+ * Creates a 2D texture in VRAM. Subsequetly attach the texture to the
+ * texture unit specified in the eGLImage object.
+ */
+void eGL::createOutputTexture2D(eGLImage &eglImage)
+{
+	createTexture2D(eglImage, NULL);
+	attachTextureToFBO(eglImage);
+}
+
 /**
  * \brief Initialise the EGL context
  *