jpeg pushed a commit to branch efl-1.18.

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

commit f3c05ef1447ae5721e911a311faa395256a764dd
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Dec 1 15:26:11 2016 +0900

    evas/x11: Fix EGL engine for recent nvidia binary
    
    Thank you NVIDIA for breaking your drivers regularly!
    eglGetDisplay(x11_display) should work but was consistently
    returning 0 instead.
    
    Apparently EGL 1.5 introduced "eglGetPlatformDisplay" that
    is more advanced to open a display. So, prefer that over
    eglGetDisplay if it's available.
    
    @fix
---
 src/modules/evas/engines/gl_x11/evas_x_main.c | 30 +++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c 
b/src/modules/evas/engines/gl_x11/evas_x_main.c
index 85f991d..7879c5e 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -149,6 +149,32 @@ _visuals_hash_index_get_from_info(Evas_Engine_Info_GL_X11 
*info)
                                   info->msaa_bits);
 }
 
+#ifdef GL_GLES
+
+#ifndef EGL_PLATFORM_X11_KHR
+# define EGL_PLATFORM_X11_KHR 0x31D5
+#endif
+
+static EGLDisplay *
+_x11_eglGetDisplay(Display *x11_display)
+{
+   EGLDisplay (*eglsym_eglGetPlatformDisplay)
+         (EGLenum platform, void *native_display, const EGLAttrib 
*attrib_list) = NULL;
+   EGLDisplay *egldisp = EGL_NO_DISPLAY;
+
+   eglsym_eglGetPlatformDisplay = dlsym(RTLD_DEFAULT, "eglGetPlatformDisplay");
+   if (eglsym_eglGetPlatformDisplay)
+     {
+        egldisp = eglsym_eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
+                                               (EGLNativeDisplayType) 
x11_display, NULL);
+        if (egldisp) return egldisp;
+     }
+
+   return eglGetDisplay((EGLNativeDisplayType) x11_display);
+}
+
+#endif
+
 Outbuf *
 eng_window_new(Evas_Engine_Info_GL_X11 *info,
                Evas *e,
@@ -220,7 +246,7 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
 // EGL / GLES
 #ifdef GL_GLES
    gw->gles3 = gles3_supported;
-   gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp));
+   gw->egl_disp = _x11_eglGetDisplay(gw->disp);
    if (!gw->egl_disp)
      {
         ERR("eglGetDisplay() fail. code=%#x", eglGetError());
@@ -861,7 +887,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
    const char *eglexts, *s;
    int depth = DefaultDepth(einfo->info.display, einfo->info.screen);
 
-   egl_disp = eglGetDisplay((EGLNativeDisplayType)(einfo->info.display));
+   egl_disp = _x11_eglGetDisplay(einfo->info.display);
    if (!egl_disp)
      {
         free(evis);

-- 


Reply via email to