evas: Add wayland dmabuf native surface type
authorDerek Foreman <derekf@osg.samsung.com>
Tue, 17 May 2016 18:42:32 +0000 (13:42 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Wed, 18 May 2016 16:52:24 +0000 (11:52 -0500)
Add the structures required for supporting dmabuf native surfaces

src/lib/evas/Evas_Legacy.h
src/modules/evas/engines/software_generic/evas_native_common.h

index 24297eb..d5f9388 100644 (file)
@@ -2560,6 +2560,7 @@ typedef enum _Evas_Native_Surface_Type
    EVAS_NATIVE_SURFACE_WL, /**< Wayland system based type. buffer of surface */
    EVAS_NATIVE_SURFACE_TBM, /**< Tizen system based type. tbm surface @since 1.14  */
    EVAS_NATIVE_SURFACE_EVASGL, /**< Evas GL based type. evas gl surface @since 1.14 */
+   EVAS_NATIVE_SURFACE_WL_DMABUF, /**< Wayland system based type. using dmabuf @since 1.18 */
 } Evas_Native_Surface_Type;
 
 /**
@@ -2614,6 +2615,11 @@ struct _Evas_Native_Surface
       } wl; /**< Set this struct fields if surface data is Wayland based. */
       struct
       {
+         void *attr; /**< Pointer to dmabuf attributes - contents copied */
+         void *resource; /**< Wayland resource pointer, kept as is */
+      } wl_dmabuf; /**< Set this struct fields if surface data is Wayland dmabuf based. @since 1.18 */
+      struct
+      {
          void *buffer; /**< tbm surface buffer to use @since 1.14 */
       } tbm; /**< Set this struct fields if surface data is Tizen based. @since 1.14 */
       struct
index 0ea2b66..3b51b1a 100644 (file)
 
 //#include <Evas_Common.h>
 
+struct dmabuf_attributes
+{
+  /* This must exactly match the struct in Enlightenment.
+   * Wayland dmabuf is still an experimental protocol and may
+   * change.  If the version doesn't match we won't even attempt
+   * to read the struct.
+   */
+   int version;
+   int32_t width;
+   int32_t height;
+   uint32_t format;
+   uint32_t flags; /* enum zlinux_buffer_params_flags */
+   int n_planes;
+   int fd[4];
+   uint32_t offset[4];
+   uint32_t stride[4];
+   uint64_t modifier[4];
+};
+
 typedef struct _Native Native;
 struct _Native
 {
@@ -54,6 +73,18 @@ struct _Native
          void                     *surface; /*egl surface*/
       } wl_surface; /**< Set this struct fields if surface data is Wayland based. */
 
+       /*  EVAS_NATIVE_SURFACE_WL_DMABUF */
+      struct
+      {
+         struct dmabuf_attributes attr; /* Plane attributes of buffer */
+         void                     *resource; /* Wayland resource for buffer */
+
+         // Run-time storage for bind/unbind
+         size_t                   size; /* size of are when mmapped */
+         void                     *ptr; /* data area when mmapped */
+         void                     *image; /* EGLImage when bound for GL */
+      } wl_surface_dmabuf; /**< Set this struct fields if surface data is Wayland dmabuf based. */
+
       /* EVAS_NATIVE_SURFACE_OPENGL */
       struct
       {