devilhorns pushed a commit to branch master.

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

commit 0b284d0914a3942d5a9c0ef87e6bf61b45d69044
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Tue Jul 28 09:14:31 2015 -0400

    wayland-shm: re-organize some of the swap/redraw logic
    
    Summary:
    The way things were, we'd be committing a buffer we hadn't rendered to
    yet.
    
    Now redraw() contains all the attach/damage/commit logic, and swap() is
    called afterwards to set up a new target buffer for the next render.
    
    @fix
    
    Reviewers: zmike, devilhorns
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2875
---
 src/modules/evas/engines/wayland_shm/evas_engine.h |  4 +--
 src/modules/evas/engines/wayland_shm/evas_outbuf.c | 12 +++----
 src/modules/evas/engines/wayland_shm/evas_shm.c    | 41 ++++++++++++----------
 3 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.h 
b/src/modules/evas/engines/wayland_shm/evas_engine.h
index 50def53..a4a8ade 100644
--- a/src/modules/evas/engines/wayland_shm/evas_engine.h
+++ b/src/modules/evas/engines/wayland_shm/evas_engine.h
@@ -121,9 +121,9 @@ struct _Outbuf
 Shm_Surface *_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface 
*surface, int w, int h, int num_buff, Eina_Bool alpha);
 void _evas_shm_surface_destroy(Shm_Surface *surface);
 void _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int 
w, int h, int num_buff, uint32_t flags);
-void _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, 
unsigned int count);
+void _evas_shm_surface_swap(Shm_Surface *surface);
 void *_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h);
-void _evas_shm_surface_redraw(Shm_Surface *surface);
+void _evas_shm_surface_redraw(Shm_Surface *surface, Eina_Rectangle *rects, 
unsigned int count);
 
 Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, 
Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
 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 3d3bea8..e5d6dbe 100644
--- a/src/modules/evas/engines/wayland_shm/evas_outbuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_outbuf.c
@@ -162,10 +162,10 @@ _evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects 
EINA_UNUSED, Evas_Render_Mode
         EINA_ARRAY_ITER_NEXT(&ob->priv.onebuf_regions, i, rect, it)
           result[i] = *rect;
 
-        /* force a buffer swap */
-        _evas_shm_surface_swap(ob->surface, result, n);
+        _evas_shm_surface_redraw(ob->surface, result, n);
 
-        _evas_shm_surface_redraw(ob->surface);
+        /* force a buffer swap */
+        _evas_shm_surface_swap(ob->surface);
 
         /* clean array */
         eina_array_clean(&ob->priv.onebuf_regions);
@@ -247,10 +247,10 @@ _evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects 
EINA_UNUSED, Evas_Render_Mode
              i++;
           }
 
-        /* force a buffer swap */
-        _evas_shm_surface_swap(ob->surface, result, n);
+        _evas_shm_surface_redraw(ob->surface, result, n);
 
-        _evas_shm_surface_redraw(ob->surface);
+        /* force a buffer swap */
+        _evas_shm_surface_swap(ob->surface);
      }
 }
 
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c 
b/src/modules/evas/engines/wayland_shm/evas_shm.c
index c6f63a9..dadd628 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -405,9 +405,9 @@ _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, 
int dy, int w, int h
 }
 
 void 
-_evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, unsigned 
int count)
+_evas_shm_surface_swap(Shm_Surface *surface)
 {
-   Shm_Leaf *leaf = NULL;
+   Shm_Leaf *leaf;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -424,20 +424,6 @@ _evas_shm_surface_swap(Shm_Surface *surface, 
Eina_Rectangle *rects, unsigned int
 
    surface->last_buff = surface->curr_buff;
 
-   wl_surface_attach(surface->surface, leaf->data->buffer, 0, 0);
-
-   if ((rects) && (count > 0))
-     {
-        unsigned int k = 0;
-
-        for (; k < count; k++)
-          wl_surface_damage(surface->surface, 
-                            rects[k].x, rects[k].y,
-                            rects[k].w, rects[k].h);
-     }
-   else
-     wl_surface_damage(surface->surface, 0, 0, leaf->w, leaf->h);
-
    surface->dx = 0;
    surface->dy = 0;
    surface->mapped = EINA_TRUE;
@@ -480,16 +466,33 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, 
int *h)
    return leaf->data->map;
 }
 
-void 
-_evas_shm_surface_redraw(Shm_Surface *surface)
+void
+_evas_shm_surface_redraw(Shm_Surface *surface, Eina_Rectangle *rects, unsigned 
int count)
 {
-   Shm_Leaf *leaf = NULL;
+   struct wl_callback *frame_cb;
+   Shm_Leaf *leaf;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
+   leaf = &surface->leaf[surface->curr_buff];
+   if (!leaf) return;
 
    if (!surface->surface) return;
 
+   wl_surface_attach(surface->surface, leaf->data->buffer, 0, 0);
+
+   if ((rects) && (count > 0))
+     {
+        unsigned int k = 0;
+
+        for (; k < count; k++)
+          wl_surface_damage(surface->surface,
+                            rects[k].x, rects[k].y,
+                            rects[k].w, rects[k].h);
+     }
+   else
+     wl_surface_damage(surface->surface, 0, 0, leaf->w, leaf->h);
+
    frame_cb = wl_surface_frame(surface->surface);
    wl_callback_add_listener(frame_cb, &_shm_frame_listener, surface);
 

-- 


Reply via email to