[RFC,v2,6/8] libcamera: software_isp: debayer_egl: Avoid EGL context leaks
diff mbox series

Message ID 20260810105942.1098192-7-barnabas.pocze@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: software_isp: debayer_egl: Remove some leaks
Related show

Commit Message

Barnabás Pőcze Aug. 10, 2026, 10:59 a.m. UTC
Currently each `start()` invocation causes a new EGL context to
be acquired, and only the last allocation will be properly freed
in the `eGL` destructor.

To avoid that, call `eGL::resetEGLContext()` in `stop()`.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/libcamera/software_isp/debayer_egl.cpp | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jacopo Mondi Aug. 11, 2026, 9:31 a.m. UTC | #1
Hi Barnabás

On Mon, Aug 10, 2026 at 12:59:40PM +0200, Barnabás Pőcze wrote:
> Currently each `start()` invocation causes a new EGL context to
> be acquired, and only the last allocation will be properly freed
> in the `eGL` destructor.
>
> To avoid that, call `eGL::resetEGLContext()` in `stop()`.
>
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  src/libcamera/software_isp/debayer_egl.cpp | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp
> index ede3be2352..35a5c56321 100644
> --- a/src/libcamera/software_isp/debayer_egl.cpp
> +++ b/src/libcamera/software_isp/debayer_egl.cpp
> @@ -682,6 +682,8 @@ void DebayerEGL::stop()
>
>  	if (programId_)
>  		glDeleteProgram(programId_);
> +
> +	egl_.resetEGLContext();
>  }
>
>  SizeRange DebayerEGL::sizes(PixelFormat inputFormat, const Size &inputSize)
> --
> 2.55.0
>

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp
index ede3be2352..35a5c56321 100644
--- a/src/libcamera/software_isp/debayer_egl.cpp
+++ b/src/libcamera/software_isp/debayer_egl.cpp
@@ -682,6 +682,8 @@  void DebayerEGL::stop()
 
 	if (programId_)
 		glDeleteProgram(programId_);
+
+	egl_.resetEGLContext();
 }
 
 SizeRange DebayerEGL::sizes(PixelFormat inputFormat, const Size &inputSize)