From c964c7236622c34429691f1262492fb9397e135a Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Thu, 19 Mar 2015 17:52:53 +0900 Subject: [PATCH] evas/gl_x11: set EGL_PLATFORM environment variable Summary: Without EGL_PLATFORM environment variable, eglInitialize() can be failed because egl tried to load DRM platform instead of X11 platform and it tried to handle XDisplay pointer as a gbm_device pointer as well. The failure seems to be occured especially if the egl was built with DRM platform as native platform. This revision can prevent the failure by indicating proper egl platform using EGL_PLATFORM environment variable, and additionally it will unset EGL_PLATFORM environment value when the engine free its info. @fix Reviewers: gwanglim, seoz, jaehwan, cedric, raster Subscribers: raster, cedric Differential Revision: https://phab.enlightenment.org/D1844 --- src/modules/evas/engines/gl_x11/evas_engine.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c index fd119e3eb2..ebdc20cac1 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.c +++ b/src/modules/evas/engines/gl_x11/evas_engine.c @@ -2727,6 +2727,7 @@ static int module_open(Evas_Module *em) { static Eina_Bool xrm_inited = EINA_FALSE; + const char *platform_env = NULL; if (!xrm_inited) { xrm_inited = EINA_TRUE; @@ -2767,8 +2768,14 @@ module_open(Evas_Module *em) // gl_current_surface_get is in gl generic ORD(gl_current_context_get); + if (!(platform_env = getenv("EGL_PLATFORM"))) + setenv("EGL_PLATFORM", "x11", 0); + gl_symbols(); + if (!platform_env) + unsetenv("EGL_PLATFORM"); + /* now advertise out own api */ em->functions = (void *)(&func); return 1;