summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/engines/common/evas_pipe.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-10-17 03:55:50 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-10-17 03:55:50 +0000
commitae3f83a212388cfa704f58e446c682e1fa1b0883 (patch)
tree8192b3ef060b56f5549b9bbb5f840aebae0c978f /legacy/evas/src/lib/engines/common/evas_pipe.c
parent42a59387a67f4c5c9604b2ae36a3cbbf5e02f47f (diff)
use eina barrier in evas.
SVN revision: 78101
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c
index 6803154246..48dcebac65 100644
--- a/legacy/evas/src/lib/engines/common/evas_pipe.c
+++ b/legacy/evas/src/lib/engines/common/evas_pipe.c
@@ -12,7 +12,7 @@ typedef struct _Thinfo
12 RGBA_Image *im; 12 RGBA_Image *im;
13 int thread_num; 13 int thread_num;
14 pthread_t thread_id; 14 pthread_t thread_id;
15 pthread_barrier_t *barrier; 15 Eina_Barrier *barrier;
16 const Eina_Inlist *tasks; 16 const Eina_Inlist *tasks;
17 Eina_Array cutout_trash; 17 Eina_Array cutout_trash;
18 Eina_Array rects_task; 18 Eina_Array rects_task;
@@ -88,7 +88,7 @@ evas_common_pipe_thread(void *data)
88 88
89 /* wait for start signal */ 89 /* wait for start signal */
90// INF(" TH %i START...", thinfo->thread_num); 90// INF(" TH %i START...", thinfo->thread_num);
91 pthread_barrier_wait(&(thinfo->barrier[0])); 91 eina_barrier_wait(&(thinfo->barrier[0]));
92 92
93 EINA_INLIST_FOREACH(thinfo->tasks, info) 93 EINA_INLIST_FOREACH(thinfo->tasks, info)
94 { 94 {
@@ -106,7 +106,7 @@ evas_common_pipe_thread(void *data)
106 106
107 thinfo->tasks = NULL; 107 thinfo->tasks = NULL;
108 108
109 pthread_barrier_wait(&(thinfo->barrier[1])); 109 eina_barrier_wait(&(thinfo->barrier[1]));
110 } 110 }
111 return NULL; 111 return NULL;
112} 112}
@@ -114,13 +114,13 @@ evas_common_pipe_thread(void *data)
114static Eina_List *im_task = NULL; 114static Eina_List *im_task = NULL;
115static Eina_List *text_task = NULL; 115static Eina_List *text_task = NULL;
116static Thinfo task_thinfo[TH_MAX]; 116static Thinfo task_thinfo[TH_MAX];
117static pthread_barrier_t task_thbarrier[2]; 117static Eina_Barrier task_thbarrier[2];
118static LK(im_task_mutex); 118static LK(im_task_mutex);
119static LK(text_task_mutex); 119static LK(text_task_mutex);
120 120
121static int thread_num = 0; 121static int thread_num = 0;
122static Thinfo thinfo[TH_MAX]; 122static Thinfo thinfo[TH_MAX];
123static pthread_barrier_t thbarrier[2]; 123static Eina_Barrier thbarrier[2];
124 124
125static RGBA_Pipe_Thread_Info *buf = NULL; 125static RGBA_Pipe_Thread_Info *buf = NULL;
126static unsigned int buf_size = 0; 126static unsigned int buf_size = 0;
@@ -212,7 +212,7 @@ evas_common_pipe_begin(RGBA_Image *im)
212 } 212 }
213 213
214 /* tell worker threads to start */ 214 /* tell worker threads to start */
215 pthread_barrier_wait(&(thbarrier[0])); 215 eina_barrier_wait(&(thbarrier[0]));
216} 216}
217 217
218EAPI void 218EAPI void
@@ -222,7 +222,7 @@ evas_common_pipe_flush(RGBA_Image *im)
222 if (thread_num > 1) 222 if (thread_num > 1)
223 { 223 {
224 /* sync worker threads */ 224 /* sync worker threads */
225 pthread_barrier_wait(&(thbarrier[1])); 225 eina_barrier_wait(&(thbarrier[1]));
226 } 226 }
227 else 227 else
228 { 228 {
@@ -614,16 +614,14 @@ evas_common_pipe_map_draw_do(RGBA_Image *dst, const RGBA_Pipe_Op *op, const RGBA
614} 614}
615 615
616static Eina_Bool 616static Eina_Bool
617evas_common_pipe_map_draw_prepare(void *data, RGBA_Image *dst, RGBA_Pipe_Op *op) 617evas_common_pipe_map_draw_prepare(void *data __UNUSED__, RGBA_Image *dst, RGBA_Pipe_Op *op)
618{ 618{
619 RGBA_Draw_Context context; 619 RGBA_Draw_Context context;
620 Thinfo *info = data;
621 Eina_Bool r; 620 Eina_Bool r;
622 621
623 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context)); 622 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
624 r = evas_common_map_rgba_prepare(op->op.map.src, dst, 623 r = evas_common_map_rgba_prepare(op->op.map.src, dst,
625 &context, op->op.map.m); 624 &context, op->op.map.m);
626
627 return r; 625 return r;
628} 626}
629 627
@@ -634,7 +632,6 @@ evas_common_pipe_map_draw(RGBA_Image *src, RGBA_Image *dst,
634{ 632{
635 RGBA_Pipe_Op *op; 633 RGBA_Pipe_Op *op;
636 /* RGBA_Map_Point *pts_copy; */ 634 /* RGBA_Map_Point *pts_copy; */
637 int i;
638 635
639 if (!src) return; 636 if (!src) return;
640 /* pts_copy = malloc(sizeof (RGBA_Map_Point) * 4); */ 637 /* pts_copy = malloc(sizeof (RGBA_Map_Point) * 4); */
@@ -703,7 +700,7 @@ evas_common_pipe_load(void *data)
703 Eina_Array_Iterator it; 700 Eina_Array_Iterator it;
704 unsigned int i; 701 unsigned int i;
705 /* wait for start signal */ 702 /* wait for start signal */
706 pthread_barrier_wait(&(tinfo->barrier[0])); 703 eina_barrier_wait(&(tinfo->barrier[0]));
707 704
708 while (im_task) 705 while (im_task)
709 { 706 {
@@ -752,7 +749,7 @@ evas_common_pipe_load(void *data)
752 eina_array_clean(&tinfo->rects_task); 749 eina_array_clean(&tinfo->rects_task);
753 750
754 /* send finished signal */ 751 /* send finished signal */
755 pthread_barrier_wait(&(tinfo->barrier[1])); 752 eina_barrier_wait(&(tinfo->barrier[1]));
756 } 753 }
757 754
758 return NULL; 755 return NULL;
@@ -769,10 +766,10 @@ evas_common_pipe_load_do(RGBA_Image *im)
769 task_thinfo[i].im = im; 766 task_thinfo[i].im = im;
770 767
771 /* Notify worker thread. */ 768 /* Notify worker thread. */
772 pthread_barrier_wait(&(task_thbarrier[0])); 769 eina_barrier_wait(&(task_thbarrier[0]));
773 770
774 /* sync worker threads */ 771 /* sync worker threads */
775 pthread_barrier_wait(&(task_thbarrier[1])); 772 eina_barrier_wait(&(task_thbarrier[1]));
776} 773}
777 774
778EAPI void 775EAPI void
@@ -868,8 +865,8 @@ evas_common_pipe_init(void)
868 LKI(im_task_mutex); 865 LKI(im_task_mutex);
869 LKI(text_task_mutex); 866 LKI(text_task_mutex);
870 867
871 pthread_barrier_init(&(thbarrier[0]), NULL, thread_num + 1); 868 eina_barrier_new(&(thbarrier[0]), thread_num + 1);
872 pthread_barrier_init(&(thbarrier[1]), NULL, thread_num + 1); 869 eina_barrier_new(&(thbarrier[1]), thread_num + 1);
873 for (i = 0; i < thread_num; i++) 870 for (i = 0; i < thread_num; i++)
874 { 871 {
875 pthread_attr_t attr; 872 pthread_attr_t attr;
@@ -892,8 +889,8 @@ evas_common_pipe_init(void)
892 pthread_attr_destroy(&attr); 889 pthread_attr_destroy(&attr);
893 } 890 }
894 891
895 pthread_barrier_init(&(task_thbarrier[0]), NULL, thread_num + 1); 892 eina_barrier_new(&(task_thbarrier[0]), thread_num + 1);
896 pthread_barrier_init(&(task_thbarrier[1]), NULL, thread_num + 1); 893 eina_barrier_new(&(task_thbarrier[1]), thread_num + 1);
897 for (i = 0; i < thread_num; i++) 894 for (i = 0; i < thread_num; i++)
898 { 895 {
899 pthread_attr_t attr; 896 pthread_attr_t attr;