summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlisses Furquim <ulisses.furquim@intel.com>2013-09-03 01:48:08 -0300
committerUlisses Furquim <ulisses.furquim@intel.com>2013-09-03 01:52:38 -0300
commit0af10ae93fe0d84c7244e6cc11cdd6afe72c9b22 (patch)
tree395a871887a9b3fc3f295629dc701f73fbdc9617
parentd7c8d221b0b9c947b6636fa415a21c1819c9bac1 (diff)
evas/render: improve evas_render_sync()
Tracking only the async rendering canvases and just waiting for the last one to finish rendering. This should be enough to sync all canvases since the render thread orderly executes the commands.
-rw-r--r--src/lib/evas/canvas/evas_main.c9
-rw-r--r--src/lib/evas/canvas/evas_render.c24
-rw-r--r--src/lib/evas/include/evas_private.h2
3 files changed, 15 insertions, 20 deletions
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 23d8f3215e..aefdce5090 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -16,8 +16,6 @@ EAPI Eina_Bool lockdebug = EINA_FALSE;
16EAPI int lockmax = 0; 16EAPI int lockmax = 0;
17#endif 17#endif
18 18
19Eina_List *all_evases = NULL;
20
21static int _evas_init_count = 0; 19static int _evas_init_count = 0;
22int _evas_log_dom_global = -1; 20int _evas_log_dom_global = -1;
23 21
@@ -111,9 +109,6 @@ evas_shutdown(void)
111 evas_object_image_load_opts_cow = NULL; 109 evas_object_image_load_opts_cow = NULL;
112 evas_object_image_state_cow = NULL; 110 evas_object_image_state_cow = NULL;
113 111
114 eina_list_free(all_evases);
115 all_evases = NULL;
116
117 evas_thread_shutdown(); 112 evas_thread_shutdown();
118 _evas_preload_thread_shutdown(); 113 _evas_preload_thread_shutdown();
119 evas_async_events_shutdown(); 114 evas_async_events_shutdown();
@@ -177,8 +172,6 @@ _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
177 EVAS_ARRAY_SET(e, texts_unref_queue); 172 EVAS_ARRAY_SET(e, texts_unref_queue);
178 173
179#undef EVAS_ARRAY_SET 174#undef EVAS_ARRAY_SET
180
181 all_evases = eina_list_append(all_evases, e);
182} 175}
183 176
184EAPI void 177EAPI void
@@ -274,8 +267,6 @@ _destructor(Eo *eo_e, void *_pd, va_list *list EINA_UNUSED)
274 267
275 if (e->engine.module) evas_module_unref(e->engine.module); 268 if (e->engine.module) evas_module_unref(e->engine.module);
276 269
277 all_evases = eina_list_remove(all_evases, e);
278
279 eina_array_flush(&e->delete_objects); 270 eina_array_flush(&e->delete_objects);
280 eina_array_flush(&e->active_objects); 271 eina_array_flush(&e->active_objects);
281 eina_array_flush(&e->restack_objects); 272 eina_array_flush(&e->restack_objects);
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index c350cc617b..81b8abc601 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -1,6 +1,7 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_private.h" 2#include "evas_private.h"
3#include <math.h> 3#include <math.h>
4#include <assert.h>
4#ifdef EVAS_CSERVE2 5#ifdef EVAS_CSERVE2
5#include "evas_cs2_private.h" 6#include "evas_cs2_private.h"
6#endif 7#endif
@@ -90,6 +91,8 @@ struct _Render_Updates
90static Eina_Bool 91static Eina_Bool
91evas_render_updates_internal(Evas *eo_e, unsigned char make_updates, unsigned char do_draw, Evas_Render_Done_Cb done_func, void *done_data, Eina_Bool do_async); 92evas_render_updates_internal(Evas *eo_e, unsigned char make_updates, unsigned char do_draw, Evas_Render_Done_Cb done_func, void *done_data, Eina_Bool do_async);
92 93
94static Eina_List *_rendering_evases = NULL;
95
93#ifdef EVAS_RENDER_DEBUG_TIMING 96#ifdef EVAS_RENDER_DEBUG_TIMING
94static double 97static double
95_time_get() 98_time_get()
@@ -1472,19 +1475,20 @@ evas_render_rendering_wait(Evas_Public_Data *evas)
1472 while (evas->rendering) evas_async_events_process_blocking(); 1475 while (evas->rendering) evas_async_events_process_blocking();
1473} 1476}
1474 1477
1475/* syncs ALL async rendering canvases */ 1478/*
1479 * Syncs ALL async rendering canvases. Must be called in the main thread.
1480 */
1476void 1481void
1477evas_render_sync(void) 1482evas_render_sync(void)
1478{ 1483{
1479 Eina_List *l; 1484 Evas_Public_Data *evas;
1480 void *d;
1481 1485
1482 EINA_LIST_FOREACH(all_evases, l, d) 1486 if (!_rendering_evases) return;
1483 { 1487
1484 Evas_Public_Data *e = d; 1488 evas = eina_list_data_get(eina_list_last(_rendering_evases));
1485 if (!e->rendering) continue; 1489 evas_render_rendering_wait(evas);
1486 evas_render_rendering_wait(e); 1490
1487 } 1491 assert(_rendering_evases == NULL);
1488} 1492}
1489 1493
1490static Eina_Bool 1494static Eina_Bool
@@ -1837,6 +1841,7 @@ evas_render_updates_internal(Evas *eo_e,
1837 { 1841 {
1838 eo_ref(eo_e); 1842 eo_ref(eo_e);
1839 e->rendering = EINA_TRUE; 1843 e->rendering = EINA_TRUE;
1844 _rendering_evases = eina_list_append(_rendering_evases, e);
1840 1845
1841 evas_thread_queue_flush((Evas_Thread_Command_Cb)done_func, done_data); 1846 evas_thread_queue_flush((Evas_Thread_Command_Cb)done_func, done_data);
1842 } 1847 }
@@ -2034,6 +2039,7 @@ evas_render_wakeup(Evas *eo_e)
2034 eina_array_clean(&e->texts_unref_queue); 2039 eina_array_clean(&e->texts_unref_queue);
2035 2040
2036 /* post rendering */ 2041 /* post rendering */
2042 _rendering_evases = eina_list_remove(_rendering_evases, e);
2037 e->rendering = EINA_FALSE; 2043 e->rendering = EINA_FALSE;
2038 2044
2039 post.updated_area = ret_updates; 2045 post.updated_area = ret_updates;
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index f8daeafd83..5a9867b120 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -443,8 +443,6 @@ struct _Evas_Public_Data
443 Eina_Bool rendering : 1; 443 Eina_Bool rendering : 1;
444}; 444};
445 445
446extern Eina_List *all_evases;
447
448struct _Evas_Layer 446struct _Evas_Layer
449{ 447{
450 EINA_INLIST; 448 EINA_INLIST;