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
This commit is contained in:
MinJeong Kim 2015-03-19 17:52:53 +09:00 committed by Carsten Haitzler (Rasterman)
parent 3cd2801be7
commit c964c72366
1 changed files with 7 additions and 0 deletions

View File

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