gl_drm: Check EGL client extensions before using platform_base

The comment here was right, we shouldn't just trust these without testing
if we should trust these.
This commit is contained in:
Derek Foreman 2018-03-08 11:15:05 -06:00
parent 3a15195088
commit 37b9a246ba
1 changed files with 13 additions and 7 deletions

View File

@ -144,15 +144,21 @@ static Eina_Bool
_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");
dlsym_eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
{
const char *exts;
exts = eglQueryString(NULL, EGL_EXTENSIONS);
if (exts && strstr(exts, "EGL_EXT_platform_base"))
{
dlsym_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
eglGetProcAddress("eglGetPlatformDisplayEXT");
dlsym_eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
}
}
#endif
_init = 1;
return EINA_TRUE;