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
This commit is contained in:
Carsten Haitzler 2019-10-18 12:49:21 +01:00
parent c25ba58007
commit db7348acf3
1 changed files with 14 additions and 9 deletions

View File

@ -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());