From db7348acf350c45ededa0899b58805a9c79b99e5 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 18 Oct 2019 12:49:21 +0100 Subject: [PATCH] wl egl - use platform get display if possible, use the platform specific egl get display as a wl egl client. this fixes client side init with ... some drivers that can't auto-detect the display type passed in. @fix --- .../evas/engines/wayland_egl/evas_wl_main.c | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c b/src/modules/evas/engines/wayland_egl/evas_wl_main.c index a5ae3f9f91..95e59ce9e2 100644 --- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c +++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c @@ -46,16 +46,21 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap context_attrs[1] = 2; context_attrs[2] = EGL_NONE; - /* FIXME: Remove this line as soon as eglGetDisplay() autodetection - * gets fixed. Currently it is incorrectly detecting wl_display and - * returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND. - * - * See ticket #1972 for more info. - */ - - setenv("EGL_PLATFORM", "wayland", 1); wl_disp = ecore_wl2_display_get(gw->wl2_disp); - gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)wl_disp); + const char *s = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + if (strstr(s, "EXT_platform_base")) + { + EGLDisplay (*func) (EGLenum platform, void *native_display, const EGLint *attrib_list); + func = (void *)eglGetProcAddress("eglGetPlatformDisplayEXT"); + if (!func) goto noext; + gw->egl_disp = func(EGL_PLATFORM_WAYLAND_EXT, wl_disp, NULL); + } + else + { +noext: + putenv("EGL_PLATFORM=wayland"); + gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)wl_disp); + } if (!gw->egl_disp) { ERR("eglGetDisplay() fail. code=%#x", eglGetError());