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.
This commit is contained in:
Ulisses Furquim 2013-09-03 01:48:08 -03:00
parent d7c8d221b0
commit 0af10ae93f
3 changed files with 15 additions and 20 deletions

View File

@ -16,8 +16,6 @@ EAPI Eina_Bool lockdebug = EINA_FALSE;
EAPI int lockmax = 0;
#endif
Eina_List *all_evases = NULL;
static int _evas_init_count = 0;
int _evas_log_dom_global = -1;
@ -111,9 +109,6 @@ evas_shutdown(void)
evas_object_image_load_opts_cow = NULL;
evas_object_image_state_cow = NULL;
eina_list_free(all_evases);
all_evases = NULL;
evas_thread_shutdown();
_evas_preload_thread_shutdown();
evas_async_events_shutdown();
@ -177,8 +172,6 @@ _constructor(Eo *eo_obj, void *class_data, va_list *list EINA_UNUSED)
EVAS_ARRAY_SET(e, texts_unref_queue);
#undef EVAS_ARRAY_SET
all_evases = eina_list_append(all_evases, e);
}
EAPI void
@ -274,8 +267,6 @@ _destructor(Eo *eo_e, void *_pd, va_list *list EINA_UNUSED)
if (e->engine.module) evas_module_unref(e->engine.module);
all_evases = eina_list_remove(all_evases, e);
eina_array_flush(&e->delete_objects);
eina_array_flush(&e->active_objects);
eina_array_flush(&e->restack_objects);

View File

@ -1,6 +1,7 @@
#include "evas_common_private.h"
#include "evas_private.h"
#include <math.h>
#include <assert.h>
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
#endif
@ -90,6 +91,8 @@ struct _Render_Updates
static Eina_Bool
evas_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);
static Eina_List *_rendering_evases = NULL;
#ifdef EVAS_RENDER_DEBUG_TIMING
static double
_time_get()
@ -1472,19 +1475,20 @@ evas_render_rendering_wait(Evas_Public_Data *evas)
while (evas->rendering) evas_async_events_process_blocking();
}
/* syncs ALL async rendering canvases */
/*
* Syncs ALL async rendering canvases. Must be called in the main thread.
*/
void
evas_render_sync(void)
{
Eina_List *l;
void *d;
Evas_Public_Data *evas;
EINA_LIST_FOREACH(all_evases, l, d)
{
Evas_Public_Data *e = d;
if (!e->rendering) continue;
evas_render_rendering_wait(e);
}
if (!_rendering_evases) return;
evas = eina_list_data_get(eina_list_last(_rendering_evases));
evas_render_rendering_wait(evas);
assert(_rendering_evases == NULL);
}
static Eina_Bool
@ -1837,6 +1841,7 @@ evas_render_updates_internal(Evas *eo_e,
{
eo_ref(eo_e);
e->rendering = EINA_TRUE;
_rendering_evases = eina_list_append(_rendering_evases, e);
evas_thread_queue_flush((Evas_Thread_Command_Cb)done_func, done_data);
}
@ -2034,6 +2039,7 @@ evas_render_wakeup(Evas *eo_e)
eina_array_clean(&e->texts_unref_queue);
/* post rendering */
_rendering_evases = eina_list_remove(_rendering_evases, e);
e->rendering = EINA_FALSE;
post.updated_area = ret_updates;

View File

@ -443,8 +443,6 @@ struct _Evas_Public_Data
Eina_Bool rendering : 1;
};
extern Eina_List *all_evases;
struct _Evas_Layer
{
EINA_INLIST;