[2/6] libcamera: egl: Ensure required extensions are supported
diff mbox series

Message ID 20261126110422.362455-3-remy.alipoursafari@collabora.com
State New
Headers show
Series
  • benchmark: Add GPU benchmarking to SoftISP eGL
Related show

Commit Message

Remy Alipoursafari Nov. 26, 2026, 11:03 a.m. UTC
Ensures that the EGL context supports EGL_EXT_image_dma_buf_import, and
the OpenGL ES context supports GL_OES_EGL_image.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Signed-off-by: Remy Alipoursafari <remy.alipoursafari@collabora.com>
Reviewed-by: Robert Mader <robert.mader@collabora.com>
---
 src/libcamera/egl.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
index 8bc70b7d..f88fb7c4 100644
--- a/src/libcamera/egl.cpp
+++ b/src/libcamera/egl.cpp
@@ -460,6 +460,19 @@  int eGL::initEGLContext()
 		goto fail;
 	}
 
+#define CHECK_EXTENSION(name, func) ({                       \
+	if (!func(name)) {                                   \
+		LOG(eGL, Error) << name << " not supported"; \
+		resetEGLContext();                           \
+		goto fail;                                   \
+	}                                                    \
+})
+#define CHECK_EGL_EXTENSION(name) CHECK_EXTENSION(name, hasEGLExtension);
+#define CHECK_GLES_EXTENSION(name) CHECK_EXTENSION(name, hasGLESExtension);
+
+	CHECK_EGL_EXTENSION("EGL_EXT_image_dma_buf_import");
+	CHECK_GLES_EXTENSION("GL_OES_EGL_image");
+
 	return 0;
 fail: