diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2017-07-21 14:00:51 -0500 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2017-07-21 14:34:50 -0500 |
commit | 736c63be3449c34678cd4f875b0f41105bb827c7 (patch) | |
tree | 4f72ffd293c48331af51ff1b89ecb1dea27be18b | |
parent | b8a760ed58993a84458eb9eda6170ee1a0f76036 (diff) | |
download | efl-736c63be3449c34678cd4f875b0f41105bb827c7.tar.gz |
gl_drm: half fix eglGetPlatformDisplayEXT usage
Just because the #define is present doesn't mean the extension is, so we're
BAILing on egl completely on some systems for no good reason at all. (saw
this on an SGX stack)
This is still wrong. I don't want to try too hard until after the upcoming
release, though.
We should actually be testing for the presence of client extensions before
attempting to do any of this. It's entirely possible that a gl stack will
return bogus functions for these from eglGetProcAddress
-rw-r--r-- | src/modules/evas/engines/gl_drm/evas_outbuf.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c b/src/modules/evas/engines/gl_drm/evas_outbuf.c index 642ac7ad0a..f51444ccb1 100644 --- a/src/modules/evas/engines/gl_drm/evas_outbuf.c +++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c @@ -174,12 +174,13 @@ _evas_outbuf_init(void) static int _init = 0; if (_init) return EINA_TRUE; #ifdef EGL_MESA_platform_gbm + /* FIXME: Pretty sure we should be checking if EGL_EXT_platform_base + * exists before looking these up and trusting them? + */ dlsym_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC) eglGetProcAddress("eglGetPlatformDisplayEXT"); - EINA_SAFETY_ON_NULL_RETURN_VAL(dlsym_eglGetPlatformDisplayEXT, EINA_FALSE); dlsym_eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT"); - EINA_SAFETY_ON_NULL_RETURN_VAL(dlsym_eglCreatePlatformWindowSurfaceEXT, EINA_FALSE); #endif _init = 1; return EINA_TRUE; @@ -225,13 +226,16 @@ _evas_outbuf_egl_setup(Outbuf *ob) else cfg_attr[n++] = 0; cfg_attr[n++] = EGL_NONE; + ob->egl.disp = EGL_NO_DISPLAY; #ifdef EGL_MESA_platform_gbm - ob->egl.disp = - dlsym_eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, ob->info->info.gbm, NULL); -#else - ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm); + if (dlsym_eglGetPlatformDisplayEXT) + ob->egl.disp = dlsym_eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, + ob->info->info.gbm, + NULL); #endif - if (ob->egl.disp == EGL_NO_DISPLAY) + if (ob->egl.disp == EGL_NO_DISPLAY) + ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm); + if (ob->egl.disp == EGL_NO_DISPLAY) { ERR("eglGetDisplay() fail. code=%#x", eglGetError()); return EINA_FALSE; @@ -288,16 +292,18 @@ _evas_outbuf_egl_setup(Outbuf *ob) } } + ob->egl.surface = EGL_NO_SURFACE; #ifdef EGL_MESA_platform_gbm - ob->egl.surface = - dlsym_eglCreatePlatformWindowSurfaceEXT(ob->egl.disp, ob->egl.config, - ob->surface, NULL); -#else - ob->egl.surface = - eglCreateWindowSurface(ob->egl.disp, ob->egl.config, - (EGLNativeWindowType)ob->surface, NULL); + if (dlsym_eglCreatePlatformWindowSurfaceEXT) + ob->egl.surface = + dlsym_eglCreatePlatformWindowSurfaceEXT(ob->egl.disp, ob->egl.config, + ob->surface, NULL); #endif if (ob->egl.surface == EGL_NO_SURFACE) + ob->egl.surface = eglCreateWindowSurface(ob->egl.disp, ob->egl.config, + (EGLNativeWindowType)ob->surface, + NULL); + if (ob->egl.surface == EGL_NO_SURFACE) { ERR("eglCreateWindowSurface() fail for %p. code=%#x", ob->surface, eglGetError()); |