summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-28 02:56:28 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-28 02:58:54 +0900
commit15b9ac2d2547e433faa521e95415327323b94e52 (patch)
treec2dc6fe0003646cb7a80c4fbd2979d28105980e0 /src
parent4b894e01b5bf2218e39a0727f12edc1f61f9e9b0 (diff)
evas - lock render updates as this happesn to be accesed from threads
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_main.c2
-rw-r--r--src/lib/evas/canvas/evas_render.c12
-rw-r--r--src/lib/evas/include/evas_private.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 1fa4d32fa5..bdafc3128c 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)
193 193
194#undef EVAS_ARRAY_SET 194#undef EVAS_ARRAY_SET
195 eina_lock_new(&(e->lock_objects)); 195 eina_lock_new(&(e->lock_objects));
196 eina_spinlock_new(&(e->render.lock));
196 197
197 return eo_obj; 198 return eo_obj;
198} 199}
@@ -316,6 +317,7 @@ _evas_canvas_eo_base_destructor(Eo *eo_e, Evas_Public_Data *e)
316 _evas_device_cleanup(eo_e); 317 _evas_device_cleanup(eo_e);
317 318
318 eina_lock_free(&(e->lock_objects)); 319 eina_lock_free(&(e->lock_objects));
320 eina_spinlock_free(&(e->render.lock));
319 321
320 e->magic = 0; 322 e->magic = 0;
321 eo_do_super(eo_e, MY_CLASS, eo_destructor()); 323 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 772be0ecd1..31b8635109 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,
2698 ru = malloc(sizeof(*ru)); 2698 ru = malloc(sizeof(*ru));
2699 ru->surface = surface; 2699 ru->surface = surface;
2700 NEW_RECT(ru->area, ux, uy, uw, uh); 2700 NEW_RECT(ru->area, ux, uy, uw, uh);
2701 eina_spinlock_take(&(e->render.lock));
2701 e->render.updates = eina_list_append(e->render.updates, ru); 2702 e->render.updates = eina_list_append(e->render.updates, ru);
2702 evas_cache_image_ref(surface); 2703 evas_cache_image_ref(surface);
2704 eina_spinlock_release(&(e->render.lock));
2703 } 2705 }
2704 else if (make_updates) 2706 else if (make_updates)
2705 { 2707 {
2706 Eina_Rectangle *rect; 2708 Eina_Rectangle *rect;
2707 2709
2708 NEW_RECT(rect, ux, uy, uw, uh); 2710 NEW_RECT(rect, ux, uy, uw, uh);
2711 eina_spinlock_take(&(e->render.lock));
2709 if (rect) 2712 if (rect)
2710 e->render.updates = eina_list_append(e->render.updates, 2713 e->render.updates = eina_list_append(e->render.updates,
2711 rect); 2714 rect);
2715 eina_spinlock_release(&(e->render.lock));
2712 } 2716 }
2713 2717
2714 clean_them |= evas_render_updates_internal_loop(eo_e, e, surface, e->engine.data.context, 2718 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,
2898 { 2902 {
2899 Evas_Event_Render_Post post; 2903 Evas_Event_Render_Post post;
2900 2904
2905 eina_spinlock_take(&(e->render.lock));
2901 post.updated_area = e->render.updates; 2906 post.updated_area = e->render.updates;
2902 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, e->render.updates ? &post : NULL); 2907 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, e->render.updates ? &post : NULL);
2908 eina_spinlock_release(&(e->render.lock));
2903 } 2909 }
2904 2910
2905 RD(0, "---]\n"); 2911 RD(0, "---]\n");
@@ -2936,12 +2942,14 @@ evas_render_wakeup(Evas *eo_e)
2936 Eina_List *ret_updates = NULL; 2942 Eina_List *ret_updates = NULL;
2937 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 2943 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2938 2944
2945 eina_spinlock_take(&(e->render.lock));
2939 EINA_LIST_FREE(e->render.updates, ru) 2946 EINA_LIST_FREE(e->render.updates, ru)
2940 { 2947 {
2941 ret_updates = eina_list_append(ret_updates, ru->area); 2948 ret_updates = eina_list_append(ret_updates, ru->area);
2942 free(ru); 2949 free(ru);
2943 haveup = EINA_TRUE; 2950 haveup = EINA_TRUE;
2944 } 2951 }
2952 eina_spinlock_release(&(e->render.lock));
2945 2953
2946 /* flush redraws */ 2954 /* flush redraws */
2947 if (haveup) 2955 if (haveup)
@@ -3004,6 +3012,7 @@ evas_render_pipe_wakeup(void *data)
3004 Render_Updates *ru; 3012 Render_Updates *ru;
3005 Evas_Public_Data *e = data; 3013 Evas_Public_Data *e = data;
3006 3014
3015 eina_spinlock_take(&(e->render.lock));
3007 EINA_LIST_FOREACH(e->render.updates, l, ru) 3016 EINA_LIST_FOREACH(e->render.updates, l, ru)
3008 { 3017 {
3009 eina_evlog("+render_push", e->evas, 0.0, NULL); 3018 eina_evlog("+render_push", e->evas, 0.0, NULL);
@@ -3016,6 +3025,7 @@ evas_render_pipe_wakeup(void *data)
3016 ru->surface = NULL; 3025 ru->surface = NULL;
3017 } 3026 }
3018 eina_evlog("+render_output_flush", e->evas, 0.0, NULL); 3027 eina_evlog("+render_output_flush", e->evas, 0.0, NULL);
3028 eina_spinlock_release(&(e->render.lock));
3019 e->engine.func->output_flush(e->engine.data.output, 3029 e->engine.func->output_flush(e->engine.data.output,
3020 EVAS_RENDER_MODE_ASYNC_END); 3030 EVAS_RENDER_MODE_ASYNC_END);
3021 eina_evlog("+render_output_flush", e->evas, 0.0, NULL); 3031 eina_evlog("+render_output_flush", e->evas, 0.0, NULL);
@@ -3082,8 +3092,10 @@ evas_render_updates_internal_wait(Evas *eo_e,
3082 return NULL; 3092 return NULL;
3083 } 3093 }
3084 3094
3095 eina_spinlock_take(&(e->render.lock));
3085 ret = e->render.updates; 3096 ret = e->render.updates;
3086 e->render.updates = NULL; 3097 e->render.updates = NULL;
3098 eina_spinlock_release(&(e->render.lock));
3087 3099
3088 return ret; 3100 return ret;
3089} 3101}
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index c15a5794a0..8c578053b6 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
808 808
809 struct { 809 struct {
810 Eina_List *updates; 810 Eina_List *updates;
811 Eina_Spinlock lock;
811 } render; 812 } render;
812 813
813 Eina_Array delete_objects; 814 Eina_Array delete_objects;