devilhorns pushed a commit to branch master.

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

commit 99af748e4bcc4b20e04d4fcb238e36e48c9652d7
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Thu Jul 30 15:37:14 2015 -0400

    wayland-shm: When we run out of shm buffers kick the server to get some back
    
    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 | 28 +++++++++++++++++--------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c 
b/src/modules/evas/engines/wayland_shm/evas_shm.c
index 705100c..bb9f270 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -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)

-- 


Reply via email to