[v2,4/4] egl: Print GLES version
diff mbox series

Message ID 20260112103740.18360-5-robert.mader@collabora.com
State New
Headers show
Series
  • GPUISP cleanups
Related show

Commit Message

Robert Mader Jan. 12, 2026, 10:37 a.m. UTC
It might come in handy to know whether 2.0 or e.g. 3.2 is used.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
---
 include/libcamera/internal/egl.h | 1 +
 src/libcamera/egl.cpp            | 8 ++++++++
 2 files changed, 9 insertions(+)

Comments

Barnabás Pőcze Jan. 12, 2026, 10:53 a.m. UTC | #1
2026. 01. 12. 11:37 keltezéssel, Robert Mader írta:
> It might come in handy to know whether 2.0 or e.g. 3.2 is used.
> 
> Signed-off-by: Robert Mader <robert.mader@collabora.com>
> ---
>   include/libcamera/internal/egl.h | 1 +
>   src/libcamera/egl.cpp            | 8 ++++++++
>   2 files changed, 9 insertions(+)
> 
> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
> index 21e2aa9df..f007f448a 100644
> --- a/include/libcamera/internal/egl.h
> +++ b/include/libcamera/internal/egl.h
> @@ -136,5 +136,6 @@ private:
>   	PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
>   	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
>   	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
> +	PFNGLGETSTRINGPROC glGetString;
>   };
>   } //namespace libcamera
> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
> index a88525279..da563ee09 100644
> --- a/src/libcamera/egl.cpp
> +++ b/src/libcamera/egl.cpp
> @@ -325,6 +325,12 @@ int eGL::initEGLContext(GBM *gbmContext)
>   		goto fail;
>   	}
>   
> +	glGetString = (PFNGLGETSTRINGPROC)eglGetProcAddress("glGetString");

reinterpret_cast would be preferable imo, but I see the others use the same.


Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


> +	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;
> @@ -340,6 +346,8 @@ int eGL::initEGLContext(GBM *gbmContext)
>   
>   	makeCurrent();
>   
> +	LOG(eGL, Info) << "EGL: GL_VERSION: " << glGetString(GL_VERSION);
> +
>   	return 0;
>   fail:
>
Kieran Bingham Jan. 12, 2026, 12:26 p.m. UTC | #2
Quoting Barnabás Pőcze (2026-01-12 10:53:24)
> 2026. 01. 12. 11:37 keltezéssel, Robert Mader írta:
> > It might come in handy to know whether 2.0 or e.g. 3.2 is used.
> > 
> > Signed-off-by: Robert Mader <robert.mader@collabora.com>
> > ---
> >   include/libcamera/internal/egl.h | 1 +
> >   src/libcamera/egl.cpp            | 8 ++++++++
> >   2 files changed, 9 insertions(+)
> > 
> > diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
> > index 21e2aa9df..f007f448a 100644
> > --- a/include/libcamera/internal/egl.h
> > +++ b/include/libcamera/internal/egl.h
> > @@ -136,5 +136,6 @@ private:
> >       PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
> >       PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
> >       PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
> > +     PFNGLGETSTRINGPROC glGetString;
> >   };
> >   } //namespace libcamera
> > diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
> > index a88525279..da563ee09 100644
> > --- a/src/libcamera/egl.cpp
> > +++ b/src/libcamera/egl.cpp
> > @@ -325,6 +325,12 @@ int eGL::initEGLContext(GBM *gbmContext)
> >               goto fail;
> >       }
> >   
> > +     glGetString = (PFNGLGETSTRINGPROC)eglGetProcAddress("glGetString");
> 
> reinterpret_cast would be preferable imo, but I see the others use the same.
> 

Keeping consistent in the file makes sense indeed.
A full update could be done later.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> 
> 
> > +     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;
> > @@ -340,6 +346,8 @@ int eGL::initEGLContext(GBM *gbmContext)
> >   
> >       makeCurrent();
> >   
> > +     LOG(eGL, Info) << "EGL: GL_VERSION: " << glGetString(GL_VERSION);
> > +
> >       return 0;
> >   fail:
> >   
>
Bryan O'Donoghue Jan. 12, 2026, 12:33 p.m. UTC | #3
On 12/01/2026 10:37, Robert Mader wrote:
> It might come in handy to know whether 2.0 or e.g. 3.2 is used.
> 
> Signed-off-by: Robert Mader <robert.mader@collabora.com>
> ---
>   include/libcamera/internal/egl.h | 1 +
>   src/libcamera/egl.cpp            | 8 ++++++++
>   2 files changed, 9 insertions(+)
> 
> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
> index 21e2aa9df..f007f448a 100644
> --- a/include/libcamera/internal/egl.h
> +++ b/include/libcamera/internal/egl.h
> @@ -136,5 +136,6 @@ private:
>   	PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
>   	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
>   	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
> +	PFNGLGETSTRINGPROC glGetString;
>   };
>   } //namespace libcamera
> diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
> index a88525279..da563ee09 100644
> --- a/src/libcamera/egl.cpp
> +++ b/src/libcamera/egl.cpp
> @@ -325,6 +325,12 @@ int eGL::initEGLContext(GBM *gbmContext)
>   		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;
> @@ -340,6 +346,8 @@ int eGL::initEGLContext(GBM *gbmContext)
> 
>   	makeCurrent();
> 
> +	LOG(eGL, Info) << "EGL: GL_VERSION: " << glGetString(GL_VERSION);
> +
>   	return 0;
>   fail:
> 
> --
> 2.52.0
> 
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

Patch
diff mbox series

diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
index 21e2aa9df..f007f448a 100644
--- a/include/libcamera/internal/egl.h
+++ b/include/libcamera/internal/egl.h
@@ -136,5 +136,6 @@  private:
 	PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
 	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
 	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+	PFNGLGETSTRINGPROC glGetString;
 };
 } //namespace libcamera
diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
index a88525279..da563ee09 100644
--- a/src/libcamera/egl.cpp
+++ b/src/libcamera/egl.cpp
@@ -325,6 +325,12 @@  int eGL::initEGLContext(GBM *gbmContext)
 		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;
@@ -340,6 +346,8 @@  int eGL::initEGLContext(GBM *gbmContext)
 
 	makeCurrent();
 
+	LOG(eGL, Info) << "EGL: GL_VERSION: " << glGetString(GL_VERSION);
+
 	return 0;
 fail: