i was just playing with adding thread supprot to INTERNALS of evas (ie the

renderer gets threaded). if i thread at the simplest levels (low down in for
example the image scaler code - one of the most expensvie gfx routnes) on an
actual dual core system - performance drops by 40%. this just doesn't work
well at that level. thread creates and joins per render op are just a bad
thing (tm) :) so this really needs to go in much higher up and that presents
problems. :( i will need to clearly define entry and exit points to and from
threaded space (and thus all the locks) - remove all nested calls (where
internal code goes thru the same entry/exit points traditionally so it
deadlocks itself).. anyway - this here has all that code stripepd out i
played with - it is just the autofoo and build stuff so we can turn on/off
thread support at will in the build.


SVN revision: 26817
This commit is contained in:
Carsten Haitzler 2006-10-28 03:02:23 +00:00
parent 03e6eca6da
commit fd60c655b0
18 changed files with 126 additions and 54 deletions

View File

@ -958,6 +958,35 @@ AM_CONDITIONAL(BUILD_LOADER_SVG, test x$have_svg = xyes)
#####################################################################
## Cpu based optimizations
#######################################
## PTHREADS
pthread_cflags=""
pthread_libs=""
build_pthreads="no"
AC_MSG_CHECKING(whether to build pthread code)
AC_ARG_ENABLE(pthreads,
[ --enable-pthreads enable threaded rendering], [
if test x"$enableval" = x"yes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(BUILD_SSE, 1, [Build Threaded Rendering])
build_pthreads="yes"
pthread_cflags=""
pthread_libs="-lpthread"
else
AC_MSG_RESULT(no)
build_pthreads="no"
fi
],
[
AC_MSG_RESULT($build_pthreads)
if test x"$build_pthreads" = x"yes" ; then
AC_DEFINE(BUILD_PTHREAD, 1, [Build Threaded Rendering])
pthread_cflags=""
pthread_libs="-lpthread"
fi
]
)
#######################################
## MMX
build_cpu_mmx="no"
@ -1817,6 +1846,9 @@ AC_SUBST(ENGINE_XRENDER_XCB_PRG)
AC_SUBST(altivec_cflags)
AC_SUBST(pthread_cflags)
AC_SUBST(pthread_libs)
#####################################################################
## Output
@ -1933,6 +1965,7 @@ echo " Fallback C Code.........: $build_cpu_c"
echo " MMX.....................: $build_cpu_mmx"
echo " SSE.....................: $build_cpu_sse"
echo " ALTIVEC.................: $build_cpu_altivec"
echo " Thread Support,.........: $build_pthreads"
echo
echo "ARGB Software Engine Options:"
echo " Sampling Scaler.........: $scaler_sample"

View File

@ -9,7 +9,8 @@ INCLUDES = -I. \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ \
@eet_cflags@ \
@FONTCONFIG_CFLAGS@
@FONTCONFIG_CFLAGS@ \
@pthread_cflags@
lib_LTLIBRARIES = libevas.la
@ -29,7 +30,8 @@ libevas_la_LIBADD = \
@dlopen_libs@ \
@FREETYPE_LIBS@ \
@eet_libs@ \
@FONTCONFIG_LIBS@
@FONTCONFIG_LIBS@ \
@pthread_libs@
libevas_la_DEPENDENCIES = \
$(top_builddir)/config.h \

View File

@ -8,7 +8,7 @@ INCLUDES = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @VALGRIND_CFLAGS@ \
@eet_cflags@
@eet_cflags@ @pthread_cflags@
noinst_LTLIBRARIES = libevas_engine_common.la
libevas_engine_common_la_SOURCES = \

View File

@ -6,6 +6,9 @@
#ifndef _WIN32_WCE
/* UNIX compatability functions */
#include "evas_common.h"
#include "evas_private.h"
#include <limits.h>
#include <unistd.h>
#include <stdlib.h>
@ -16,9 +19,6 @@
#include <fnmatch.h>
#include <dirent.h>
#include "evas_common.h"
#include "evas_private.h"
int
evas_file_path_is_full_path(const char *path)
{

View File

@ -12,6 +12,31 @@
#define _GNU_SOURCE
#endif
#ifdef BUILD_PTHREAD
# include <pthread.h>
# define RLK struct { pthread_rwlock_t rwl; } _reslock
# define RLK_ADD(x) pthread_rwlock_init (&((x)->_reslock.rwl), NULL)
# define RLK_DEL(x) pthread_rwlock_destroy(&((x)->_reslock.rwl))
# define RLK_RLK(x) pthread_rwlock_rdlock (&((x)->_reslock.rwl))
# define RLK_WLK(x) pthread_rwlock_wrlock (&((x)->_reslock.rwl))
# define RLK_ULK(x) pthread_rwlock_unlock (&((x)->_reslock.rwl))
#else
# define RLK
# define RLK_ADD(x)
# define RLK_DEL(x)
# define RLK_RLK(x)
# define RLK_WLK(x)
# define RLK_ULK(x)
#endif
typedef struct _Genlock Genlock;
struct _Genlock
{
RLK;
int _dummy;
};
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -80,7 +105,7 @@ typedef unsigned long long DATA64;
typedef unsigned __int64 DATA64;
#define strdup _strdup
#define snprintf _snprintf
#define rewind(f) fseek(f,0,SEEK_SET)
#define rewind(f) fseek(f, 0, SEEK_SET)
#endif
typedef unsigned int DATA32;
@ -706,46 +731,53 @@ EAPI void evas_common_scale_hsva_span (DATA32 *src, DATA8
EAPI void evas_common_scale_hsva_a8_span (DATA32 *src, DATA8 *mask, int src_len, DATA32 mul_col, DATA32 *dst, int dst_len, int dir);
/****/
/*done*/
EAPI void evas_common_image_init (void);
EAPI void evas_common_image_shutdown (void);
EAPI RGBA_Surface *evas_common_image_surface_new (RGBA_Image *im);
EAPI void evas_common_image_surface_free (RGBA_Surface *is);
EAPI void evas_common_image_surface_alloc (RGBA_Surface *is);
EAPI void evas_common_image_surface_dealloc (RGBA_Surface *is);
/*done - internal - dont use */
EAPI RGBA_Surface *evas_common_image_surface_new (RGBA_Image *im);/*2*/
EAPI void evas_common_image_surface_free (RGBA_Surface *is);/*2*/
EAPI void evas_common_image_surface_alloc (RGBA_Surface *is);/*2*/
EAPI void evas_common_image_surface_dealloc (RGBA_Surface *is);/*2*/
EAPI void evas_common_image_cache (RGBA_Image *im); /*2*/
EAPI void evas_common_image_uncache (RGBA_Image *im); /*2*/
EAPI void evas_common_image_store (RGBA_Image *im); /*2*/
EAPI void evas_common_image_unstore (RGBA_Image *im); /*2*/
EAPI RGBA_Image *evas_common_image_find (const char *file, const char *key, DATA64 timestamp, RGBA_Image_Loadopts *lo); /*2*/
EAPI void evas_common_image_cache_free (void); /*2*/
EAPI void evas_common_image_premul (RGBA_Image *im); /*2*/
EAPI void evas_common_image_set_alpha_sparse (RGBA_Image *im); /*2*/
/*done*/
EAPI RGBA_Image *evas_common_image_alpha_create (int w, int h);
EAPI RGBA_Image *evas_common_image_create (int w, int h);
EAPI RGBA_Image *evas_common_image_new (void);
EAPI void evas_common_image_free (RGBA_Image *im);
EAPI void evas_common_image_ref (RGBA_Image *im);
EAPI void evas_common_image_unref (RGBA_Image *im);
EAPI void evas_common_image_cache (RGBA_Image *im);
EAPI void evas_common_image_uncache (RGBA_Image *im);
EAPI void evas_common_image_flush_cache (void);
EAPI void evas_common_image_set_cache (int size);
EAPI int evas_common_image_get_cache (void);
EAPI void evas_common_image_store (RGBA_Image *im);
EAPI void evas_common_image_unstore (RGBA_Image *im);
EAPI RGBA_Image *evas_common_image_find (const char *file, const char *key, DATA64 timestamp, RGBA_Image_Loadopts *lo);
EAPI int evas_common_image_ram_usage (RGBA_Image *im);
EAPI void evas_common_image_dirty (RGBA_Image *im);
EAPI void evas_common_image_cache_free (void);
EAPI RGBA_Image *evas_common_load_image_from_file (const char *file, const char *key, RGBA_Image_Loadopts *lo);
EAPI void evas_common_load_image_data_from_file(RGBA_Image *im);
EAPI int evas_common_save_image_to_file (RGBA_Image *im, const char *file, const char *key, int quality, int compress);
EAPI void evas_common_image_premul (RGBA_Image *im);
EAPI void evas_common_image_set_alpha_sparse (RGBA_Image *im);
EAPI RGBA_Image *evas_common_image_line_buffer_obtain (int len);
EAPI void evas_common_image_line_buffer_release (void);
EAPI void evas_common_image_line_buffer_free (void);
EAPI RGBA_Image *evas_common_image_line_buffer_obtain (int len);
EAPI void evas_common_image_line_buffer_release (void);
EAPI void evas_common_image_line_buffer_free (void);
EAPI RGBA_Image *evas_common_image_alpha_line_buffer_obtain (int len);
EAPI void evas_common_image_alpha_line_buffer_release (void);
EAPI void evas_common_image_alpha_line_buffer_free (void);
/*done*/
EAPI RGBA_Image *evas_common_load_image_from_file (const char *file, const char *key, RGBA_Image_Loadopts *lo);
EAPI void evas_common_load_image_data_from_file(RGBA_Image *im);
EAPI int evas_common_save_image_to_file (RGBA_Image *im, const char *file, const char *key, int quality, int compress);
/****/
EAPI void evas_common_rectangle_init (void);
@ -901,6 +933,9 @@ void evas_common_array_hash_free (Evas_Array_Hash *hash);
void evas_common_array_hash_add (Evas_Array_Hash *hash, int key, int data);
int evas_common_array_hash_search (Evas_Array_Hash *hash, int key);
void evas_stringshare_init(void);
void evas_stringshare_shutdown(void);
/*****************************************************************************/
#ifdef __cplusplus

View File

@ -1,9 +1,9 @@
#include <Edb.h>
#include <zlib.h>
#include "evas_common.h"
#include "evas_private.h"
#include <Edb.h>
#include <zlib.h>
#define SWAP32(x) (x) = ((((x) & 0x000000ff ) << 24) | (((x) & 0x0000ff00 ) << 8) | (((x) & 0x00ff0000 ) >> 8) | (((x) & 0xff000000 ) >> 24))

View File

@ -1,8 +1,8 @@
#include <Eet.h>
#include "evas_common.h"
#include "evas_private.h"
#include <Eet.h>
int evas_image_load_file_head_eet(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_eet(RGBA_Image *im, const char *file, const char *key);

View File

@ -1,12 +1,12 @@
#include "evas_common.h"
#include "evas_private.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <gif_lib.h>
#include "evas_common.h"
#include "evas_private.h"
int evas_image_load_file_head_gif(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_gif(RGBA_Image *im, const char *file, const char *key);

View File

@ -1,10 +1,10 @@
#include "evas_common.h"
#include "evas_private.h"
#include <stdio.h>
#include <jpeglib.h>
#include <setjmp.h>
#include "evas_common.h"
#include "evas_private.h"
typedef struct _JPEG_error_mgr *emptr;
struct _JPEG_error_mgr

View File

@ -1,3 +1,7 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <png.h>
#include <setjmp.h>

View File

@ -1,5 +1,6 @@
#include "evas_common.h"
#include "evas_private.h"
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>

View File

@ -1,10 +1,9 @@
#include <stdio.h>
#include <tiffio.h>
#include "evas_common.h"
#include "evas_private.h"
#include <stdio.h>
#include <tiffio.h>
int evas_image_load_file_head_tiff(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_tiff(RGBA_Image *im, const char *file, const char *key);

View File

@ -1,7 +1,6 @@
#include "evas_common.h"
#include "evas_private.h"
int evas_image_load_file_head_xpm(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_xpm(RGBA_Image *im, const char *file, const char *key);

View File

@ -1,9 +1,8 @@
#include <Edb.h>
#include <zlib.h>
#include "evas_common.h"
#include "evas_private.h"
#include <Edb.h>
#include <zlib.h>
int evas_image_save_file_edb(RGBA_Image *im, const char *file, const char *key, int quality, int compress);

View File

@ -1,8 +1,7 @@
#include <Eet.h>
#include "evas_common.h"
#include "evas_private.h"
#include <Eet.h>
int evas_image_save_file_eet(RGBA_Image *im, const char *file, const char *key, int quality, int compress);

View File

@ -1,10 +1,9 @@
#include <stdio.h>
#include <jpeglib.h>
#include <setjmp.h>
#include "evas_common.h"
#include "evas_private.h"
#include <stdio.h>
#include <jpeglib.h>
#include <setjmp.h>
int evas_image_save_file_jpeg(RGBA_Image *im, const char *file, const char *key, int quality, int compress);

View File

@ -1,10 +1,13 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <png.h>
#include <setjmp.h>
#include "evas_common.h"
#include "evas_private.h"
int evas_image_save_file_png(RGBA_Image *im, const char *file, const char *key, int quality, int compress);
Evas_Image_Save_Func evas_image_save_png_func =

View File

@ -1,8 +1,7 @@
#include <tiffio.h>
#include "evas_common.h"
#include "evas_private.h"
#include <tiffio.h>
int evas_image_save_file_tiff(RGBA_Image *im, const char *file, const char *key, int quality, int compress);