other async render issue - sync ALL rendering canvases, not just one

This commit is contained in:
Carsten Haitzler 2013-08-29 21:18:04 +09:00
parent 70f443d8a8
commit 42a46214c4
3 changed files with 25 additions and 2 deletions

View File

@ -2235,6 +2235,7 @@ _canvas_render_dump(Eo *eo_e EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
Evas_Public_Data *e = _pd; Evas_Public_Data *e = _pd;
Evas_Layer *lay; Evas_Layer *lay;
evas_thread_queue_block();
evas_render_rendering_wait(e); evas_render_rendering_wait(e);
evas_cache_async_freeze(); evas_cache_async_freeze();
@ -2263,6 +2264,7 @@ _canvas_render_dump(Eo *eo_e EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
GC_ALL(evas_object_image_load_opts_cow); GC_ALL(evas_object_image_load_opts_cow);
GC_ALL(evas_object_image_state_cow); GC_ALL(evas_object_image_state_cow);
evas_cache_async_thaw(); evas_cache_async_thaw();
evas_thread_queue_unblock();
} }
void void

View File

@ -4,6 +4,7 @@
static Eina_Thread evas_thread_worker; static Eina_Thread evas_thread_worker;
static Eina_Condition evas_thread_queue_condition; static Eina_Condition evas_thread_queue_condition;
static Eina_Lock evas_thread_block_lock;
static Eina_Lock evas_thread_queue_lock; static Eina_Lock evas_thread_queue_lock;
static Eina_Bool evas_thread_queue_ready = EINA_FALSE; static Eina_Bool evas_thread_queue_ready = EINA_FALSE;
static Eina_Inarray evas_thread_queue; static Eina_Inarray evas_thread_queue;
@ -55,7 +56,19 @@ evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data)
evas_thread_queue_append(cb, data, EINA_TRUE); evas_thread_queue_append(cb, data, EINA_TRUE);
} }
static void* EAPI void
evas_thread_queue_block(void)
{
eina_lock_take(&evas_thread_block_lock);
}
EAPI void
evas_thread_queue_unblock(void)
{
eina_lock_release(&evas_thread_block_lock);
}
static void *
evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED) evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED)
{ {
while (1) while (1)
@ -83,6 +96,8 @@ evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED)
continue; continue;
} }
eina_lock_take(&evas_thread_block_lock);
cmd = evas_thread_queue.members; cmd = evas_thread_queue.members;
evas_thread_queue.members = evas_thread_queue_cache; evas_thread_queue.members = evas_thread_queue_cache;
evas_thread_queue_cache = cmd; evas_thread_queue_cache = cmd;
@ -109,6 +124,7 @@ evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED)
cmd++; cmd++;
len--; len--;
} }
eina_lock_release(&evas_thread_block_lock);
} }
out: out:
@ -128,6 +144,8 @@ evas_thread_init(void)
if (!eina_lock_new(&evas_thread_queue_lock)) if (!eina_lock_new(&evas_thread_queue_lock))
CRIT("Could not create draw thread lock"); CRIT("Could not create draw thread lock");
if (!eina_lock_new(&evas_thread_block_lock))
CRIT("Could not create draw thread block lock");
if (!eina_condition_new(&evas_thread_queue_condition, &evas_thread_queue_lock)) if (!eina_condition_new(&evas_thread_queue_condition, &evas_thread_queue_lock))
CRIT("Could not create draw thread condition"); CRIT("Could not create draw thread condition");
if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, 0, if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, 0,
@ -154,6 +172,7 @@ evas_thread_shutdown(void)
evas_async_events_process(); evas_async_events_process();
eina_thread_join(evas_thread_worker); eina_thread_join(evas_thread_worker);
eina_lock_free(&evas_thread_block_lock);
eina_lock_free(&evas_thread_queue_lock); eina_lock_free(&evas_thread_queue_lock);
eina_condition_free(&evas_thread_queue_condition); eina_condition_free(&evas_thread_queue_condition);

View File

@ -1253,7 +1253,9 @@ void evas_thread_init(void);
void evas_thread_shutdown(void); void evas_thread_shutdown(void);
EAPI void evas_thread_cmd_enqueue(Evas_Thread_Command_Cb cb, void *data); EAPI void evas_thread_cmd_enqueue(Evas_Thread_Command_Cb cb, void *data);
EAPI void evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data); EAPI void evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data);
EAPI void evas_thread_queue_block(void);
EAPI void evas_thread_queue_unblock(void);
typedef enum _Evas_Render_Mode typedef enum _Evas_Render_Mode
{ {
EVAS_RENDER_MODE_UNDEF, EVAS_RENDER_MODE_UNDEF,