[RFC,v2,3/8] libcamera: egl: Do not load `glGetString` dynamically
diff mbox series

Message ID 20260810105942.1098192-4-barnabas.pocze@ideasonboard.com
State New
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
`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. 10, 2026, 1:19 p.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;
Barnabás Pőcze Aug. 10, 2026, 1:21 p.m. UTC | #2
2026. 08. 10. 15:19 keltezéssel, Milan Zamazal írta:
> 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>

Sorry, I must have missed it in v1.


> 
>> ---
>>   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;