summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/engines
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-07-04 12:17:18 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-07-04 12:17:18 +0000
commit001c11207a57c7bd1f327a7b52a489c55ac73620 (patch)
tree8dc41294faffd5f101b3346a346cb30e01733e6e /legacy/evas/src/lib/engines
parent5ee62d60f2d80b3d05391f1fe1dba92771a955d6 (diff)
evas: move evas_common_pipe_init out of the #if.
SVN revision: 73274
Diffstat (limited to 'legacy/evas/src/lib/engines')
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c137
1 files changed, 68 insertions, 69 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c
index 2760f80c62..ea6a354b16 100644
--- a/legacy/evas/src/lib/engines/common/evas_pipe.c
+++ b/legacy/evas/src/lib/engines/common/evas_pipe.c
@@ -775,75 +775,6 @@ evas_common_pipe_load_do(RGBA_Image *im)
775#endif 775#endif
776} 776}
777 777
778EAPI Eina_Bool
779evas_common_pipe_init(void)
780{
781#ifdef BUILD_PTHREAD
782 if (thread_num == 0)
783 {
784 int cpunum;
785 int i;
786
787 cpunum = eina_cpu_count();
788 thread_num = cpunum;
789// on single cpu we still want this initted.. otherwise we block forever
790// waiting onm pthread barriers for async rendering on a single core!
791// if (thread_num == 1) return EINA_FALSE;
792
793 eina_threads_init();
794
795 LKI(im_task_mutex);
796 LKI(text_task_mutex);
797
798 pthread_barrier_init(&(thbarrier[0]), NULL, thread_num + 1);
799 pthread_barrier_init(&(thbarrier[1]), NULL, thread_num + 1);
800 for (i = 0; i < thread_num; i++)
801 {
802 pthread_attr_t attr;
803 cpu_set_t cpu;
804
805 pthread_attr_init(&attr);
806 CPU_ZERO(&cpu);
807 CPU_SET(i % cpunum, &cpu);
808 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
809 thinfo[i].thread_num = i;
810 thinfo[i].tasks = NULL;
811 thinfo[i].barrier = thbarrier;
812 /* setup initial locks */
813 pthread_create(&(thinfo[i].thread_id), &attr,
814 evas_common_pipe_thread, &(thinfo[i]));
815 pthread_attr_destroy(&attr);
816 }
817
818 pthread_barrier_init(&(task_thbarrier[0]), NULL, thread_num + 1);
819 pthread_barrier_init(&(task_thbarrier[1]), NULL, thread_num + 1);
820 for (i = 0; i < thread_num; i++)
821 {
822 pthread_attr_t attr;
823 cpu_set_t cpu;
824
825 pthread_attr_init(&attr);
826 CPU_ZERO(&cpu);
827 CPU_SET(i % cpunum, &cpu);
828 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
829 task_thinfo[i].thread_num = i;
830 task_thinfo[i].tasks = NULL;
831 task_thinfo[i].barrier = task_thbarrier;
832 eina_array_step_set(&task_thinfo[i].cutout_trash, sizeof (Eina_Array), 8);
833 eina_array_step_set(&task_thinfo[i].rects_task, sizeof (Eina_Array), 8);
834 /* setup initial locks */
835 pthread_create(&(task_thinfo[i].thread_id), &attr,
836 evas_common_pipe_load, &(task_thinfo[i]));
837 pthread_attr_destroy(&attr);
838 }
839 }
840
841 if (thread_num == 1) return EINA_FALSE;
842 return EINA_TRUE;
843#endif
844 return EINA_FALSE;
845}
846
847EAPI void 778EAPI void
848evas_common_pipe_image_load(RGBA_Image *im) 779evas_common_pipe_image_load(RGBA_Image *im)
849{ 780{
@@ -915,5 +846,73 @@ evas_common_pipe_map_begin(RGBA_Image *root)
915 846
916 evas_common_pipe_map_render(root); 847 evas_common_pipe_map_render(root);
917} 848}
849#endif
850
851EAPI Eina_Bool
852evas_common_pipe_init(void)
853{
854#ifdef BUILD_PTHREAD
855 if (thread_num == 0)
856 {
857 int cpunum;
858 int i;
859
860 cpunum = eina_cpu_count();
861 thread_num = cpunum;
862// on single cpu we still want this initted.. otherwise we block forever
863// waiting onm pthread barriers for async rendering on a single core!
864// if (thread_num == 1) return EINA_FALSE;
865
866 eina_threads_init();
867
868 LKI(im_task_mutex);
869 LKI(text_task_mutex);
870
871 pthread_barrier_init(&(thbarrier[0]), NULL, thread_num + 1);
872 pthread_barrier_init(&(thbarrier[1]), NULL, thread_num + 1);
873 for (i = 0; i < thread_num; i++)
874 {
875 pthread_attr_t attr;
876 cpu_set_t cpu;
877
878 pthread_attr_init(&attr);
879 CPU_ZERO(&cpu);
880 CPU_SET(i % cpunum, &cpu);
881 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
882 thinfo[i].thread_num = i;
883 thinfo[i].tasks = NULL;
884 thinfo[i].barrier = thbarrier;
885 /* setup initial locks */
886 pthread_create(&(thinfo[i].thread_id), &attr,
887 evas_common_pipe_thread, &(thinfo[i]));
888 pthread_attr_destroy(&attr);
889 }
890
891 pthread_barrier_init(&(task_thbarrier[0]), NULL, thread_num + 1);
892 pthread_barrier_init(&(task_thbarrier[1]), NULL, thread_num + 1);
893 for (i = 0; i < thread_num; i++)
894 {
895 pthread_attr_t attr;
896 cpu_set_t cpu;
897
898 pthread_attr_init(&attr);
899 CPU_ZERO(&cpu);
900 CPU_SET(i % cpunum, &cpu);
901 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
902 task_thinfo[i].thread_num = i;
903 task_thinfo[i].tasks = NULL;
904 task_thinfo[i].barrier = task_thbarrier;
905 eina_array_step_set(&task_thinfo[i].cutout_trash, sizeof (Eina_Array), 8);
906 eina_array_step_set(&task_thinfo[i].rects_task, sizeof (Eina_Array), 8);
907 /* setup initial locks */
908 pthread_create(&(task_thinfo[i].thread_id), &attr,
909 evas_common_pipe_load, &(task_thinfo[i]));
910 pthread_attr_destroy(&attr);
911 }
912 }
918 913
914 if (thread_num == 1) return EINA_FALSE;
915 return EINA_TRUE;
919#endif 916#endif
917 return EINA_FALSE;
918}