summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-04-16 03:15:31 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-04-16 03:15:31 +0000
commit4263c087604264f282e846f91fb8e8c484762ac5 (patch)
tree897cc2f4d4786eafc94c8dcc9dc80c49bab1222c /src/modules
parent5b174443130d6079d1e02b7985577a52ea215b17 (diff)
evas gl - drm - native bind - handle null eglimage create on bind
this can happen if dmabuf is invalid (already destroyed) so handle this so evas knows and falls back to rendering a rect and complains to stderr so we know @fix
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c24
-rw-r--r--src/modules/evas/engines/gl_drm/evas_engine.c20
3 files changed, 37 insertions, 9 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 2d9d825a75..baa1660d66 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -367,6 +367,7 @@ struct _Evas_Engine_GL_Context
367 Eina_List *font_glyph_textures; 367 Eina_List *font_glyph_textures;
368 Eina_List *font_glyph_images; 368 Eina_List *font_glyph_images;
369 Evas_GL_Image *def_surface; 369 Evas_GL_Image *def_surface;
370 Evas_GL_Image *err_img;
370 RGBA_Image *font_surface; 371 RGBA_Image *font_surface;
371 int font_glyph_textures_size; 372 int font_glyph_textures_size;
372 int font_glyph_atlas_size; 373 int font_glyph_atlas_size;
@@ -479,6 +480,7 @@ struct _Evas_GL_Image
479 Eina_Bool yinvert : 1; 480 Eina_Bool yinvert : 1;
480 Eina_Bool mipmap : 1; 481 Eina_Bool mipmap : 1;
481 Eina_Bool loose : 1; 482 Eina_Bool loose : 1;
483 Eina_Bool invalid : 1;
482 } native; 484 } native;
483 485
484 struct { 486 struct {
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index 26ff021cd4..af51f9626e 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -1180,6 +1180,7 @@ evas_gl_common_context_new(void)
1180 _evas_gl_common_viewport_set(gc); 1180 _evas_gl_common_viewport_set(gc);
1181 1181
1182 gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1, EINA_FALSE); 1182 gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1, EINA_FALSE);
1183 gc->err_img = evas_gl_common_image_surface_new(gc, 1, 1, 0, EINA_FALSE);
1183 1184
1184 return gc; 1185 return gc;
1185 1186
@@ -1428,6 +1429,7 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
1428 if (gc->references > 0) return; 1429 if (gc->references > 0) return;
1429 if (gc->shared) gc->shared->references--; 1430 if (gc->shared) gc->shared->references--;
1430 1431
1432 if (gc->err_img) evas_gl_common_image_free(gc->err_img);
1431 if (gc->def_surface) evas_gl_common_image_free(gc->def_surface); 1433 if (gc->def_surface) evas_gl_common_image_free(gc->def_surface);
1432 1434
1433 if (gc->font_surface) 1435 if (gc->font_surface)
@@ -4035,7 +4037,27 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
4035 if (!gc->pipe[i].array.im->native.loose) 4037 if (!gc->pipe[i].array.im->native.loose)
4036 { 4038 {
4037 if (gc->pipe[i].array.im->native.func.bind) 4039 if (gc->pipe[i].array.im->native.func.bind)
4038 gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im); 4040 {
4041 gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im);
4042 if (gc->pipe[i].array.im->native.invalid)
4043 {
4044 fprintf(stderr,
4045 "Evas GL: native bind failed for %ix%i image\n",
4046 gc->pipe[i].array.im->w,
4047 gc->pipe[i].array.im->h);
4048 if ((gc->err_img) &&
4049 (gc->err_img->tex) &&
4050 (gc->err_img->tex->pt))
4051 {
4052 glActiveTexture(GL_TEXTURE0);
4053 glBindTexture
4054 (GL_TEXTURE_2D,
4055 gc->err_img->tex->pt->texture);
4056 gc->pipe[i].shader.cur_tex =
4057 gc->err_img->tex->pt->texture;
4058 }
4059 }
4060 }
4039 } 4061 }
4040 } 4062 }
4041 } 4063 }
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c
index 3ecea196c5..d59f762160 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.c
+++ b/src/modules/evas/engines/gl_drm/evas_engine.c
@@ -798,15 +798,17 @@ _native_cb_bind(void *image)
798 798
799 if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF) 799 if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
800 { 800 {
801 void *v;
802
803 /* Must re-import every time for coherency. */ 801 /* Must re-import every time for coherency. */
804 if (n->ns_data.wl_surface_dmabuf.image) 802 if (n->ns_data.wl_surface_dmabuf.image)
805 glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image); 803 glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
806 v = gl_import_simple_dmabuf(img->native.disp, &n->ns_data.wl_surface_dmabuf.attr); 804 n->ns_data.wl_surface_dmabuf.image = gl_import_simple_dmabuf(img->native.disp, &n->ns_data.wl_surface_dmabuf.attr);
807 if (!v) return; 805 if (!n->ns_data.wl_surface_dmabuf.image)
808 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, v); 806 {
809 n->ns_data.wl_surface_dmabuf.image = v; 807 img->native.invalid = EINA_TRUE;
808 return;
809 }
810 img->native.invalid = EINA_FALSE;
811 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface_dmabuf.image);
810 } 812 }
811 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL) 813 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
812 { 814 {
@@ -839,8 +841,10 @@ _native_cb_unbind(void *image)
839 if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF) 841 if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
840 { 842 {
841 if (n->ns_data.wl_surface_dmabuf.image) 843 if (n->ns_data.wl_surface_dmabuf.image)
842 glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image); 844 {
843 n->ns_data.wl_surface_dmabuf.image = NULL; 845 glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
846 n->ns_data.wl_surface_dmabuf.image = NULL;
847 }
844 } 848 }
845 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL) 849 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
846 { 850 {