forked from enlightenment/efl
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
This commit is contained in:
parent
5b17444313
commit
4263c08760
|
@ -367,6 +367,7 @@ struct _Evas_Engine_GL_Context
|
||||||
Eina_List *font_glyph_textures;
|
Eina_List *font_glyph_textures;
|
||||||
Eina_List *font_glyph_images;
|
Eina_List *font_glyph_images;
|
||||||
Evas_GL_Image *def_surface;
|
Evas_GL_Image *def_surface;
|
||||||
|
Evas_GL_Image *err_img;
|
||||||
RGBA_Image *font_surface;
|
RGBA_Image *font_surface;
|
||||||
int font_glyph_textures_size;
|
int font_glyph_textures_size;
|
||||||
int font_glyph_atlas_size;
|
int font_glyph_atlas_size;
|
||||||
|
@ -479,6 +480,7 @@ struct _Evas_GL_Image
|
||||||
Eina_Bool yinvert : 1;
|
Eina_Bool yinvert : 1;
|
||||||
Eina_Bool mipmap : 1;
|
Eina_Bool mipmap : 1;
|
||||||
Eina_Bool loose : 1;
|
Eina_Bool loose : 1;
|
||||||
|
Eina_Bool invalid : 1;
|
||||||
} native;
|
} native;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -1180,6 +1180,7 @@ evas_gl_common_context_new(void)
|
||||||
_evas_gl_common_viewport_set(gc);
|
_evas_gl_common_viewport_set(gc);
|
||||||
|
|
||||||
gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1, EINA_FALSE);
|
gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1, EINA_FALSE);
|
||||||
|
gc->err_img = evas_gl_common_image_surface_new(gc, 1, 1, 0, EINA_FALSE);
|
||||||
|
|
||||||
return gc;
|
return gc;
|
||||||
|
|
||||||
|
@ -1428,6 +1429,7 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
|
||||||
if (gc->references > 0) return;
|
if (gc->references > 0) return;
|
||||||
if (gc->shared) gc->shared->references--;
|
if (gc->shared) gc->shared->references--;
|
||||||
|
|
||||||
|
if (gc->err_img) evas_gl_common_image_free(gc->err_img);
|
||||||
if (gc->def_surface) evas_gl_common_image_free(gc->def_surface);
|
if (gc->def_surface) evas_gl_common_image_free(gc->def_surface);
|
||||||
|
|
||||||
if (gc->font_surface)
|
if (gc->font_surface)
|
||||||
|
@ -4035,7 +4037,27 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
|
||||||
if (!gc->pipe[i].array.im->native.loose)
|
if (!gc->pipe[i].array.im->native.loose)
|
||||||
{
|
{
|
||||||
if (gc->pipe[i].array.im->native.func.bind)
|
if (gc->pipe[i].array.im->native.func.bind)
|
||||||
gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im);
|
{
|
||||||
|
gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im);
|
||||||
|
if (gc->pipe[i].array.im->native.invalid)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"Evas GL: native bind failed for %ix%i image\n",
|
||||||
|
gc->pipe[i].array.im->w,
|
||||||
|
gc->pipe[i].array.im->h);
|
||||||
|
if ((gc->err_img) &&
|
||||||
|
(gc->err_img->tex) &&
|
||||||
|
(gc->err_img->tex->pt))
|
||||||
|
{
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture
|
||||||
|
(GL_TEXTURE_2D,
|
||||||
|
gc->err_img->tex->pt->texture);
|
||||||
|
gc->pipe[i].shader.cur_tex =
|
||||||
|
gc->err_img->tex->pt->texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -798,15 +798,17 @@ _native_cb_bind(void *image)
|
||||||
|
|
||||||
if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
|
if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
|
||||||
{
|
{
|
||||||
void *v;
|
|
||||||
|
|
||||||
/* Must re-import every time for coherency. */
|
/* Must re-import every time for coherency. */
|
||||||
if (n->ns_data.wl_surface_dmabuf.image)
|
if (n->ns_data.wl_surface_dmabuf.image)
|
||||||
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
|
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
|
||||||
v = gl_import_simple_dmabuf(img->native.disp, &n->ns_data.wl_surface_dmabuf.attr);
|
n->ns_data.wl_surface_dmabuf.image = gl_import_simple_dmabuf(img->native.disp, &n->ns_data.wl_surface_dmabuf.attr);
|
||||||
if (!v) return;
|
if (!n->ns_data.wl_surface_dmabuf.image)
|
||||||
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, v);
|
{
|
||||||
n->ns_data.wl_surface_dmabuf.image = v;
|
img->native.invalid = EINA_TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
img->native.invalid = EINA_FALSE;
|
||||||
|
glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface_dmabuf.image);
|
||||||
}
|
}
|
||||||
else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
|
else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
|
||||||
{
|
{
|
||||||
|
@ -839,8 +841,10 @@ _native_cb_unbind(void *image)
|
||||||
if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
|
if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
|
||||||
{
|
{
|
||||||
if (n->ns_data.wl_surface_dmabuf.image)
|
if (n->ns_data.wl_surface_dmabuf.image)
|
||||||
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
|
{
|
||||||
n->ns_data.wl_surface_dmabuf.image = NULL;
|
glsym_evas_gl_common_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
|
||||||
|
n->ns_data.wl_surface_dmabuf.image = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
|
else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue