Re: [E-devel] [EGIT] [core/efl] master 01/02: evas: use two thread when scaling image.

2015-02-23 Thread Cedric BAIL
Hum,I can't reproduce your issue, but I may have an idea, could you
recompile your efl with -g -ggdb3 and tell me what valgrind says?

Le 23 févr. 2015 02:26, Daniel Juyung Seo seojuyu...@gmail.com a écrit :

 Yo,
 This broke all elm apps.
 When I close apps, they just crash with this callstack.

 (gdb) bt
 #0  0x5c5260b7 in ?? ()
 #1  0xb7ba2113 in _eina_internal_call () at lib/eina/eina_thread.c:111
 #2  0xb7b53d4c in start_thread (arg=0xb5b94b40) at pthread_create.c:308
 #3  0xb7639dde in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

 Just run terminology and close it.
 Please check it ASAP.
 I would not revert it as we're in a development mode.

 Thanks.

 Daniel Juyung Seo (SeoZ)




 On Sat, Feb 21, 2015 at 1:42 AM, Cedric BAIL cedric.b...@free.fr wrote:

  cedric pushed a commit to branch master.
 
 
 
http://git.enlightenment.org/core/efl.git/commit/?id=6bb4ecd65db4cb674ca3dc6ef30ceb1a22445a90
 
  commit 6bb4ecd65db4cb674ca3dc6ef30ceb1a22445a90
  Author: Cedric BAIL ced...@osg.samsung.com
  Date:   Fri Feb 20 17:11:44 2015 +0100
 
  evas: use two thread when scaling image.
 
  This is for now just a small experiment. It was based on the
  experiment made
  with OpenMP. I prefered to only use Eina here as we have already all
  the infrastructure
  to do this nicely and simply. As a result I get a 65% speed improved
  on average for
  the involved scaling operation. The secondary CPU is on my laptop
  running with a load of
  75% percent. I don't have right now the time to do power consumption
  analysis, but I
  think it shouldn't be to bad. I am also not throwing more core at
