evas_object_image: Track whether an image object supports direct scanout
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 21 Jun 2017 20:06:01 +0000 (15:06 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 23 Jun 2017 13:15:42 +0000 (08:15 -0500)
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.

src/lib/evas/canvas/evas_image_private.h
src/lib/evas/canvas/evas_object_image.c

index 5c9f79c..a3f3a5b 100644 (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 */
index 820ca41..818c842 100644 (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);
 }