From 8a3b983c53cf41be5d8a8cb24aa18a83d8038bd8 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 30 Nov 2017 12:48:08 -0600 Subject: [PATCH] ecore_wl2 wayland_shm: Move surface functions into ecore_wl2 Finish pushing these all into ecore_wl2 --- src/Makefile_Ecore_Wl2.am | 1 + src/Makefile_Evas.am | 1 - src/lib/ecore_wl2/Ecore_Wl2.h | 8 +++++ src/lib/ecore_wl2/ecore_wl2_private.h | 18 ++++++++++ .../ecore_wl2/ecore_wl2_surface.c} | 39 +++++++--------------- src/modules/evas/engines/wayland_shm/evas_engine.h | 4 --- 6 files changed, 39 insertions(+), 32 deletions(-) rename src/{modules/evas/engines/wayland_shm/evas_dmabuf.c => lib/ecore_wl2/ecore_wl2_surface.c} (87%) diff --git a/src/Makefile_Ecore_Wl2.am b/src/Makefile_Ecore_Wl2.am index 1c5971c..a794d0b 100644 --- a/src/Makefile_Ecore_Wl2.am +++ b/src/Makefile_Ecore_Wl2.am @@ -17,6 +17,7 @@ lib/ecore_wl2/ecore_wl2_display.c \ lib/ecore_wl2/ecore_wl2.c \ lib/ecore_wl2/ecore_wl2_private.h \ lib/ecore_wl2/ecore_wl2_buffer.c \ +lib/ecore_wl2/ecore_wl2_surface.c \ static_libs/libdrm/drm_fourcc.h \ static_libs/libdrm/drm.h \ static_libs/libdrm/drm_mode.h \ diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 48e6440..43ad9f7 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1320,7 +1320,6 @@ WAYLAND_SHM_SOURCES = \ modules/evas/engines/wayland_common/Evas_Engine_Wayland.h \ modules/evas/engines/wayland_shm/evas_engine.c \ modules/evas/engines/wayland_shm/evas_engine.h \ -modules/evas/engines/wayland_shm/evas_dmabuf.c \ modules/evas/engines/wayland_shm/evas_outbuf.c NODIST_WAYLAND_SHM_SOURCES = \ diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 88fbeda..b063983 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -44,6 +44,7 @@ typedef struct _Ecore_Wl2_Pointer Ecore_Wl2_Pointer; typedef struct _Ecore_Wl2_Keyboard Ecore_Wl2_Keyboard; typedef struct _Ecore_Wl2_Touch Ecore_Wl2_Touch; typedef struct _Ecore_Wl2_Offer Ecore_Wl2_Offer; +typedef struct _Ecore_Wl2_Surface Ecore_Wl2_Surface; /* matches protocol values */ typedef enum @@ -2015,6 +2016,13 @@ EAPI void ecore_wl2_buffer_discard(Ecore_Wl2_Buffer *buf); EAPI void ecore_wl2_buffer_unlock(Ecore_Wl2_Buffer *b); EAPI void ecore_wl2_buffer_destroy(Ecore_Wl2_Buffer *b); +EAPI Ecore_Wl2_Surface *ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha); +EAPI void ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface); +EAPI void ecore_wl2_surface_reconfigure(Ecore_Wl2_Surface *surface, int w, int h, uint32_t flags, Eina_Bool force); +EAPI void *ecore_wl2_surface_data_get(Ecore_Wl2_Surface *surface, int *w, int *h); +EAPI int ecore_wl2_surface_assign(Ecore_Wl2_Surface *surface); +EAPI void ecore_wl2_surface_post(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsigned int count); + # endif # undef EAPI diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index b1df67f..8b87cff 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -523,6 +523,24 @@ typedef struct Ecore_Wl2_Event_Window_WWW_Drag Eina_Bool dragging; } Ecore_Wl2_Event_Window_WWW_Drag; +typedef struct _Ecore_Wl2_Surface +{ + Ecore_Wl2_Window *wl2_win; + Ecore_Wl2_Buffer *current; + Eina_List *buffers; + + int w, h; + Eina_Bool alpha : 1; + struct + { + void (*destroy)(Ecore_Wl2_Surface *surface); + void (*reconfigure)(Ecore_Wl2_Surface *surface, int w, int h, uint32_t flags, Eina_Bool force); + void *(*data_get)(Ecore_Wl2_Surface *surface, int *w, int *h); + int (*assign)(Ecore_Wl2_Surface *surface); + void (*post)(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsigned int count); + } funcs; +} Ecore_Wl2_Surface; + Ecore_Wl2_Window *_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface); void _display_event_free(void *d, void *event EINA_UNUSED); diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/lib/ecore_wl2/ecore_wl2_surface.c similarity index 87% rename from src/modules/evas/engines/wayland_shm/evas_dmabuf.c rename to src/lib/ecore_wl2/ecore_wl2_surface.c index bd4eb5e..9a1c8ea 100644 --- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c +++ b/src/lib/ecore_wl2/ecore_wl2_surface.c @@ -1,30 +1,15 @@ -#include "evas_common_private.h" -#include "evas_private.h" -#include "evas_engine.h" +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "ecore_wl2_private.h" #include #include #include "linux-dmabuf-unstable-v1-client-protocol.h" -typedef struct _Ecore_Wl2_Surface Ecore_Wl2_Surface; -struct _Ecore_Wl2_Surface -{ - Ecore_Wl2_Window *wl2_win; - Ecore_Wl2_Buffer *current; - Eina_List *buffers; - - int w, h; - Eina_Bool alpha : 1; - struct - { - void (*destroy)(Ecore_Wl2_Surface *surface); - void (*reconfigure)(Ecore_Wl2_Surface *surface, int w, int h, uint32_t flags, Eina_Bool force); - void *(*data_get)(Ecore_Wl2_Surface *surface, int *w, int *h); - int (*assign)(Ecore_Wl2_Surface *surface); - void (*post)(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsigned int count); - } funcs; -}; +#define MAX_BUFFERS 4 static void _evas_dmabuf_surface_reconfigure(Ecore_Wl2_Surface *s, int w, int h, uint32_t flags EINA_UNUSED, Eina_Bool force) @@ -165,7 +150,7 @@ _evas_dmabuf_surface_destroy(Ecore_Wl2_Surface *s) free(s); } -void +EAPI void ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface) { EINA_SAFETY_ON_NULL_RETURN(surface); @@ -173,7 +158,7 @@ ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface) surface->funcs.destroy(surface); } -void +EAPI void ecore_wl2_surface_reconfigure(Ecore_Wl2_Surface *surface, int w, int h, uint32_t flags, Eina_Bool force) { EINA_SAFETY_ON_NULL_RETURN(surface); @@ -181,7 +166,7 @@ ecore_wl2_surface_reconfigure(Ecore_Wl2_Surface *surface, int w, int h, uint32_t surface->funcs.reconfigure(surface, w, h, flags, force); } -void * +EAPI void * ecore_wl2_surface_data_get(Ecore_Wl2_Surface *surface, int *w, int *h) { EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL); @@ -189,7 +174,7 @@ ecore_wl2_surface_data_get(Ecore_Wl2_Surface *surface, int *w, int *h) return surface->funcs.data_get(surface, w, h); } -int +EAPI int ecore_wl2_surface_assign(Ecore_Wl2_Surface *surface) { EINA_SAFETY_ON_NULL_RETURN_VAL(surface, 0); @@ -197,7 +182,7 @@ ecore_wl2_surface_assign(Ecore_Wl2_Surface *surface) return surface->funcs.assign(surface); } -void +EAPI void ecore_wl2_surface_post(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsigned int count) { EINA_SAFETY_ON_NULL_RETURN(surface); @@ -205,7 +190,7 @@ ecore_wl2_surface_post(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsign surface->funcs.post(surface, rects, count); } -Ecore_Wl2_Surface * +EAPI Ecore_Wl2_Surface * ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) { Ecore_Wl2_Surface *out; diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.h b/src/modules/evas/engines/wayland_shm/evas_engine.h index 25ce2f3..7291b40 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.h +++ b/src/modules/evas/engines/wayland_shm/evas_engine.h @@ -69,10 +69,6 @@ extern int _evas_engine_way_shm_log_dom; # include "../software_generic/Evas_Engine_Software_Generic.h" # include "Evas_Engine_Wayland.h" -# define MAX_BUFFERS 4 - -typedef struct _Ecore_Wl2_Surface Ecore_Wl2_Surface; - struct _Outbuf { int w, h; -- 2.7.4