derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e3d6626c0dfde456ee0d042c506bcb2c8e4d614f

commit e3d6626c0dfde456ee0d042c506bcb2c8e4d614f
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Mon Nov 27 16:08:39 2017 -0600

    wayland_shm: Move surface create into dmabuf code
    
    These functions can be combined since there's now only the dmabuf
    path.
---
 src/modules/evas/engines/wayland_shm/evas_dmabuf.c | 37 +++++++++++++---------
 src/modules/evas/engines/wayland_shm/evas_engine.h |  2 +-
 src/modules/evas/engines/wayland_shm/evas_outbuf.c | 16 ----------
 3 files changed, 23 insertions(+), 32 deletions(-)

diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c 
b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
index 04dd30892d..e2cd550539 100644
--- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c
@@ -165,37 +165,44 @@ _evas_dmabuf_surface_destroy(Surface *s)
    free(surface);
 }
 
-Eina_Bool
-_evas_dmabuf_surface_create(Surface *s)
+Surface *
+_evas_surface_create(Evas_Engine_Info_Wayland *info, Outbuf *ob)
 {
+   Surface *out = NULL;
+   Dmabuf_Surface *surf = NULL;
    Ecore_Wl2_Display *ewd;
    Ecore_Wl2_Buffer_Type types = 0;
-   Dmabuf_Surface *surf = NULL;
 
-   ewd = s->info->info.wl2_display;
+   out = calloc(1, sizeof(*out));
+   if (!out) return NULL;
+   out->info = info;
+   out->ob = ob;
+
+   ewd = info->info.wl2_display;
    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 (!(s->surf.dmabuf = calloc(1, sizeof(Dmabuf_Surface)))) return 
EINA_FALSE;
-   surf = s->surf.dmabuf;
+   if (!(surf = calloc(1, sizeof(Dmabuf_Surface)))) goto err;
+   out->surf.dmabuf = surf;
 
-   surf->surface = s;
-   surf->alpha = s->info->info.destination_alpha;
+   surf->surface = out;
+   surf->alpha = info->info.destination_alpha;
 
    /* create surface buffers */
    if (!ecore_wl2_buffer_init(ewd, types)) goto err;
 
-   s->funcs.destroy = _evas_dmabuf_surface_destroy;
-   s->funcs.reconfigure = _evas_dmabuf_surface_reconfigure;
-   s->funcs.data_get = _evas_dmabuf_surface_data_get;
-   s->funcs.assign = _evas_dmabuf_surface_assign;
-   s->funcs.post = _evas_dmabuf_surface_post;
+   out->funcs.destroy = _evas_dmabuf_surface_destroy;
+   out->funcs.reconfigure = _evas_dmabuf_surface_reconfigure;
+   out->funcs.data_get = _evas_dmabuf_surface_data_get;
+   out->funcs.assign = _evas_dmabuf_surface_assign;
+   out->funcs.post = _evas_dmabuf_surface_post;
 
-   return EINA_TRUE;
+   return out;
 
 err:
+   free(out);
    free(surf);
-   return EINA_FALSE;
+   return NULL;
 }
diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.h 
b/src/modules/evas/engines/wayland_shm/evas_engine.h
index 79a76ce2a7..52ca61e243 100644
--- a/src/modules/evas/engines/wayland_shm/evas_engine.h
+++ b/src/modules/evas/engines/wayland_shm/evas_engine.h
@@ -129,7 +129,7 @@ struct _Outbuf
    Eina_Bool dirty : 1;
 };
 
-Eina_Bool _evas_dmabuf_surface_create(Surface *s);
+Surface *_evas_surface_create(Evas_Engine_Info_Wayland *info, Outbuf *ob);
 
 Outbuf *_evas_outbuf_setup(int w, int h, Evas_Engine_Info_Wayland *info);
 void _evas_outbuf_free(Outbuf *ob);
diff --git a/src/modules/evas/engines/wayland_shm/evas_outbuf.c 
b/src/modules/evas/engines/wayland_shm/evas_outbuf.c
index fdcaf2138b..ddc24af7d4 100644
--- a/src/modules/evas/engines/wayland_shm/evas_outbuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_outbuf.c
@@ -9,22 +9,6 @@
 #define GREEN_MASK 0x00ff00
 #define BLUE_MASK 0x0000ff
 
-static Surface *
-_evas_surface_create(Evas_Engine_Info_Wayland *info, Outbuf *ob)
-{
-   Surface *out;
-
-   out = calloc(1, sizeof(*out));
-   if (!out) return NULL;
-   out->info = info;
-   out->ob = ob;
-
-   if (_evas_dmabuf_surface_create(out)) return out;
-
-   free(out);
-   return NULL;
-}
-
 Outbuf *
 _evas_outbuf_setup(int w, int h, Evas_Engine_Info_Wayland *info)
 {

-- 


Reply via email to