evas-wayland-shm: Don't call surface commit until we've setup the frame listener
authorChris Michael <cp.michael@samsung.com>
Mon, 27 Jul 2015 19:53:02 +0000 (15:53 -0400)
committerChris Michael <cp.michael@samsung.com>
Mon, 27 Jul 2015 19:53:02 +0000 (15:53 -0400)
Summary: This fixes an issue where we may been missing a frame
callback due to the wl_surface_commit being called before the frame
callback listener was setup. Now we will setup the frame callback
listener before doing any wl_surface_commit so that we don't miss
frames.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/modules/evas/engines/wayland_shm/evas_outbuf.c
src/modules/evas/engines/wayland_shm/evas_shm.c

index 7571566..3d3bea8 100644 (file)
@@ -162,11 +162,11 @@ _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;
 
-        _evas_shm_surface_redraw(ob->surface);
-
         /* force a buffer swap */
         _evas_shm_surface_swap(ob->surface, result, n);
 
+        _evas_shm_surface_redraw(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++;
           }
 
-        _evas_shm_surface_redraw(ob->surface);
-
         /* force a buffer swap */
         _evas_shm_surface_swap(ob->surface, result, n);
+
+        _evas_shm_surface_redraw(ob->surface);
      }
 }
 
index 724f42c..f483823 100644 (file)
@@ -62,6 +62,9 @@ _shm_pool_make(struct wl_shm *shm, int size, void **data)
         goto fd_err;
      }
 
+   /* NB: Commented out. Used for debugging rendering issues */
+   /* memset(*data, 127, size); */
+
    /* create wl_shm_pool using fd */
    pool = wl_shm_create_pool(shm, fd, size);
 
@@ -438,9 +441,6 @@ _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int
    else
      wl_surface_damage(surface->surface, 0, 0, leaf->w, leaf->h);
 
-   wl_surface_commit(surface->surface);
-
-   leaf->busy = 1;
    surface->dx = 0;
    surface->dy = 0;
    surface->redraw = EINA_TRUE;
@@ -487,6 +487,8 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
 void 
 _evas_shm_surface_redraw(Shm_Surface *surface)
 {
+   Shm_Leaf *leaf = NULL;
+
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
    if (surface->frame_cb)
@@ -499,4 +501,9 @@ _evas_shm_surface_redraw(Shm_Surface *surface)
 
    surface->frame_cb = wl_surface_frame(surface->surface);
    wl_callback_add_listener(surface->frame_cb, &_shm_frame_listener, surface);
+
+   wl_surface_commit(surface->surface);
+
+   leaf = &surface->leaf[surface->curr_buff];
+   leaf->busy = 1;
 }