1 #ifndef _EVAS_NATIVE_COMMON_H 2 #define _EVAS_NATIVE_COMMON_H 3 4 #ifdef EAPI 5 # undef EAPI 6 #endif 7 8 #ifdef _WIN32 9 # ifdef EFL_BUILD 10 # ifdef DLL_EXPORT 11 # define EAPI __declspec(dllexport) 12 # else 13 # define EAPI 14 # endif 15 # else 16 # define EAPI __declspec(dllimport) 17 # endif 18 #else 19 # ifdef __GNUC__ 20 # if __GNUC__ >= 4 21 # define EAPI __attribute__ ((visibility("default"))) 22 # else 23 # define EAPI 24 # endif 25 # else 26 # define EAPI 27 # endif 28 #endif 29 30 //#include <Evas_Common.h> 31 32 #define EVAS_DMABUF_ATTRIBUTE_VERSION 1 33 34 struct dmabuf_attributes 35 { 36 /* This must exactly match the struct in Enlightenment. 37 * Wayland dmabuf is still an experimental protocol and may 38 * change. If the version doesn't match we won't even attempt 39 * to read the struct. 40 */ 41 int version; 42 int32_t width; 43 int32_t height; 44 uint32_t format; 45 uint32_t flags; /* enum zlinux_buffer_params_flags */ 46 int n_planes; 47 int fd[4]; 48 uint32_t offset[4]; 49 uint32_t stride[4]; 50 uint64_t modifier[4]; 51 }; 52 53 typedef struct _Native Native; 54 struct _Native 55 { 56 Evas_Native_Surface ns; 57 union { 58 /* EVAS_NATIVE_SURFACE_X11 */ 59 struct 60 { 61 unsigned long pixmap; /* Pixmap */ 62 void *visual; /* Visual */ 63 void *display; /* Display */ 64 void *exim; /* Ecore_X_Image or Evas_DRI_Image */ 65 66 void *buffer; 67 void *config; /* egl configuration or glx configuration */ 68 void *surface; /* egl surface or glx surface */ 69 unsigned char multiple_buffer : 1; /* whether pixmap is multiple buffer */ 70 } x11; /**< Set this struct fields if surface data is SW X11 based. */ 71 72 /* EVAS_NATIVE_SURFACE_WL */ 73 struct 74 { 75 void *wl_buf; /* struct wl_buffer */ 76 void *surface; /*egl surface*/ 77 } wl_surface; /**< Set this struct fields if surface data is Wayland based. */ 78 79 /* EVAS_NATIVE_SURFACE_WL_DMABUF */ 80 struct 81 { 82 struct dmabuf_attributes attr; /* Plane attributes of buffer */ 83 void *resource; /* Wayland resource for buffer */ 84 85 // Run-time storage for bind/unbind 86 size_t size; /* size of are when mmapped */ 87 void *ptr; /* data area when mmapped */ 88 void *image; /* EGLImage when bound for GL */ 89 } wl_surface_dmabuf; /**< Set this struct fields if surface data is Wayland dmabuf based. */ 90 91 /* EVAS_NATIVE_SURFACE_OPENGL */ 92 struct 93 { 94 void *surface; /*egl surface*/ 95 } opengl; 96 97 /* EVAS_NATIVE_SURFACE_EVASGL */ 98 struct 99 { 100 void *surface; /*evas gl surface*/ 101 } evasgl; 102 103 /* EVAS_NATIVE_SURFACE_TBM */ 104 struct 105 { 106 void *buffer; /*tbm surface*/ 107 void *surface; /*egl surface*/ 108 } tbm; 109 } ns_data; /**< Choose one union data according to your surface in Evas Engine. */ 110 }; 111 112 EAPI void *_evas_native_tbm_surface_image_set(void *data, void *image, void *native); 113 EAPI int _evas_native_tbm_surface_stride_get(void *data, void *native); 114 EAPI int _evas_native_tbm_init(void); 115 EAPI void _evas_native_tbm_shutdown(void); 116 117 void *_evas_native_dmabuf_surface_image_set(void *image, void *native); 118 119 typedef void *(*Evas_Native_Tbm_Surface_Image_Set_Call)(void *data, void *image, void *native); 120 typedef int (*Evas_Native_Tbm_Surface_Stride_Get_Call)(void *data, void *native); 121 122 #endif //_EVAS_NATIVE_COMMON_H 123