Raster,

On Thu, Aug 29, 2013 at 9:18 AM, Carsten Haitzler  - Enlightenment Git
<no-re...@enlightenment.org> wrote:
> raster pushed a commit to branch master.
>
> commit 42a46214c4f9b35c0e1f5a84c56ea76ba2235eae
> Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
> Date:   Thu Aug 29 21:18:04 2013 +0900
>
>     other async render issue - sync ALL rendering canvases, not just one
> ---
>  src/lib/evas/canvas/evas_render.c          |  2 ++
>  src/lib/evas/common/evas_thread_render.c   | 21 ++++++++++++++++++++-
>  src/lib/evas/include/evas_common_private.h |  4 +++-
>  3 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/evas/canvas/evas_render.c 
> b/src/lib/evas/canvas/evas_render.c
> index b04d606..4fbe9e2 100644
> --- a/src/lib/evas/canvas/evas_render.c
> +++ b/src/lib/evas/canvas/evas_render.c
> @@ -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_Layer *lay;
>
> +   evas_thread_queue_block();
>     evas_render_rendering_wait(e);
>     evas_cache_async_freeze();

This might deadlock. If the queue is no empty and we have there the
commands for e then we'll wait forever in _rendering_wait() in the
main thread and the render thread will sleep forever trying to acquire
the evas_thread_block_lock. Right?

> @@ -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_state_cow);
>     evas_cache_async_thaw();
> +   evas_thread_queue_unblock();
>  }
>
>  void
> diff --git a/src/lib/evas/common/evas_thread_render.c 
> b/src/lib/evas/common/evas_thread_render.c
> index f37f43a..3474469 100644
> --- a/src/lib/evas/common/evas_thread_render.c
> +++ b/src/lib/evas/common/evas_thread_render.c
> @@ -4,6 +4,7 @@
>
>  static Eina_Thread evas_thread_worker;
>  static Eina_Condition evas_thread_queue_condition;
> +static Eina_Lock evas_thread_block_lock;
>  static Eina_Lock evas_thread_queue_lock;
>  static Eina_Bool evas_thread_queue_ready = EINA_FALSE;
>  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);
>  }
>
> -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)
>  {
>      while (1)
> @@ -83,6 +96,8 @@ evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread 
> thread EINA_UNUSED)
>                continue;
>             }
>
> +         eina_lock_take(&evas_thread_block_lock);
> +
>           cmd = evas_thread_queue.members;
>           evas_thread_queue.members = evas_thread_queue_cache;
>           evas_thread_queue_cache = cmd;
> @@ -109,6 +124,7 @@ evas_thread_worker_func(void *data EINA_UNUSED, 
> Eina_Thread thread EINA_UNUSED)
>                cmd++;
>                len--;
>             }
> +         eina_lock_release(&evas_thread_block_lock);
>        }

I'm not sure this will sync all rendering canvases. At least not in
the same way the _rendering_wait() works. What do you want?

-- Ulisses

>  out:
> @@ -128,6 +144,8 @@ evas_thread_init(void)
>
>      if (!eina_lock_new(&evas_thread_queue_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))
>        CRIT("Could not create draw thread condition");
>      if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, 0,
> @@ -154,6 +172,7 @@ evas_thread_shutdown(void)
>        evas_async_events_process();
>
>      eina_thread_join(evas_thread_worker);
> +    eina_lock_free(&evas_thread_block_lock);
>      eina_lock_free(&evas_thread_queue_lock);
>      eina_condition_free(&evas_thread_queue_condition);
>
> diff --git a/src/lib/evas/include/evas_common_private.h 
> b/src/lib/evas/include/evas_common_private.h
> index 336b7a6..24c9d87 100644
> --- a/src/lib/evas/include/evas_common_private.h
> +++ b/src/lib/evas/include/evas_common_private.h
> @@ -1253,7 +1253,9 @@ void              evas_thread_init(void);
>  void              evas_thread_shutdown(void);
>  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_block(void);
> +EAPI void         evas_thread_queue_unblock(void);
> +
>  typedef enum _Evas_Render_Mode
>  {
>     EVAS_RENDER_MODE_UNDEF,
>
> --
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to