ecore_wl2 wayland_shm: Move surface functions into ecore_wl2

Finish pushing these all into ecore_wl2
This commit is contained in:
Derek Foreman 2017-11-30 12:48:08 -06:00
parent dd5edfae03
commit 8a3b983c53
6 changed files with 39 additions and 32 deletions

View File

@ -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 \

View File

@ -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 = \

View File

@ -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

View File

@ -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);

View File

@ -1,30 +1,15 @@
#include "evas_common_private.h"
#include "evas_private.h"
#include "evas_engine.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "ecore_wl2_private.h"
#include <sys/types.h>
#include <sys/stat.h>
#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;

View File

@ -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;