[waffle] [PATCH 5/7] egl: Optionally dlsym eglGetPlatformDisplay

Chad Versace chadversary at chromium.org
Tue Oct 18 16:58:25 UTC 2016


Not yet used.
---
 src/waffle/egl/wegl_imports.h  | 4 ++++
 src/waffle/egl/wegl_platform.c | 6 ++++++
 src/waffle/egl/wegl_platform.h | 4 ++++
 3 files changed, 14 insertions(+)

diff --git a/src/waffle/egl/wegl_imports.h b/src/waffle/egl/wegl_imports.h
index 99e79c8..3f39b9e 100644
--- a/src/waffle/egl/wegl_imports.h
+++ b/src/waffle/egl/wegl_imports.h
@@ -35,6 +35,10 @@
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 
+#ifndef EGL_VERSION_1_5
+typedef intptr_t EGLAttrib;
+#endif
+
 #ifndef EGL_KHR_create_context
 #define EGL_KHR_create_context 1
 #define EGL_CONTEXT_MAJOR_VERSION_KHR                       EGL_CONTEXT_CLIENT_VERSION
diff --git a/src/waffle/egl/wegl_platform.c b/src/waffle/egl/wegl_platform.c
index 8ce0a7b..669fe38 100644
--- a/src/waffle/egl/wegl_platform.c
+++ b/src/waffle/egl/wegl_platform.c
@@ -114,6 +114,9 @@ wegl_platform_init(struct wegl_platform *self, EGLenum egl_platform)
         goto error;                                                    \
     }
 
+#define RETRIEVE_EGL_SYMBOL_OPTIONAL(function)                         \
+    self->function = dlsym(self->eglHandle, #function);
+
     RETRIEVE_EGL_SYMBOL(eglMakeCurrent);
     RETRIEVE_EGL_SYMBOL(eglGetProcAddress);
 
@@ -138,6 +141,9 @@ wegl_platform_init(struct wegl_platform *self, EGLenum egl_platform)
     RETRIEVE_EGL_SYMBOL(eglDestroySurface);
     RETRIEVE_EGL_SYMBOL(eglSwapBuffers);
 
+    // EGL 1.5
+    RETRIEVE_EGL_SYMBOL_OPTIONAL(eglGetPlatformDisplay);
+
 #undef RETRIEVE_EGL_SYMBOL
 
     self->client_extensions =
diff --git a/src/waffle/egl/wegl_platform.h b/src/waffle/egl/wegl_platform.h
index 92db3b0..4573ec2 100644
--- a/src/waffle/egl/wegl_platform.h
+++ b/src/waffle/egl/wegl_platform.h
@@ -60,6 +60,10 @@ struct wegl_platform {
     __eglMustCastToProperFunctionPointerType
        (*eglGetProcAddress)(const char *procname);
 
+    // EGL 1.5
+    EGLDisplay (*eglGetPlatformDisplay)(EGLenum platform, void *native_display,
+                                        const EGLAttrib *attrib_list);
+
     // display
     EGLDisplay (*eglGetDisplay)(EGLNativeDisplayType display_id);
     EGLBoolean (*eglInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor);
-- 
2.10.0



More information about the waffle mailing list