summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-11-07 15:47:09 -0800
committerCedric BAIL <cedric@osg.samsung.com>2017-11-07 16:08:39 -0800
commitd125892601c6278bf40624843d637bbc0e1a0cf0 (patch)
treea1462dec04e9487e20112bf7581d3404dccb0010 /src/lib/evas
parent73e6404b1a89b26518f61b7a163e7dc9066bd8ca (diff)
evas: rely on ecore to reset upscaler thread on fork.
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/common/evas_scale_sample.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c
index daa57f6497..737aeb2fec 100644
--- a/src/lib/evas/common/evas_scale_sample.c
+++ b/src/lib/evas/common/evas_scale_sample.c
@@ -1,6 +1,8 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_blend_private.h" 2#include "evas_blend_private.h"
3 3
4#include "Ecore.h"
5
4static 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); 6static 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);
5 7
6typedef struct _Evas_Scale_Thread Evas_Scale_Thread; 8typedef struct _Evas_Scale_Thread Evas_Scale_Thread;
@@ -860,6 +862,23 @@ _evas_common_scale_sample_thread(void *data EINA_UNUSED,
860 return NULL; 862 return NULL;
861} 863}
862 864
865static void
866evas_common_scale_sample_fork_reset(void *data EINA_UNUSED)
867{
868 eina_thread_queue_free(thread_queue);
869 eina_thread_queue_free(main_queue);
870
871 thread_queue = eina_thread_queue_new();
872 main_queue = eina_thread_queue_new();
873
874 if (!eina_thread_create(&scaling_thread, EINA_THREAD_NORMAL, -1,
875 _evas_common_scale_sample_thread, NULL))
876 {
877 CRI("We failed to recreate the upscaling thread.");
878 use_thread = EINA_FALSE;
879 }
880}
881
863EAPI void 882EAPI void
864evas_common_scale_sample_init(void) 883evas_common_scale_sample_init(void)
865{ 884{
@@ -870,6 +889,10 @@ evas_common_scale_sample_init(void)
870 return; 889 return;
871#endif 890#endif
872 891
892 ecore_init();
893
894 ecore_fork_reset_callback_add(evas_common_scale_sample_fork_reset, NULL);
895
873 thread_queue = eina_thread_queue_new(); 896 thread_queue = eina_thread_queue_new();
874 if (EINA_UNLIKELY(!thread_queue)) 897 if (EINA_UNLIKELY(!thread_queue))
875 { 898 {
@@ -886,6 +909,7 @@ evas_common_scale_sample_init(void)
886 if (!eina_thread_create(&scaling_thread, EINA_THREAD_NORMAL, -1, 909 if (!eina_thread_create(&scaling_thread, EINA_THREAD_NORMAL, -1,
887 _evas_common_scale_sample_thread, NULL)) 910 _evas_common_scale_sample_thread, NULL))
888 { 911 {
912 CRI("We failed to create the upscaling thread.");
889 goto cleanup; 913 goto cleanup;
890 } 914 }
891 915
@@ -905,6 +929,8 @@ evas_common_scale_sample_shutdown(void)
905 929
906 if (!use_thread) return ; 930 if (!use_thread) return ;
907 931
932 ecore_fork_reset_callback_del(evas_common_scale_sample_fork_reset, NULL);
933
908 msg = eina_thread_queue_send(thread_queue, sizeof (Evas_Scale_Msg), &ref); 934 msg = eina_thread_queue_send(thread_queue, sizeof (Evas_Scale_Msg), &ref);
909 msg->task = NULL; 935 msg->task = NULL;
910 eina_thread_queue_send_done(thread_queue, ref); 936 eina_thread_queue_send_done(thread_queue, ref);
@@ -918,4 +944,6 @@ evas_common_scale_sample_shutdown(void)
918 944
919 eina_thread_queue_free(thread_queue); 945 eina_thread_queue_free(thread_queue);
920 eina_thread_queue_free(main_queue); 946 eina_thread_queue_free(main_queue);
947
948 ecore_shutdown();
921} 949}