[RFC,v1,03/10] libcamera: egl: Do not load `glGetString` dynamically
diff mbox series

Message ID 20260804101949.353266-4-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. 4, 2026, 10:19 a.m. UTC
`glGetString()` should be available in all version of OpenGL and OpenGL ES,
so there should be no need to load it with `eglGetProcAddress()` like it is
done for extension functions.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 include/libcamera/internal/egl.h | 1 -
 src/libcamera/egl.cpp            | 6 ------
 2 files changed, 7 deletions(-)

Comments

Milan Zamazal Aug. 5, 2026, 10:02 a.m. UTC | #1
Barnabás Pőcze <barnabas.pocze@ideasonboard.com> writes:

> `glGetString()` should be available in all version of OpenGL and OpenGL ES,
> so there should be no need to load it with `eglGetProcAddress()` like it is
> done for extension functions.
>
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>

> ---
>  include/libcamera/internal/egl.h | 1 -
>  src/libcamera/egl.cpp            | 6 ------
>  2 files changed, 7 deletions(-)
>
> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
> index f8ae486a8d..6abb02bf3b 100644
> --- a/include/libcamera/internal/egl.h
> +++ b/include/libcamera/internal/egl.h
> @@ -142,6 +142,5 @@ private:
>  	PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
>  	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
>  	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
> -	PFNGLGETSTRINGPROC glGetString;
>  };
>  } //namespace libcamera
> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
> index 900d2174df..0768a840e6 100644
> --- a/src/libcamera/egl.cpp
> +++ b/src/libcamera/egl.cpp
> @@ -410,12 +410,6 @@ int eGL::initEGLContext()
>  		goto fail;
>  	}
>  
> -	glGetString = (PFNGLGETSTRINGPROC)eglGetProcAddress("glGetString");
> -	if (!glGetString) {
> -		LOG(eGL, Error) << "glGetString not found";
> -		goto fail;
> -	}
> -
>  	if (eglChooseConfig(display_, configAttribs, &config, 1, &numConfigs) != EGL_TRUE) {
>  		LOG(eGL, Error) << "eglChooseConfig fail";
>  		goto fail;

Patch
diff mbox series

diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
index f8ae486a8d..6abb02bf3b 100644
--- a/include/libcamera/internal/egl.h
+++ b/include/libcamera/internal/egl.h
@@ -142,6 +142,5 @@  private:
 	PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
 	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
 	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
-	PFNGLGETSTRINGPROC glGetString;
 };
 } //namespace libcamera
diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
index 900d2174df..0768a840e6 100644
--- a/src/libcamera/egl.cpp
+++ b/src/libcamera/egl.cpp
@@ -410,12 +410,6 @@  int eGL::initEGLContext()
 		goto fail;
 	}
 
-	glGetString = (PFNGLGETSTRINGPROC)eglGetProcAddress("glGetString");
-	if (!glGetString) {
-		LOG(eGL, Error) << "glGetString not found";
-		goto fail;
-	}
-
 	if (eglChooseConfig(display_, configAttribs, &config, 1, &numConfigs) != EGL_TRUE) {
 		LOG(eGL, Error) << "eglChooseConfig fail";
 		goto fail;