Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/common Modified Files: Makefile.am evas_cpu.c evas_draw_main.c evas_font_draw.c evas_font_load.c evas_gradient_main.c evas_image_main.c evas_scale_sample.c evas_scale_smooth_scaler_down.c evas_scale_smooth_scaler_up.c Added Files: evas_pipe.c Log Message: 1. evas gets a pipeline with deferred rendering ability (sometimes faster, sometimes slower) 2. --enable-pthreads will enable multi-threaded rendering (current support is for up to 4 threads so if you have a new fanled quad core or dual cpu dual core box or whatever you will in theory be able to max moe of its cpu grunt with the software rendering engine. this can only be done because i added the pipelines which means almsot entirely lock-free multithreading internally in evas. the only locks are for fonts but with a little work i might be able to remove some/most of those too) for now pthreaded rendering likely will be linux only (it relies on sched.h for setting scheduler params to force the slave threads to run on separate cpu's as linux likes to keep them on the same cpu otherwise and thus we get no speedups at all - only slowdowns). aso note that it is a bit of a mixed bag. complex ops (like smooth scaling with alpha blending) get speedups, but simple ops (like blits/fills) slow down. this all neds examination and tweaking still - but it's a start. =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- Makefile.am 28 Oct 2006 03:02:21 -0000 1.22 +++ Makefile.am 13 Nov 2006 23:23:43 -0000 1.23 @@ -54,7 +54,8 @@ evas_scale_span.c \ evas_tiler.c \ evas_regionbuf.c \ -evas_array_hash.c +evas_array_hash.c \ +evas_pipe.c EXTRA_DIST = \ evas_scale_smooth_scaler.c \ =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_cpu.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- evas_cpu.c 11 Nov 2006 06:03:13 -0000 1.29 +++ evas_cpu.c 13 Nov 2006 23:23:43 -0000 1.30 @@ -208,52 +208,24 @@ } #endif -#ifdef BUILD_PTHREAD -EAPI void -_evas_lk_init(Lk *l) -{ - pthread_mutext_init(&(l->mutex), NULL); - l->wlk_id = 0; -// pthread_rwlock_init(&((x)->_reslock.rwl), NULL); -} - -EAPI void -_evas_lk_destroy(Lk *l) -{ - pthread_mutext_destroy(&(l->mutex), NULL); -// pthread_rwlock_destroy(&((x)->_reslock.rwl)); -} - -EAPI void -_evas_lk_read_lock(Lk *l) -{ - pthread_mutex_lock(&l->mutex); - pthread_mutex_unlock(&l->mutex); -// pthread_rwlock_rdlock(&((x)->_reslock.rwl)); -} - -EAPI void -_evas_lk_read_unlock(Lk *l) -{ - pthread_mutex_lock(&l->mutex); - pthread_mutex_unlock(&l->mutex); -// pthread_rwlock_unlock(&((x)->_reslock.rwl)); -} - -EAPI void -_evas_lk_write_lock(Lk *l) +EAPI int +evas_common_cpu_count(void) { - pthread_mutex_lock(&l->mutex); -// pthread_self(); -// pthread_equal(); - pthread_mutex_unlock(&l->mutex); -// pthread_rwlock_wrlock(&((x)->_reslock.rwl)); -} - -EAPI void -_evas_lk_write_unlock(Lk *l) -{ - pthread_mutex_lock(&l->mutex); - pthread_mutex_unlock(&l->mutex); +#ifdef BUILD_PTHREAD + cpu_set_t cpu; + int i; + static int cpus = 0; + + if (cpus != 0) return cpus; + + sched_getaffinity(getpid(), sizeof(cpu), &cpu); + for (i = 0; i < TH_MAX; i++) + { + if (CPU_ISSET(i, &cpu)) cpus = i + 1; + else break; + } + return cpus; +#else + return 1; +#endif } -#endif =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_draw_main.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- evas_draw_main.c 30 Sep 2006 10:18:32 -0000 1.18 +++ evas_draw_main.c 13 Nov 2006 23:23:43 -0000 1.19 @@ -22,8 +22,6 @@ evas_common_shutdown(void) { evas_font_dir_cache_free(); - evas_common_image_line_buffer_free(); - evas_common_image_alpha_line_buffer_free(); evas_common_image_cache_free(); } =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_font_draw.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- evas_font_draw.c 8 Oct 2006 12:43:31 -0000 1.29 +++ evas_font_draw.c 13 Nov 2006 23:23:43 -0000 1.30 @@ -176,6 +176,7 @@ pen_x = x; pen_y = y; + LKL(fn->lock); evas_common_font_size_use(fn); use_kerning = FT_HAS_KERNING(fi->src->ft.face); prev_index = 0; @@ -338,4 +339,5 @@ pen_x += fg->glyph->advance.x >> 16; prev_index = index; } + LKU(fn->lock); } =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_font_load.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- evas_font_load.c 8 Oct 2006 13:58:58 -0000 1.39 +++ evas_font_load.c 13 Nov 2006 23:23:43 -0000 1.40 @@ -265,6 +265,8 @@ fn->fonts = evas_list_append(fn->fonts, fi); fn->hinting = FONT_BYTECODE_HINT; fi->hinting = fn->hinting; + fn->references = 1; + LKI(fn->lock); return fn; } @@ -301,7 +303,8 @@ fn->fonts = evas_list_append(fn->fonts, fi); fn->hinting = FONT_BYTECODE_HINT; fi->hinting = fn->hinting; - + fn->references = 1; + LKI(fn->lock); return fn; } @@ -346,6 +349,8 @@ if (!fn) return; + fn->references--; + if (fn->references > 0) return; for (l = fn->fonts; l; l = l->next) { RGBA_Font_Int *fi; @@ -359,6 +364,7 @@ } } evas_list_free(fn->fonts); + LKD(fn->lock); free(fn); } =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_gradient_main.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- evas_gradient_main.c 30 Sep 2006 10:18:32 -0000 1.12 +++ evas_gradient_main.c 13 Nov 2006 23:23:43 -0000 1.13 @@ -143,6 +143,7 @@ RGBA_Gradient *gr; gr = calloc(1, sizeof(RGBA_Gradient)); + gr->references = 1; return gr; } @@ -150,6 +151,8 @@ evas_common_gradient_free(RGBA_Gradient *gr) { if (!gr) return; + gr->references--; + if (gr->references > 0) return; evas_common_gradient_clear(gr); if (gr->type.name) free(gr->type.name); if (gr->type.params) free(gr->type.params); @@ -481,7 +484,7 @@ alpha_buf = evas_common_image_alpha_line_buffer_obtain(w); if (!alpha_buf) { - evas_common_image_line_buffer_release(); + evas_common_image_line_buffer_release(argb_buf); return; } bfunc = evas_common_gfx_func_composite_pixel_mask_span_get(argb_buf, dst, w, dc->render_op); @@ -496,9 +499,9 @@ { if (!direct_copy) { - evas_common_image_line_buffer_release(); + evas_common_image_line_buffer_release(argb_buf); if (alpha_buf) - evas_common_image_alpha_line_buffer_release(); + evas_common_image_alpha_line_buffer_release(alpha_buf); } return; } @@ -534,9 +537,9 @@ if (!direct_copy) { - evas_common_image_line_buffer_release(); + evas_common_image_line_buffer_release(argb_buf); if (alpha_buf) - evas_common_image_alpha_line_buffer_release(); + evas_common_image_alpha_line_buffer_release(alpha_buf); } } =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_image_main.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -3 -r1.38 -r1.39 --- evas_image_main.c 3 Oct 2006 23:49:03 -0000 1.38 +++ evas_image_main.c 13 Nov 2006 23:23:43 -0000 1.39 @@ -257,12 +257,16 @@ im = calloc(1, sizeof(RGBA_Image)); if (!im) return NULL; im->flags = RGBA_IMAGE_NOTHING; + im->ref = 1; return im; } EAPI void evas_common_image_free(RGBA_Image *im) { + im->ref--; + if (im->ref > 0) return; + evas_common_pipe_free(im); if (im->image) evas_common_image_surface_free(im->image); if (im->info.file) evas_stringshare_del(im->info.file); // if (im->info.real_file) evas_stringshare_del(im->info.real_file); @@ -505,6 +509,8 @@ if (len < 1) return NULL; if (len < EVAS_RGBA_LINE_BUFFER_MIN_LEN) len = EVAS_RGBA_LINE_BUFFER_MIN_LEN; + return evas_common_image_create(len, 1); +/* if (evas_rgba_line_buffer) { if (evas_rgba_line_buffer->image->w >= len) @@ -522,11 +528,14 @@ evas_rgba_line_buffer = evas_common_image_create(len, 1); if (!evas_rgba_line_buffer) return NULL; return evas_rgba_line_buffer; + */ } EAPI void -evas_common_image_line_buffer_release(void) +evas_common_image_line_buffer_release(RGBA_Image *im) { + evas_common_image_free(im); +/* if (!evas_rgba_line_buffer) return; if (EVAS_RGBA_LINE_BUFFER_MAX_LEN < evas_rgba_line_buffer->image->w) { @@ -539,14 +548,18 @@ evas_rgba_line_buffer = NULL; } } + */ } EAPI void -evas_common_image_line_buffer_free(void) +evas_common_image_line_buffer_free(RGBA_Image *im) { + evas_common_image_free(im); +/* if (!evas_rgba_line_buffer) return; evas_common_image_free(evas_rgba_line_buffer); evas_rgba_line_buffer = NULL; + */ } EAPI RGBA_Image * @@ -555,6 +568,8 @@ if (len < 1) return NULL; if (len < EVAS_ALPHA_LINE_BUFFER_MIN_LEN) len = EVAS_ALPHA_LINE_BUFFER_MIN_LEN; + return evas_common_image_alpha_create(len, 1); +/* if (evas_alpha_line_buffer) { if (evas_alpha_line_buffer->image->w >= len) @@ -571,11 +586,14 @@ } evas_alpha_line_buffer = evas_common_image_alpha_create(len, 1); return evas_alpha_line_buffer; + */ } EAPI void -evas_common_image_alpha_line_buffer_release(void) +evas_common_image_alpha_line_buffer_release(RGBA_Image *im) { + evas_common_image_free(im); +/* if (!evas_alpha_line_buffer) return; if (EVAS_ALPHA_LINE_BUFFER_MAX_LEN < evas_alpha_line_buffer->image->w) { @@ -588,14 +606,18 @@ evas_alpha_line_buffer = NULL; } } + */ } EAPI void -evas_common_image_alpha_line_buffer_free(void) +evas_common_image_alpha_line_buffer_free(RGBA_Image *im) { + evas_common_image_free(im); +/* if (!evas_alpha_line_buffer) return; evas_common_image_free(evas_alpha_line_buffer); evas_alpha_line_buffer = NULL; + */ } EAPI void =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_scale_sample.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- evas_scale_sample.c 6 Sep 2006 07:33:40 -0000 1.6 +++ evas_scale_sample.c 13 Nov 2006 23:23:43 -0000 1.7 @@ -283,7 +283,7 @@ #endif { /* a scanline buffer */ - buf = malloc(dst_clip_w * sizeof(DATA32)); + buf = alloca(dst_clip_w * sizeof(DATA32)); if (!buf) goto no_buf; for (y = 0; y < dst_clip_h; y++) @@ -299,7 +299,6 @@ func(buf, NULL, dc->mul.col, dptr, dst_clip_w); dptr += dst_w; } - free(buf); } } =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_scale_smooth_scaler_down.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- evas_scale_smooth_scaler_down.c 2 May 2006 07:28:47 -0000 1.5 +++ evas_scale_smooth_scaler_down.c 13 Nov 2006 23:23:43 -0000 1.6 @@ -18,10 +18,7 @@ goto done_scale_down; /* a scanline buffer */ - line_buf = evas_common_image_line_buffer_obtain(dst_clip_w); - if (!line_buf) - goto done_scale_down; - buf = line_buf->image->data; + buf = alloca(dst_clip_w * sizeof(DATA32)); if (dc->mul.use) func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op); @@ -47,7 +44,6 @@ } done_scale_down: - evas_common_image_line_buffer_release(); if (xpoints) free(xpoints); if (ypoints) free(ypoints); if (xapoints) free(xapoints); =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- evas_scale_smooth_scaler_up.c 5 Oct 2006 05:28:35 -0000 1.9 +++ evas_scale_smooth_scaler_up.c 13 Nov 2006 23:23:43 -0000 1.10 @@ -29,10 +29,7 @@ } if (!direct_scale) { - im_buf = evas_common_image_line_buffer_obtain(dst_clip_w); - if (!im_buf) - return; - buf = im_buf->image->data; + buf = alloca(dst_clip_w * sizeof(DATA32)); if (dc->mul.use) func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op); else @@ -231,6 +228,5 @@ } } done_scale_up: - if (!direct_scale) - evas_common_image_line_buffer_release(); + return; } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs