check glapi better and report errors sensibly if it fails init

This commit is contained in:
Carsten Haitzler 2021-08-05 14:14:31 +01:00
parent 1c225c082d
commit 0bd602b7ed
2 changed files with 16 additions and 6 deletions

View File

@ -2959,6 +2959,7 @@ e_comp_wl_query_dmabuf_formats(int max_formats, int *formats, int *num_formats)
{
*num_formats = 0;
#if EVAS_GL_API_VERSION >= 7
if (!e_comp_wl->wl.glapi) return EINA_FALSE;
if (!e_comp_wl->wl.glapi->evasglQueryDmaBufFormats) return EINA_FALSE;
return e_comp_wl->wl.glapi->evasglQueryDmaBufFormats(e_comp_wl->wl.gl, max_formats, formats, num_formats);
#else
@ -2971,6 +2972,7 @@ e_comp_wl_query_dmabuf_modifiers(int format, int max_modifiers, uint64_t *modifi
{
*num_modifiers = 0;
#if EVAS_GL_API_VERSION >= 7
if (!e_comp_wl->wl.glapi) return EINA_FALSE;
if (!e_comp_wl->wl.glapi->evasglQueryDmaBufModifiers) return EINA_FALSE;
return e_comp_wl->wl.glapi->evasglQueryDmaBufModifiers(e_comp_wl->wl.gl, format, max_modifiers, modifiers, external_only, num_modifiers);
#else
@ -2991,6 +2993,8 @@ _e_comp_wl_gl_init(void)
if (!e_comp_wl->wl.glsfc) goto end;
if (!evas_gl_make_current(e_comp_wl->wl.gl, e_comp_wl->wl.glsfc, e_comp_wl->wl.glctx)) goto end;
e_comp_wl->wl.glapi = evas_gl_context_api_get(e_comp_wl->wl.gl, e_comp_wl->wl.glctx);
if (e_comp_wl->wl.glapi)
{
if (e_comp_wl->wl.glapi->evasglBindWaylandDisplay)
e_comp->gl = e_comp_wl->wl.glapi->evasglBindWaylandDisplay(e_comp_wl->wl.gl, e_comp_wl->wl.disp);
if (e_comp->gl)
@ -2998,6 +3002,11 @@ _e_comp_wl_gl_init(void)
e_util_env_set("ELM_ACCEL", "gl");
return;
}
}
else
{
ERR("Cannot get glapi. Is osmesa installed?");
}
end:
_e_comp_wl_gl_shutdown();
}

View File

@ -591,12 +591,13 @@ e_pixmap_refresh(E_Pixmap *cp)
format = wl_shm_buffer_get_format(buffer->shm_buffer);
else if (buffer->dmabuf_buffer)
format = buffer->dmabuf_buffer->attributes.format;
else
else if (e_comp_wl->wl.glapi)
{
e_comp_wl->wl.glapi->evasglQueryWaylandBuffer
(e_comp_wl->wl.gl, buffer->resource, EGL_TEXTURE_FORMAT,
&format);
}
else return EINA_FALSE;
switch (format)
{