summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2018-01-17 15:17:59 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-01-17 15:22:46 +0900
commit24447641d38cb9bf7b9e816d38cfeab55dae14c7 (patch)
tree865be7e425f9e54d2962ae6f9c24d0cb21585499
parent2a31883f5a53b15128a49aee17b737ec0ee1d9c2 (diff)
evas gl: Properly verify that Evas GL works
For SW engine we need to verify that OSMesa is present. The patch fb048e73120b39095cc87aa4f8d7f3d397a93c56 broke the logic. Tested by temporarily removing OSMesa from my system. Fixes T6617 (again)
-rw-r--r--src/lib/evas/canvas/evas_gl.c5
-rw-r--r--src/lib/evas/include/evas_private.h1
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c9
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c9
4 files changed, 22 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/evas_gl.c b/src/lib/evas/canvas/evas_gl.c
index a54de42236..62b7a3fa0f 100644
--- a/src/lib/evas/canvas/evas_gl.c
+++ b/src/lib/evas/canvas/evas_gl.c
@@ -147,7 +147,10 @@ evas_gl_new(Evas *e)
147 evas_gl->evas = efl_data_ref(e, EVAS_CANVAS_CLASS); 147 evas_gl->evas = efl_data_ref(e, EVAS_CANVAS_CLASS);
148 LKI(evas_gl->lck); 148 LKI(evas_gl->lck);
149 149
150 if (!evas_gl->evas->engine.func->gl_context_create) 150 if (!evas_gl->evas->engine.func->gl_context_create ||
151 !evas_gl->evas->engine.func->gl_supports_evas_gl ||
152 !evas_gl->evas->engine.func->gl_supports_evas_gl(
153 _evas_engine_context(evas_gl->evas)))
151 { 154 {
152 ERR("Evas GL engine not available."); 155 ERR("Evas GL engine not available.");
153 efl_data_unref(e, evas_gl->evas); 156 efl_data_unref(e, evas_gl->evas);
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 168a7569d6..7c43a64295 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1432,6 +1432,7 @@ struct _Evas_Func
1432 int (*font_right_inset_get) (void *engine, Evas_Font_Set *font, const Evas_Text_Props *text_props); 1432 int (*font_right_inset_get) (void *engine, Evas_Font_Set *font, const Evas_Text_Props *text_props);
1433 1433
1434 /* EFL-GL Glue Layer */ 1434 /* EFL-GL Glue Layer */
1435 Eina_Bool (*gl_supports_evas_gl) (void *engine);
1435 void *(*gl_output_set) (void *engine, void *output); 1436 void *(*gl_output_set) (void *engine, void *output);
1436 void *(*gl_surface_create) (void *engine, void *config, int w, int h); 1437 void *(*gl_surface_create) (void *engine, void *config, int w, int h);
1437 void *(*gl_pbuffer_surface_create) (void *engine, void *config, int w, int h, int const *attrib_list); 1438 void *(*gl_pbuffer_surface_create) (void *engine, void *config, int w, int h, int const *attrib_list);
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index d5c8544fda..b0edce0255 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1528,6 +1528,14 @@ evgl_init(Render_Engine_GL_Generic *engine)
1528 1528
1529#define EVGLINIT(_ret) Render_Output_GL_Generic *re; if ((re = evgl_init(engine)) == NULL) return _ret 1529#define EVGLINIT(_ret) Render_Output_GL_Generic *re; if ((re = evgl_init(engine)) == NULL) return _ret
1530 1530
1531static Eina_Bool
1532eng_gl_supports_evas_gl(void *engine EINA_UNUSED)
1533{
1534 // Evas GL should always work... But let's do a full init anyway.
1535 EVGLINIT(EINA_FALSE);
1536 return EINA_TRUE;
1537}
1538
1531static void * 1539static void *
1532eng_gl_output_set(void *eng, void *output) 1540eng_gl_output_set(void *eng, void *output)
1533{ 1541{
@@ -3166,6 +3174,7 @@ module_open(Evas_Module *em)
3166 ORD(font_cache_set); 3174 ORD(font_cache_set);
3167 ORD(font_cache_get); 3175 ORD(font_cache_get);
3168 3176
3177 ORD(gl_supports_evas_gl);
3169 ORD(gl_output_set); 3178 ORD(gl_output_set);
3170 ORD(gl_surface_create); 3179 ORD(gl_surface_create);
3171 ORD(gl_pbuffer_surface_create); 3180 ORD(gl_pbuffer_surface_create);
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 209ce71dbe..d1085c3665 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -3461,13 +3461,19 @@ _tls_check(void)
3461} 3461}
3462#endif 3462#endif
3463 3463
3464static inline int 3464static inline Eina_Bool
3465_check_gl(void) 3465_check_gl(void)
3466{ 3466{
3467 if (!gl_lib_init()) return 0; 3467 if (!gl_lib_init()) return 0;
3468 return 1; 3468 return 1;
3469} 3469}
3470 3470
3471static Eina_Bool
3472eng_gl_supports_evas_gl(void *data EINA_UNUSED)
3473{
3474 return _check_gl();
3475}
3476
3471static void * 3477static void *
3472eng_gl_surface_create(void *data EINA_UNUSED, void *config, int w, int h) 3478eng_gl_surface_create(void *data EINA_UNUSED, void *config, int w, int h)
3473{ 3479{
@@ -4815,6 +4821,7 @@ static Evas_Func func =
4815 eng_font_pen_coords_get, 4821 eng_font_pen_coords_get,
4816 eng_font_text_props_info_create, 4822 eng_font_text_props_info_create,
4817 eng_font_right_inset_get, 4823 eng_font_right_inset_get,
4824 eng_gl_supports_evas_gl, // returns true iif OSMesa is present
4818 NULL, // No need to set output for software engine 4825 NULL, // No need to set output for software engine
4819 eng_gl_surface_create, // need software mesa for gl rendering <- gl_surface_create 4826 eng_gl_surface_create, // need software mesa for gl rendering <- gl_surface_create
4820 NULL, // need software mesa for gl rendering <- gl_pbuffer_surface_create 4827 NULL, // need software mesa for gl rendering <- gl_pbuffer_surface_create