ecore_wl2: Move dmabuf surface specific tests into their own function

Refactoring to allow non-dmabuf surface managers.
This commit is contained in:
Derek Foreman 2018-01-25 14:28:23 -06:00
parent 601f9cc484
commit bf4b828cb6
1 changed files with 19 additions and 11 deletions

View File

@ -11,6 +11,24 @@
#define MAX_BUFFERS 4
static Eina_Bool
_evas_dmabuf_surface_check(Ecore_Wl2_Window *win)
{
Ecore_Wl2_Display *ewd;
Ecore_Wl2_Buffer_Type types = 0;
ewd = ecore_wl2_window_display_get(win);
if (ecore_wl2_display_shm_get(ewd))
types |= ECORE_WL2_BUFFER_SHM;
if (ecore_wl2_display_dmabuf_get(ewd))
types |= ECORE_WL2_BUFFER_DMABUF;
if (!ecore_wl2_buffer_init(ewd, types))
return EINA_FALSE;
return EINA_TRUE;
}
static void
_evas_dmabuf_surface_reconfigure(Ecore_Wl2_Surface *s, int w, int h, uint32_t flags EINA_UNUSED, Eina_Bool force)
{
@ -215,8 +233,6 @@ EAPI Ecore_Wl2_Surface *
ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
{
Ecore_Wl2_Surface *out;
Ecore_Wl2_Display *ewd;
Ecore_Wl2_Buffer_Type types = 0;
EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
@ -225,19 +241,11 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha)
out = calloc(1, sizeof(*out));
if (!out) return NULL;
out->wl2_win = win;
ewd = ecore_wl2_window_display_get(win);
if (ecore_wl2_display_shm_get(ewd))
types |= ECORE_WL2_BUFFER_SHM;
if (ecore_wl2_display_dmabuf_get(ewd))
types |= ECORE_WL2_BUFFER_DMABUF;
out->alpha = alpha;
out->w = 0;
out->h = 0;
/* create surface buffers */
if (!ecore_wl2_buffer_init(ewd, types)) goto err;
if (!_evas_dmabuf_surface_check(win)) goto err;
out->funcs.destroy = _evas_dmabuf_surface_destroy;
out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure;