devilhorns pushed a commit to branch master.

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

commit faa99297e0a262f989a7304fdca0a5a7e92583ad
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Thu Apr 30 11:13:36 2015 -0400

    evas-wayland-shm: Fix T2352 (focused window borders blink)
    
    Summary: This fixes an issue where the wrong swapmode was being
    returned to the evas render function. This was causing focused windows
    to blink.
    
    NB: Big thanks to Derek for assisting !! :)
    
    @fix
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/modules/evas/engines/wayland_shm/evas_engine.h |  1 +
 src/modules/evas/engines/wayland_shm/evas_outbuf.c | 32 ++++++++++++----------
 src/modules/evas/engines/wayland_shm/evas_shm.c    |  9 +++---
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.h 
b/src/modules/evas/engines/wayland_shm/evas_engine.h
index 3c4fcc2..e9ea18d 100644
--- a/src/modules/evas/engines/wayland_shm/evas_engine.h
+++ b/src/modules/evas/engines/wayland_shm/evas_engine.h
@@ -88,6 +88,7 @@ struct _Shm_Surface
 
    Eina_Bool redraw : 1;
    Eina_Bool alpha : 1;
+   Eina_Bool mapped : 1;
 };
 
 struct _Outbuf
diff --git a/src/modules/evas/engines/wayland_shm/evas_outbuf.c 
b/src/modules/evas/engines/wayland_shm/evas_outbuf.c
index 7b4fb91..7571566 100644
--- a/src/modules/evas/engines/wayland_shm/evas_outbuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_outbuf.c
@@ -257,27 +257,29 @@ _evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects 
EINA_UNUSED, Evas_Render_Mode
 Render_Engine_Swap_Mode 
 _evas_outbuf_swapmode_get(Outbuf *ob)
 {
-   int i = 0;
+   int i = 0, n = 0, count = 0, ret = 0;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
-   i = (ob->surface->last_buff - ob->surface->curr_buff + 
-        (ob->surface->last_buff > ob->surface->last_buff ? 
-            0 : ob->surface->num_buff)) % ob->surface->num_buff;
+   if (!ob->surface->mapped) return MODE_FULL;
 
-   switch (i)
+   for (; i < ob->surface->num_buff; i++)
      {
-      case 0:
-        return MODE_COPY;
-      case 1:
-        return MODE_DOUBLE;
-      case 2:
-        return MODE_TRIPLE;
-      case 3:
-        return MODE_QUADRUPLE;
-      default:
-        return MODE_FULL;
+        n = (ob->surface->num_buff + ob->surface->curr_buff - (i)) % 
ob->surface->num_buff;
+        if (ob->surface->leaf[n].busy) count++;
      }
+
+   if (count == ob->surface->num_buff) ret = MODE_FULL;
+   else if (count == 0) ret = MODE_COPY;
+   else if (count == 1) ret = MODE_DOUBLE;
+   else if (count == 2) ret = MODE_TRIPLE;
+   else if (count == 3) ret = MODE_QUADRUPLE;
+   else ret = MODE_FULL;
+
+   /* DBG("SWAPMODE: %d (0=FULL, 1=COPY, 2=DOUBLE, 3=TRIPLE, 4=QUAD", ret); */
+   /* DBG("\tBusy: %d", count); */
+
+   return ret;
 }
 
 int 
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c 
b/src/modules/evas/engines/wayland_shm/evas_shm.c
index 3cea7d2..724f42c 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -408,7 +408,6 @@ void
 _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, unsigned 
int count)
 {
    Shm_Leaf *leaf = NULL;
-   int i = 0;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -421,7 +420,9 @@ _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle 
*rects, unsigned int
         return;
      }
 
-   DBG("Current Leaf %d", (int)(leaf - &surface->leaf[0]));
+   /* DBG("Current Leaf %d", (int)(leaf - &surface->leaf[0])); */
+
+   surface->last_buff = surface->curr_buff;
 
    wl_surface_attach(surface->surface, leaf->data->buffer, 0, 0);
 
@@ -443,6 +444,7 @@ _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle 
*rects, unsigned int
    surface->dx = 0;
    surface->dy = 0;
    surface->redraw = EINA_TRUE;
+   surface->mapped = EINA_TRUE;
 }
 
 void *
@@ -468,7 +470,7 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, 
int *h)
 
    if (!leaf)
      {
-        WRN("All buffers held by server");
+        /* WRN("All buffers held by server"); */
         return NULL;
      }
 
@@ -477,7 +479,6 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, 
int *h)
    if (w) *w = leaf->w;
    if (h) *h = leaf->h;
 
-   surface->last_buff = surface->curr_buff;
    surface->curr_buff = (int)(leaf - &surface->leaf[0]);
 
    return leaf->data->map;

-- 


Reply via email to