[23/30] libcamera: software_isp: egl: Add method lookups for GPU benchmark rountines
diff mbox series

Message ID 20260618122245.946138-24-bryan.odonoghue@linaro.org
State New
Headers show
Series
  • RFC/RFT: gpuisp: Multipass with speed optimisations on top
Related show

Commit Message

Bryan O'Donoghue June 18, 2026, 12:22 p.m. UTC
Add lookups for:

- glBeingQuery
- glEndQuery
- glGetAueryObjectuiv
- glGetAueryObjectui64v

Used in the right way these methods will allows us to interrogate exactly
how long each GPUISP pass takes.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 include/libcamera/internal/egl.h |  5 +++++
 src/libcamera/egl.cpp            | 30 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

Patch
diff mbox series

diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
index d3749d2e7..0e57678e8 100644
--- a/include/libcamera/internal/egl.h
+++ b/include/libcamera/internal/egl.h
@@ -146,5 +146,10 @@  private:
 	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
 	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
 	PFNGLGETSTRINGPROC glGetString;
+	PFNGLBEGINQUERYPROC glBeginQuery;
+	PFNGLENDQUERYPROC glEndQuery;
+	PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv;
+	PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectui64v;
+	PFNGLGENQUERIESPROC glGenQueries;
 };
 } //namespace libcamera
diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
index 8d135e092..2fc10b800 100644
--- a/src/libcamera/egl.cpp
+++ b/src/libcamera/egl.cpp
@@ -390,6 +390,36 @@  int eGL::initEGLContext()
 		goto fail;
 	}
 
+	glBeginQuery = (PFNGLBEGINQUERYPROC)eglGetProcAddress("glBeginQuery");
+	if (!glBeginQuery) {
+		LOG(eGL, Error) << "glBegin not found";
+		goto fail;
+	}
+
+	glEndQuery = (PFNGLENDQUERYPROC)eglGetProcAddress("glEndQuery");
+	if (!glEndQuery) {
+		LOG(eGL, Error) << "glEndQuery not found";
+		goto fail;
+	}
+
+	glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)eglGetProcAddress("glGetQueryObjectuiv");
+	if (!glGetQueryObjectuiv) {
+		LOG(eGL, Error) << "glGetQueryObjectuiv not found";
+		goto fail;
+	}
+
+	glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUIVPROC)eglGetProcAddress("glGetQueryObjectui64v");
+	if (!glGetQueryObjectuiv) {
+		LOG(eGL, Error) << "glGetQueryObjectui64v not found";
+		goto fail;
+	}
+
+	glGenQueries = (PFNGLGENQUERIESPROC)eglGetProcAddress("glGenQueries");
+	if (!glGetQueryObjectuiv) {
+		LOG(eGL, Error) << "glGenQueries not found";
+		goto fail;
+	}
+
 	if (eglChooseConfig(display_, configAttribs, &config, 1, &numConfigs) != EGL_TRUE) {
 		LOG(eGL, Error) << "eglChooseConfig fail";
 		goto fail;