evas_object_image: Track whether an image object supports direct scanout

If an evas object is a wayland dmabuf, uses native surface 5 or higher,
and has a scanout handler set, then it meets the basic requirements for
placing on a hardware plane.
This commit is contained in:
Derek Foreman 2017-06-21 15:06:01 -05:00
parent 7e2c8c1cbd
commit 3965a663cc
2 changed files with 16 additions and 0 deletions

View File

@ -146,6 +146,7 @@ struct _Evas_Image_Data
} delayed;
Eina_Bool legacy_type : 1;
Eina_Bool skip_head : 1;
Eina_Bool can_scanout : 1;
};
/* shared functions between legacy and new eo classes */

View File

@ -1033,6 +1033,8 @@ _evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf)
evas_object_event_callback_add
(eo_obj, EVAS_CALLBACK_DEL, _on_image_native_surface_del, NULL);
o->can_scanout = EINA_FALSE;
evas_render_rendering_wait(obj->layer->evas);
_evas_image_cleanup(eo_obj, obj, o);
if (!ENFN->image_native_set) return EINA_FALSE;
@ -1040,6 +1042,19 @@ _evas_image_native_surface_set(Eo *eo_obj, Evas_Native_Surface *surf)
((surf->version < 2) ||
(surf->version > EVAS_NATIVE_SURFACE_VERSION))) return EINA_FALSE;
o->engine_data = ENFN->image_native_set(ENDT, o->engine_data, surf);
if (surf && surf->version > 4)
{
switch (surf->type)
{
case EVAS_NATIVE_SURFACE_WL_DMABUF:
if (surf->data.wl_dmabuf.scanout.handler)
o->can_scanout = EINA_TRUE;
break;
default:
break;
}
}
return (o->engine_data != NULL);
}