native surface: Add scanout handlers
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 21 Jun 2017 19:10:20 +0000 (14:10 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 23 Jun 2017 13:15:42 +0000 (08:15 -0500)
When a native surface ends up on a hardware plane, the caller needs to
know about it so it can prevent the resource from being destroyed while
on scanout (which may cause an implicit page flip and a stall), and
so it knows that the content may have changed usage domains.

This adds stubs for dealing with this - only for wl dmabuf right now, but
it may be useful for other surface types later.

src/lib/evas/Evas_Legacy.h

index 3fd1fcb..523be80 100644 (file)
@@ -4254,7 +4254,7 @@ EAPI void                          evas_object_image_memfile_set(Evas_Object *ob
  * Magic version number to know what the native surface struct looks like
  */
 
-#define EVAS_NATIVE_SURFACE_VERSION 4
+#define EVAS_NATIVE_SURFACE_VERSION 5
 
 /**
  * Native surface types that image object supports
@@ -4274,6 +4274,28 @@ typedef enum _Evas_Native_Surface_Type
 } Evas_Native_Surface_Type;
 
 /**
+ * Native surface types that image object supports
+ *
+ * @see Evas_Native_Surface
+ * @see evas_object_image_native_surface_set()
+ */
+typedef enum _Evas_Native_Surface_Status
+{
+   EVAS_NATIVE_SURFACE_STATUS_SCANOUT_ON,
+   EVAS_NATIVE_SURFACE_STATUS_SCANOUT_OFF,
+   EVAS_NATIVE_SURFACE_STATUS_PLANE_ASSIGN,
+   EVAS_NATIVE_SURFACE_STATUS_PLANE_RELEASE,
+} Evas_Native_Surface_Status;
+
+typedef void (*Evas_Native_Scanout_Handler)(void *scanout_data, Evas_Native_Surface_Status status);
+
+typedef struct _Evas_Native_Scanout
+{
+   Evas_Native_Scanout_Handler handler;
+   void *data;
+} Evas_Native_Scanout;
+
+/**
  * @brief A generic datatype for engine specific native surface information.
  *
  * Please fill up Evas_Native_Surface fields that regarded with current surface
@@ -4328,6 +4350,7 @@ typedef struct _Evas_Native_Surface
       {
          void *attr; /**< Pointer to dmabuf attributes - contents copied */
          void *resource; /**< Wayland resource pointer, kept as is */
+         Evas_Native_Scanout scanout;
       } wl_dmabuf; /**< Set this struct fields if surface data is Wayland dmabuf based. @since 1.18 */
       struct
       {