check for wayland egl extensions before starting a gl compositor

when running in software mode, evasgl performs no checking to determine
whether gl is available, leading to a crash due to missing extensions
This commit is contained in:
Mike Blumenkrantz 2015-11-04 12:18:36 -05:00
parent a8bf439f88
commit fc01d6a24c
1 changed files with 17 additions and 9 deletions

View File

@ -2645,6 +2645,18 @@ _e_comp_wl_desklock_hide(void)
e_comp_ungrab_input(1, 1);
}
static void
_e_comp_wl_gl_shutdown(void)
{
if (!e_comp->gl) return;
if (e_comp_wl->wl.glapi->evasglUnbindWaylandDisplay)
e_comp_wl->wl.glapi->evasglUnbindWaylandDisplay(e_comp_wl->wl.gl, e_comp_wl->wl.disp);
evas_gl_surface_destroy(e_comp_wl->wl.gl, e_comp_wl->wl.glsfc);
evas_gl_context_destroy(e_comp_wl->wl.gl, e_comp_wl->wl.glctx);
evas_gl_free(e_comp_wl->wl.gl);
evas_gl_config_free(e_comp_wl->wl.glcfg);
}
static void
_e_comp_wl_gl_init(void *d EINA_UNUSED)
{
@ -2656,7 +2668,10 @@ _e_comp_wl_gl_init(void *d EINA_UNUSED)
e_comp_wl->wl.glsfc = evas_gl_surface_create(e_comp_wl->wl.gl, e_comp_wl->wl.glcfg, 1, 1);
evas_gl_make_current(e_comp_wl->wl.gl, e_comp_wl->wl.glsfc, e_comp_wl->wl.glctx);
e_comp_wl->wl.glapi = evas_gl_context_api_get(e_comp_wl->wl.gl, e_comp_wl->wl.glctx);
e_comp_wl->wl.glapi->evasglBindWaylandDisplay(e_comp_wl->wl.gl, e_comp_wl->wl.disp);
if (e_comp_wl->wl.glapi->evasglBindWaylandDisplay)
e_comp_wl->wl.glapi->evasglBindWaylandDisplay(e_comp_wl->wl.gl, e_comp_wl->wl.disp);
else
_e_comp_wl_gl_shutdown();
}
/* public functions */
@ -2774,14 +2789,7 @@ e_comp_wl_shutdown(void)
free(global);
}
if (e_comp_wl->wl.shm) wl_shm_destroy(e_comp_wl->wl.shm);
if (e_comp->gl)
{
e_comp_wl->wl.glapi->evasglUnbindWaylandDisplay(e_comp_wl->wl.gl, e_comp_wl->wl.disp);
evas_gl_surface_destroy(e_comp_wl->wl.gl, e_comp_wl->wl.glsfc);
evas_gl_context_destroy(e_comp_wl->wl.gl, e_comp_wl->wl.glctx);
evas_gl_free(e_comp_wl->wl.gl);
evas_gl_config_free(e_comp_wl->wl.glcfg);
}
_e_comp_wl_gl_shutdown();
/* shutdown ecore_wayland */
ecore_wl_shutdown();