this
  as we are not able
  to use the second core at its max already, so additional core may
  result in a bigger
  energy loss without enough gain.
  ---
   src/bin/evas/evas_cserve2_scale.c   |   1 +
   src/lib/evas/common/evas_draw_main.c|   2 +
   src/lib/evas/common/evas_scale_main.h   |   2 +
   src/lib/evas/common/evas_scale_sample.c | 300
  
   4 files changed, 272 insertions(+), 33 deletions(-)
 
  diff --git a/src/bin/evas/evas_cserve2_scale.c
  b/src/bin/evas/evas_cserve2_scale.c
  index dd909db..bf6e940 100644
  --- a/src/bin/evas/evas_cserve2_scale.c
  +++ b/src/bin/evas/evas_cserve2_scale.c
  @@ -9,6 +9,7 @@ cserve2_scale_init(void)
  evas_common_image_init();
  evas_common_convert_init();
  evas_common_scale_init();
  +   evas_common_scale_sample_init();
   }
 
   void
  diff --git a/src/lib/evas/common/evas_draw_main.c
  b/src/lib/evas/common/evas_draw_main.c
  index 5d1e415..ed1f951 100644
  --- a/src/lib/evas/common/evas_draw_main.c
  +++ b/src/lib/evas/common/evas_draw_main.c
  @@ -45,6 +45,7 @@ evas_common_init(void)
  evas_common_image_init();
  evas_common_convert_init();
  evas_common_scale_init();
  +   evas_common_scale_sample_init();
  evas_common_rectangle_init();
  evas_common_polygon_init();
  evas_common_line_init();
  @@ -60,6 +61,7 @@ evas_common_shutdown(void)
 
  evas_font_dir_cache_free();
  evas_common_image_cache_free();
  +   evas_common_scale_sample_shutdown();
   }
 
   EAPI void
  diff --git a/src/lib/evas/common/evas_scale_main.h
  b/src/lib/evas/common/evas_scale_main.h
  index c0e1f94..76c46c8 100644
  --- a/src/lib/evas/common/evas_scale_main.h
  +++ b/src/lib/evas/common/evas_scale_main.h
  @@ -4,6 +4,8 @@
   typedef Eina_Bool (*Evas_Common_Scale_In_To_Out_Clip_Cb)(RGBA_Image
*src,
  RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int
src_region_y,
  int src_region_w, int src_region_h, int dst_region_x, int dst_region_y,
int
  dst_region_w, int dst_region_h);
 
   EAPI void evas_common_scale_init(void);
  +EAPI void evas_common_scale_sample_init (void);
  +EAPI void evas_common_scale_sample_shutdown (void);
 
   EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_cb
  (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int
src_region_x,
  int src_region_y, int src_region_w, int src_region_h, int dst_region_x,
int
  dst_region_y, int dst_region_w, int dst_region_h,
  Evas_Common_Scale_In_To_Out_Clip_Cb cb);
   EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_smooth
  (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int
src_region_x,
  int src_region_y, int src_region_w, int src_region_h, int dst_region_x,
int
  dst_region_y, int dst_region_w, int dst_region_h);
  diff --git a/src/lib/evas/common/evas_scale_sample.c
  b/src/lib/evas/common/evas_scale_sample.c
  index 940ccba..09a0631 100644
  --- a/src/lib/evas/common/evas_scale_sample.c
  +++ b/src/lib/evas/common/evas_scale_sample.c
  @@ -3,6 +3,42 @@
 
   static Eina_Bool scale_rgba_in_to_out_clip_sample_internal(RGBA_Image
  *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int
  src_region_y, int src_region_w, int src_region_h, int dst_region_x, int
  dst_region_y, int dst_region_w, int 

Re: [E-devel] [EGIT] [core/efl] master 01/02: evas: use two thread when scaling image.

2015-02-23 Thread Daniel Juyung Seo
Yo,

(precondition)
CFLAGS=-O0 -march=native -ffast-math -g -ggdb3 -W -Wall -Wextra -mno-sse4
-fvisibility=hidden

(command)
valgrind --leak-check=full elementary_test

(valgrind report)
==13999== Thread 3:
==13999== Jump to the invalid address stated on the next line
==13999==at 0xD126005: ???
==13999==by 0x5041D4B: start_thread (pthread_create.c:308)
==13999==by 0x5145DDD: clone (clone.S:130)
==13999==  Address 0xd126005 is not stack'd, malloc'd or (recently) free'd
==13999==
==13999==
==13999== Process terminating with default action of signal 11 (SIGSEGV)
==13999==  Access not within mapped region at address 0xD126005
==13999==at 0xD126005: ???
==13999==by 0x5041D4B: start_thread (pthread_create.c:308)
==13999==by 0x5145DDD: clone (clone.S:130)
==13999==  If you believe this happened as a result of a stack
==13999==  overflow in your program's main thread (unlikely but
==13999==  possible), you can try to increase the size of the
==13999==  main thread stack using the --main-stacksize= flag.
==13999==  The main thread stack size used in this run was 8388608.
==13999==
==13999== HEAP SUMMARY:
==13999== in use at exit: 851,355 bytes in 7,594 blocks
==13999==   total heap usage: 325,254 allocs, 250,558 frees, 49,087,652
bytes allocated
==13999==
==13999== Thread 1:
==13999== 23 (16 direct, 7 indirect) bytes in 1 blocks are definitely lost
in loss record 437 of 1,789
==13999==at 0x482BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==13999==by 0x4BD99B7: eina_str_split_full_helper (eina_str.c:150)
==13999==by 0x4BDA3DA: eina_str_split (eina_str.c:416)
==13999==by 0x4844162: _daemon_version_from_variant
(ecore_system_upower.c:236)
==13999==by 0x48442C4: _daemon_version_get_cb
(ecore_system_upower.c:278)
==13999==by 0x530D5EE: _on_proxy_message_cb (eldbus_proxy.c:538)
==13999==by 0x531C7E2: eldbus_pending_dispatch (eldbus_pending.c:234)
==13999==by 0x531BD0E: cb_pending (eldbus_pending.c:74)
==13999==by 0x5A8BA60: ??? (in /lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==13999==by 0x5A76956: ??? (in /lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==13999==by 0x5A7A236: dbus_connection_dispatch (in
/lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==13999==by 0x53115B1: eldbus_idler (eldbus_core.c:774)
==13999==
==13999== 160 bytes in 1 blocks are possibly lost in loss record 1,375 of
1,789
==13999==at 0x482A5E6: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==13999==by 0x4011304: allocate_dtv (dl-tls.c:297)
==13999==by 0x4011AAB: _dl_allocate_tls (dl-tls.c:461)
==13999==by 0x5042470: pthread_create@@GLIBC_2.1 (allocatestack.c:571)
==13999==by 0x4BE1032: _eina_thread_create (eina_thread.c:67)
==13999==by 0x4BE124C: eina_thread_create (eina_thread.c:148)
==13999==by 0x4D5816E: evas_thread_init (evas_thread_render.c:133)
==13999==by 0x4C4BFB9: evas_init (evas_main.c:66)
==13999==by 0x49F49F1: elm_quicklaunch_sub_init (elm_main.c:689)
==13999==by 0x49F3EA0: elm_init (elm_main.c:310)
==13999==by 0x11FE5E: main (test.c:965)
==13999==
==13999== 160 bytes in 1 blocks are possibly lost in loss record 1,376 of
1,789
==13999==at 0x482A5E6: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==13999==by 0x4011304: allocate_dtv (dl-tls.c:297)
==13999==by 0x4011AAB: _dl_allocate_tls (dl-tls.c:461)
==13999==by 0x5042470: pthread_create@@GLIBC_2.1 (allocatestack.c:571)
==13999==by 0x4BE1032: _eina_thread_create (eina_thread.c:67)
==13999==by 0x4BE124C: eina_thread_create (eina_thread.c:148)
==13999==by 0x4D4C18F: evas_common_scale_sample_init
(evas_scale_sample.c:845)
==13999==by 0x4D333E3: evas_common_init (evas_draw_main.c:48)
==13999==by 0x7056514: eng_setup (evas_engine.c:438)
==13999==by 0x4C4CD21: _evas_canvas_engine_info_set (evas_main.c:368)
==13999==by 0x4C4EA44: evas_canvas_engine_info_set (in
/usr/local/lib/libevas.so.1.13.99)
==13999==by 0x4C54F0C: evas_engine_info_set (evas_canvas.eo.c:672)
==13999==
==13999== LEAK SUMMARY:
==13999==definitely lost: 16 bytes in 1 blocks
==13999==indirectly lost: 7 bytes in 1 blocks
==13999==  possibly lost: 320 bytes in 2 blocks
==13999==still reachable: 775,564 bytes in 11,240 blocks
==13999== suppressed: 0 bytes in 0 blocks
==13999== Reachable blocks (those to which a pointer was found) are not
shown.
==13999== To see them, rerun with: --leak-check=full --show-reachable=yes
==13999==
==13999== For counts of detected and suppressed errors, rerun with: -v
==13999== Use --track-origins=yes to see where uninitialised values come
from
==13999== ERROR SUMMARY: 29 errors from 11 contexts (suppressed: 0 from 0)
Killed



On Mon, Feb 23, 2015 at 6:56 PM, Cedric BAIL cedric.b...@free.fr wrote:

 Hum,I can't reproduce your issue, but I may have an idea, could you
 recompile your efl with -g -ggdb3 and tell me what valgrind says?

 Le 23 févr. 2015 02:26, Daniel Juyung Seo 

Re: [E-devel] [EGIT] [core/efl] master 01/02: evas: use two thread when scaling image.

2015-02-22 Thread Daniel Juyung Seo
Yo,
This broke all elm apps.
When I close apps, they just crash with this callstack.

(gdb) bt
#0  0x5c5260b7 in ?? ()
#1  0xb7ba2113 in _eina_internal_call () at lib/eina/eina_thread.c:111
#2  0xb7b53d4c in start_thread (arg=0xb5b94b40) at pthread_create.c:308
#3  0xb7639dde in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Just run terminology and close it.
Please check it ASAP.
I would not revert it as we're in a development mode.

Thanks.

Daniel Juyung Seo (SeoZ)




On Sat, Feb 21, 2015 at 1:42 AM, Cedric BAIL cedric.b...@free.fr wrote:

 cedric pushed a commit to branch master.


 http://git.enlightenment.org/core/efl.git/commit/?id=6bb4ecd65db4cb674ca3dc6ef30ceb1a22445a90

 commit 6bb4ecd65db4cb674ca3dc6ef30ceb1a22445a90
 Author: Cedric BAIL ced...@osg.samsung.com
 Date:   Fri Feb 20 17:11:44 2015 +0100

 evas: use two thread when scaling image.

 This is for now just a small experiment. It was based on the
 experiment made
 with OpenMP. I prefered to only use Eina here as we have already all
 the infrastructure
 to do this nicely and simply. As a result I get a 65% speed improved
 on average for
 the involved scaling operation. The secondary CPU is on my laptop
 running with a load of
 75% percent. I don't have right now the time to do power consumption
 analysis, but I
 think it shouldn't be to bad. I am also not throwing more core at this
 as we are not able
 to use the second core at its max already, so additional core may
 result in a bigger
 energy loss without enough gain.
 ---
  src/bin/evas/evas_cserve2_scale.c   |   1 +
  src/lib/evas/common/evas_draw_main.c|   2 +
  src/lib/evas/common/evas_scale_main.h   |   2 +
  src/lib/evas/common/evas_scale_sample.c | 300
 
  4 files changed, 272 insertions(+), 33 deletions(-)

 diff --git a/src/bin/evas/evas_cserve2_scale.c
 b/src/bin/evas/evas_cserve2_scale.c
 index dd909db..bf6e940 100644
 --- a/src/bin/evas/evas_cserve2_scale.c
 +++ b/src/bin/evas/evas_cserve2_scale.c
 @@ -9,6 +9,7 @@ cserve2_scale_init(void)
 evas_common_image_init();
 evas_common_convert_init();
 evas_common_scale_init();
 +   evas_common_scale_sample_init();
  }

  void
 diff --git a/src/lib/evas/common/evas_draw_main.c
 b/src/lib/evas/common/evas_draw_main.c
 index 5d1e415..ed1f951 100644
 --- a/src/lib/evas/common/evas_draw_main.c
 +++ b/src/lib/evas/common/evas_draw_main.c
 @@ -45,6 +45,7 @@ evas_common_init(void)
 evas_common_image_init();
 evas_common_convert_init();
 evas_common_scale_init();
 +   evas_common_scale_sample_init();
 evas_common_rectangle_init();
 evas_common_polygon_init();
 evas_common_line_init();
 @@ -60,6 +61,7 @@ evas_common_shutdown(void)

 evas_font_dir_cache_free();
 evas_common_image_cache_free();
 +   evas_common_scale_sample_shutdown();
  }

  EAPI void
 diff --git a/src/lib/evas/common/evas_scale_main.h
 b/src/lib/evas/common/evas_scale_main.h
 index c0e1f94..76c46c8 100644
 --- a/src/lib/evas/common/evas_scale_main.h
 +++ b/src/lib/evas/common/evas_scale_main.h
 @@ -4,6 +4,8 @@
  typedef Eina_Bool (*Evas_Common_Scale_In_To_Out_Clip_Cb)(RGBA_Image *src,
 RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y,
 int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int
 dst_region_w, int dst_region_h);

  EAPI void evas_common_scale_init(void);
 +EAPI void evas_common_scale_sample_init (void);
 +EAPI void evas_common_scale_sample_shutdown (void);

  EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_cb
 (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x,
 int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int
 dst_region_y, int dst_region_w, int dst_region_h,
 Evas_Common_Scale_In_To_Out_Clip_Cb cb);
  EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_smooth
 (RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x,
 int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int
 dst_region_y, int dst_region_w, int dst_region_h);
 diff --git a/src/lib/evas/common/evas_scale_sample.c
 b/src/lib/evas/common/evas_scale_sample.c
 index 940ccba..09a0631 100644
 --- a/src/lib/evas/common/evas_scale_sample.c
 +++ b/src/lib/evas/common/evas_scale_sample.c
 @@ -3,6 +3,42 @@

  static Eina_Bool scale_rgba_in_to_out_clip_sample_internal(RGBA_Image
 *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int
 src_region_y, int src_region_w, int src_region_h, int dst_region_x, int
 dst_region_y, int dst_region_w, int dst_region_h);

 +typedef struct _Evas_Scale_Thread Evas_Scale_Thread;
 +typedef struct _Evas_Scale_Msg Evas_Scale_Msg;
 +
 +struct _Evas_Scale_Msg
 +{
 +   Eina_Thread_Queue_Msg head;
 +   Evas_Scale_Thread *task;
 +};
 +
 +struct _Evas_Scale_Thread
 +{
 +   RGBA_Image *mask8;
 +   DATA32 **row_ptr;
 +   DATA32 *dptr;
 +   int