evas gl: Properly verify that Evas GL works

For SW engine we need to verify that OSMesa is present. The patch
fb048e7312 broke the logic.

Tested by temporarily removing OSMesa from my system.

Fixes T6617 (again)
This commit is contained in:
Jean-Philippe Andre 2018-01-17 15:17:59 +09:00
parent 2a31883f5a
commit 24447641d3
4 changed files with 22 additions and 2 deletions

View File

@ -147,7 +147,10 @@ evas_gl_new(Evas *e)
evas_gl->evas = efl_data_ref(e, EVAS_CANVAS_CLASS); evas_gl->evas = efl_data_ref(e, EVAS_CANVAS_CLASS);
LKI(evas_gl->lck); LKI(evas_gl->lck);
if (!evas_gl->evas->engine.func->gl_context_create) if (!evas_gl->evas->engine.func->gl_context_create ||
!evas_gl->evas->engine.func->gl_supports_evas_gl ||
!evas_gl->evas->engine.func->gl_supports_evas_gl(
_evas_engine_context(evas_gl->evas)))
{ {
ERR("Evas GL engine not available."); ERR("Evas GL engine not available.");
efl_data_unref(e, evas_gl->evas); efl_data_unref(e, evas_gl->evas);

View File

@ -1432,6 +1432,7 @@ struct _Evas_Func
int (*font_right_inset_get) (void *engine, Evas_Font_Set *font, const Evas_Text_Props *text_props); int (*font_right_inset_get) (void *engine, Evas_Font_Set *font, const Evas_Text_Props *text_props);
/* EFL-GL Glue Layer */ /* EFL-GL Glue Layer */
Eina_Bool (*gl_supports_evas_gl) (void *engine);
void *(*gl_output_set) (void *engine, void *output); void *(*gl_output_set) (void *engine, void *output);
void *(*gl_surface_create) (void *engine, void *config, int w, int h); void *(*gl_surface_create) (void *engine, void *config, int w, int h);
void *(*gl_pbuffer_surface_create) (void *engine, void *config, int w, int h, int const *attrib_list); void *(*gl_pbuffer_surface_create) (void *engine, void *config, int w, int h, int const *attrib_list);

View File

@ -1528,6 +1528,14 @@ evgl_init(Render_Engine_GL_Generic *engine)
#define EVGLINIT(_ret) Render_Output_GL_Generic *re; if ((re = evgl_init(engine)) == NULL) return _ret #define EVGLINIT(_ret) Render_Output_GL_Generic *re; if ((re = evgl_init(engine)) == NULL) return _ret
static Eina_Bool
eng_gl_supports_evas_gl(void *engine EINA_UNUSED)
{
// Evas GL should always work... But let's do a full init anyway.
EVGLINIT(EINA_FALSE);
return EINA_TRUE;
}
static void * static void *
eng_gl_output_set(void *eng, void *output) eng_gl_output_set(void *eng, void *output)
{ {
@ -3166,6 +3174,7 @@ module_open(Evas_Module *em)
ORD(font_cache_set); ORD(font_cache_set);
ORD(font_cache_get); ORD(font_cache_get);
ORD(gl_supports_evas_gl);
ORD(gl_output_set); ORD(gl_output_set);
ORD(gl_surface_create); ORD(gl_surface_create);
ORD(gl_pbuffer_surface_create); ORD(gl_pbuffer_surface_create);

View File

@ -3461,13 +3461,19 @@ _tls_check(void)
} }
#endif #endif
static inline int static inline Eina_Bool
_check_gl(void) _check_gl(void)
{ {
if (!gl_lib_init()) return 0; if (!gl_lib_init()) return 0;
return 1; return 1;
} }
static Eina_Bool
eng_gl_supports_evas_gl(void *data EINA_UNUSED)
{
return _check_gl();
}
static void * static void *
eng_gl_surface_create(void *data EINA_UNUSED, void *config, int w, int h) eng_gl_surface_create(void *data EINA_UNUSED, void *config, int w, int h)
{ {
@ -4815,6 +4821,7 @@ static Evas_Func func =
eng_font_pen_coords_get, eng_font_pen_coords_get,
eng_font_text_props_info_create, eng_font_text_props_info_create,
eng_font_right_inset_get, eng_font_right_inset_get,
eng_gl_supports_evas_gl, // returns true iif OSMesa is present
NULL, // No need to set output for software engine NULL, // No need to set output for software engine
eng_gl_surface_create, // need software mesa for gl rendering <- gl_surface_create eng_gl_surface_create, // need software mesa for gl rendering <- gl_surface_create
NULL, // need software mesa for gl rendering <- gl_pbuffer_surface_create NULL, // need software mesa for gl rendering <- gl_pbuffer_surface_create