From c15fee9bccabaef9cf25c63c979bcf1c1b581906 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 14 Mar 2017 14:45:50 +0900 Subject: [PATCH] evas gl: Fix usage of OSMesa It seems OSMesa was recently updated to not expose symbols statically, so dlsym() returns invariably NULL. GetProcAddress must be used. Note though that the extension "EGL_KHR_get_all_proc_addresses" is not present (OSMesa is OpenGL, not GLES), and there is anyway no list of extensions in OSMesa (at the WSI level, glGetString() returns a ton of GL extensions as expected). My OSMesa version is 11.2.0 (mesa 17.0.1). This fixes make check. @fix --- .../engines/software_generic/evas_engine.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index 039459c9a2..0d2bced46e 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c @@ -4872,14 +4872,20 @@ glue_sym_init(void) return 1; } -static int +static Eina_Bool gl_sym_init(void) { + Eina_Bool ok = EINA_TRUE; + //------------------------------------------------// -#define FINDSYM(dst, sym, typ) \ +#define FINDSYM(dst, sym, typ) do { \ if (!dst) dst = (typeof(dst))dlsym(gl_lib_handle, sym); \ - if (!dst) DBG("Symbol not found: %s", sym); -#define FALLBAK(dst, typ) if (!dst) dst = (typeof(dst))sym_missing; + if (!dst && _sym_OSMesaGetProcAddress) dst = (typeof(dst))_sym_OSMesaGetProcAddress(sym); \ + if (!dst) DBG("Symbol not found: %s", sym); \ + } while (0) +#define FALLBAK(dst, typ) do { \ + if (!dst) { dst = (typeof(dst))sym_missing; ok = EINA_FALSE; } \ + } while (0) //------------------------------------------------------// // GLES 2.0 APIs... @@ -5326,7 +5332,10 @@ gl_sym_init(void) gl_lib_is_gles = 1; } - return 1; + if (!ok) + ERR("Evas failed to initialize OSMesa for OpenGL with the software engine!"); + + return ok; } //--------------------------------------------------------------//