From 72b1997f062e4749ea31515ae3c8253f79182838 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 17 May 2016 13:42:32 -0500 Subject: [PATCH] evas: Add wayland dmabuf native surface type Add the structures required for supporting dmabuf native surfaces --- src/lib/evas/Evas_Legacy.h | 6 ++++ .../software_generic/evas_native_common.h | 31 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 24297eb493..d5f93885e0 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -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; /** @@ -2613,6 +2614,11 @@ struct _Evas_Native_Surface void *legacy_buffer; /**< wayland client buffer to use */ } 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 */ diff --git a/src/modules/evas/engines/software_generic/evas_native_common.h b/src/modules/evas/engines/software_generic/evas_native_common.h index 0ea2b66862..3b51b1a1bc 100644 --- a/src/modules/evas/engines/software_generic/evas_native_common.h +++ b/src/modules/evas/engines/software_generic/evas_native_common.h @@ -29,6 +29,25 @@ //#include +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 {