raster pushed a commit to branch master.

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

commit 15b9ac2d2547e433faa521e95415327323b94e52
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Mon Sep 28 02:56:28 2015 +0900

    evas - lock render updates as this happesn to be accesed from threads
---
 src/lib/evas/canvas/evas_main.c     |  2 ++
 src/lib/evas/canvas/evas_render.c   | 12 ++++++++++++
 src/lib/evas/include/evas_private.h |  1 +
 3 files changed, 15 insertions(+)

diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 1fa4d32..bdafc31 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -193,6 +193,7 @@ _evas_canvas_eo_base_constructor(Eo *eo_obj, 
Evas_Public_Data *e)
 
 #undef EVAS_ARRAY_SET
    eina_lock_new(&(e->lock_objects));
+   eina_spinlock_new(&(e->render.lock));
 
    return eo_obj;
 }
@@ -316,6 +317,7 @@ _evas_canvas_eo_base_destructor(Eo *eo_e, Evas_Public_Data 
*e)
    _evas_device_cleanup(eo_e);
 
    eina_lock_free(&(e->lock_objects));
+   eina_spinlock_free(&(e->render.lock));
 
    e->magic = 0;
    eo_do_super(eo_e, MY_CLASS, eo_destructor());
diff --git a/src/lib/evas/canvas/evas_render.c 
b/src/lib/evas/canvas/evas_render.c
index 772be0e..31b8635 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -2698,17 +2698,21 @@ evas_render_updates_internal(Evas *eo_e,
                   ru = malloc(sizeof(*ru));
                   ru->surface = surface;
                   NEW_RECT(ru->area, ux, uy, uw, uh);
+                  eina_spinlock_take(&(e->render.lock));
                   e->render.updates = eina_list_append(e->render.updates, ru);
                   evas_cache_image_ref(surface);
+                  eina_spinlock_release(&(e->render.lock));
                }
              else if (make_updates)
                {
                   Eina_Rectangle *rect;
 
                   NEW_RECT(rect, ux, uy, uw, uh);
+                  eina_spinlock_take(&(e->render.lock));
                   if (rect)
                     e->render.updates = eina_list_append(e->render.updates,
                                                          rect);
+                  eina_spinlock_release(&(e->render.lock));
                }
 
              clean_them |= evas_render_updates_internal_loop(eo_e, e, surface, 
e->engine.data.context,
@@ -2898,8 +2902,10 @@ evas_render_updates_internal(Evas *eo_e,
      {
         Evas_Event_Render_Post post;
 
+        eina_spinlock_take(&(e->render.lock));
         post.updated_area = e->render.updates;
         _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, e->render.updates ? 
&post : NULL);
+        eina_spinlock_release(&(e->render.lock));
      }
 
    RD(0, "---]\n");
@@ -2936,12 +2942,14 @@ evas_render_wakeup(Evas *eo_e)
    Eina_List *ret_updates = NULL;
    Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
 
+   eina_spinlock_take(&(e->render.lock));
    EINA_LIST_FREE(e->render.updates, ru)
      {
         ret_updates = eina_list_append(ret_updates, ru->area);
         free(ru);
         haveup = EINA_TRUE;
      }
+   eina_spinlock_release(&(e->render.lock));
 
    /* flush redraws */
    if (haveup)
@@ -3004,6 +3012,7 @@ evas_render_pipe_wakeup(void *data)
    Render_Updates *ru;
    Evas_Public_Data *e = data;
 
+   eina_spinlock_take(&(e->render.lock));
    EINA_LIST_FOREACH(e->render.updates, l, ru)
      {
         eina_evlog("+render_push", e->evas, 0.0, NULL);
@@ -3016,6 +3025,7 @@ evas_render_pipe_wakeup(void *data)
         ru->surface = NULL;
      }
    eina_evlog("+render_output_flush", e->evas, 0.0, NULL);
+   eina_spinlock_release(&(e->render.lock));
    e->engine.func->output_flush(e->engine.data.output,
                                 EVAS_RENDER_MODE_ASYNC_END);
    eina_evlog("+render_output_flush", e->evas, 0.0, NULL);
@@ -3082,8 +3092,10 @@ evas_render_updates_internal_wait(Evas *eo_e,
           return NULL;
      }
 
+   eina_spinlock_take(&(e->render.lock));
    ret = e->render.updates;
    e->render.updates = NULL;
+   eina_spinlock_release(&(e->render.lock));
 
    return ret;
 }
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index c15a579..8c57805 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -808,6 +808,7 @@ struct _Evas_Public_Data
 
    struct {
       Eina_List *updates;
+      Eina_Spinlock lock;
    } render;
 
    Eina_Array     delete_objects;

-- 


Reply via email to