wayland-shm: When we run out of shm buffers kick the server to get some back
authorDerek Foreman <derekf@osg.samsung.com>
Thu, 30 Jul 2015 19:37:14 +0000 (15:37 -0400)
committerChris Michael <cp.michael@samsung.com>
Thu, 30 Jul 2015 19:37:21 +0000 (15:37 -0400)
Summary:
This fixes a rendering issue with wayland apps. We consume all buffers then
drop any attempted renders that take place while we have no buffers.
This fix now waits for the server to give us some buffers back.
This is the cause of T2612

@fix

 #Kansas

Reviewers: zmike, devilhorns

Reviewed By: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2897

src/modules/evas/engines/wayland_shm/evas_shm.c

index 705100c..bb9f270 100644 (file)
@@ -406,25 +406,35 @@ _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h
      }
 }
 
-Eina_Bool
-_evas_shm_surface_assign(Shm_Surface *surface)
+static Shm_Leaf *
+_evas_shm_surface_wait(Shm_Surface *surface)
 {
-   int i;
-   surface->current = NULL;
+   int iterations = 0, i;
 
-   for (i = 0; i < surface->num_buff; i++)
+   while (iterations++ < 10)
      {
-        if (surface->leaf[i].busy) continue;
-        if (surface->leaf[i].valid)
+        for (i = 0; i < surface->num_buff; i++)
           {
-             surface->current = &surface->leaf[i];
-             break;
+             if (surface->leaf[i].busy) continue;
+             if (surface->leaf[i].valid) return &surface->leaf[i];
           }
+
+        wl_display_dispatch(surface->disp);
      }
+   return NULL;
+}
+
+Eina_Bool
+_evas_shm_surface_assign(Shm_Surface *surface)
+{
+   int i;
+
+   surface->current = _evas_shm_surface_wait(surface);
 
    /* If we ran out of buffers we're in trouble, reset all ages */
    if (!surface->current)
      {
+        WRN("No free SHM buffers, dropping a frame");
         for (i = 0; i < surface->num_buff; i++)
           {
              if (surface->leaf[i].valid)