raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=0bd602b7edba1ce4e1a76e93d8cdb584ac9111d1

commit 0bd602b7edba1ce4e1a76e93d8cdb584ac9111d1
Author: Carsten Haitzler <ras...@rasterman.com>
Date:   Thu Aug 5 14:14:31 2021 +0100

    check glapi better and report errors sensibly if it fails init
---
 src/bin/e_comp_wl.c | 19 ++++++++++++++-----
 src/bin/e_pixmap.c  |  3 ++-
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index c21dcc971..0df8544fa 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -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,12 +2993,19 @@ _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->evasglBindWaylandDisplay)
-     e_comp->gl = 
e_comp_wl->wl.glapi->evasglBindWaylandDisplay(e_comp_wl->wl.gl, 
e_comp_wl->wl.disp);
-   if (e_comp->gl)
+   if (e_comp_wl->wl.glapi)
      {
-        e_util_env_set("ELM_ACCEL", "gl");
-        return;
+        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)
+          {
+             e_util_env_set("ELM_ACCEL", "gl");
+             return;
+          }
+     }
+   else
+     {
+        ERR("Cannot get glapi. Is osmesa installed?");
      }
 end:
    _e_comp_wl_gl_shutdown();
diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c
index 505536442..2edace94f 100644
--- a/src/bin/e_pixmap.c
+++ b/src/bin/e_pixmap.c
@@ -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)
              {

-- 


Reply via email to