derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=37b9a246ba156063d9756792bd735088bcd59dc5

commit 37b9a246ba156063d9756792bd735088bcd59dc5
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Thu Mar 8 11:15:05 2018 -0600

    gl_drm: Check EGL client extensions before using platform_base
    
    The comment here was right, we shouldn't just trust these without testing
    if we should trust these.
---
 src/modules/evas/engines/gl_drm/evas_outbuf.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c 
b/src/modules/evas/engines/gl_drm/evas_outbuf.c
index a648b96d54..b28dd57f9d 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -144,15 +144,21 @@ static Eina_Bool
 _evas_outbuf_init(void)
 {
    static int _init = 0;
+
    if (_init) return EINA_TRUE;
 #ifdef EGL_MESA_platform_gbm
-   /* FIXME: Pretty sure we should be checking if EGL_EXT_platform_base
-    * exists before looking these up and trusting them?
-    */
-   dlsym_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
-         eglGetProcAddress("eglGetPlatformDisplayEXT");
-   dlsym_eglCreatePlatformWindowSurfaceEXT = 
(PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
-         eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
+   {
+     const char *exts;
+
+     exts = eglQueryString(NULL, EGL_EXTENSIONS);
+     if (exts && strstr(exts, "EGL_EXT_platform_base"))
+       {
+          dlsym_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
+                eglGetProcAddress("eglGetPlatformDisplayEXT");
+          dlsym_eglCreatePlatformWindowSurfaceEXT = 
(PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
+                eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
+       }
+   }
 #endif
    _init = 1;
    return EINA_TRUE;

-- 


Reply via email to