From cc8e9b0183abff9cf641213844ab3e31836e540b Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 27 Apr 2000 02:32:28 +0000 Subject: [PATCH] better asm detection - there's an --enable-mmx now too if you want to force or disable the feature by force... it will try autodetect under linux but only on the build machine... SVN revision: 2546 --- README | 2 +- config.h.in | 2 +- configure.in | 29 ++++++++++++++++++++++++++--- src/Makefile.am | 2 +- src/asm_rotate.S | 4 ++-- src/asm_scale.S | 4 ++-- test/main.c | 26 +++++++++++++++++++++++++- 7 files changed, 58 insertions(+), 11 deletions(-) diff --git a/README b/README index 5a78478..25eef8d 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ as well as rendering, manipulation etc. It also does ALL of these FAST and tries to be highly intelligent about doing it to make writing niaeve programs that are still very fast. -This is an early stage of its release and thus is Imlib2 0.0.1 - there are +This is an early stage of its release and thus is Imlib2 0.0.4 - there are bugs that have to be worked out - primarily ones that might deal with network rendering, endianess and the lack of loaders. diff --git a/config.h.in b/config.h.in index 88b66f4..c7beb4f 100644 --- a/config.h.in +++ b/config.h.in @@ -13,7 +13,7 @@ /* Define if you have the header file. */ #undef HAVE_FREETYPE_FREETYPE_H -/* Pentium II/III and up detected - enabling ASM */ +/* enabling MMX Assembly */ #undef DO_MMX_ASM /* Name of package */ diff --git a/configure.in b/configure.in index b4303c5..aca5442 100644 --- a/configure.in +++ b/configure.in @@ -3,10 +3,33 @@ dnl Process this file with autoconf to create configure. AC_INIT(src/Imlib2.h) AM_CONFIG_HEADER(config.h) AC_CANONICAL_SYSTEM -if test x$target_cpu = xi686; then - AC_DEFINE(DO_MMX_ASM, 1, [Pentium II/III and up detected - enabling ASM]) +mmx=no +AC_ARG_ENABLE(mmx, "Enables building of MMX assembly routines", +[ + echo "*****************YESYESYESYESYESYES****************" + if test x$enableval = xyes; then + mmx=yes + fi +], +[ + echo "*****************NOT****************" + if test x$target_os = xlinux-gnu; then + mmx=`cat /proc/cpuinfo | grep mmx` + if test -n "$mmx"; then + mmx=yes + fi +else + echo "You are not running Linux - This script cannot auto-detect mmx assembly." + echo "You will have to ebnalbe the mmx assembly (which gives anywhere from 10%" + echo "to 300% speedups) by adding --enable-mmx on the configure command-line." fi -AM_INIT_AUTOMAKE(imlib2, 0.0.3) +] +) +if test x$mmx = xyes; then + AC_DEFINE(DO_MMX_ASM, 1, [enabling MMX Assembly]) +fi + +AM_INIT_AUTOMAKE(imlib2, 0.0.4) pkglibdir='${libdir}'/loaders AC_SUBST(pkglibdir) diff --git a/src/Makefile.am b/src/Makefile.am index 303f886..0cfccf7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,7 +24,7 @@ libImlib2_la_SOURCES = rend.c ximage.c scale.c rgba.c image.c color.c grab.c \ libImlib2_la_LIBADD = @DLLDFLAGS@ $(top_builddir)/libltdl/libltdlc.la \ -lX11 -lXext -lttf $(LDFLAGS) libImlib2_la_DEPENDENCIES = $(top_builddir)/config.h -libImlib2_la_LDFLAGS = -version-info 0:3:0 +libImlib2_la_LDFLAGS = -version-info 0:4:0 SYS_LOADERS_PATH = @pkglibdir@ image.lo: loaderpath.h diff --git a/src/asm_rotate.S b/src/asm_rotate.S index 8efc52d..72df63b 100644 --- a/src/asm_rotate.S +++ b/src/asm_rotate.S @@ -1,5 +1,7 @@ #include +#ifdef DO_MMX_ASM + /*\ |*| MMX assembly rotation routine for Imlib2 |*| Written by Willem Monsuwe @@ -39,8 +41,6 @@ #define m0fff -28(%ebp) #define mulsow -32(%ebp) -#ifdef DO_MMX_ASM - __imlib_mmx_RotateAA: pushl %ebp movl %esp, %ebp diff --git a/src/asm_scale.S b/src/asm_scale.S index fd0ad24..b2e3e60 100644 --- a/src/asm_scale.S +++ b/src/asm_scale.S @@ -1,5 +1,7 @@ #include +#ifdef DO_MMX_ASM + /*\ |*| MMX assembly scaling routine for Imlib2 |*| Written by Willem Monsuwe @@ -46,8 +48,6 @@ #define yapoints 12(%edx) #define xup_yup 16(%edx) -#ifdef DO_MMX_ASM - __imlib_Scale_mmx_AARGBA: pushl %ebp movl %esp, %ebp diff --git a/test/main.c b/test/main.c index 652e0ce..634af2c 100644 --- a/test/main.c +++ b/test/main.c @@ -184,6 +184,8 @@ int main (int argc, char **argv) { if (scaleup) XResizeWindow(disp, win, w * 4, h * 4); + else if (scaleboth) + XResizeWindow(disp, win, w * 2, h * 2); else XResizeWindow(disp, win, w, h); XMapWindow(disp, win); @@ -352,7 +354,29 @@ int main (int argc, char **argv) } imlib_context_set_image(im); } - pixels += (w - i) * (((w - i) * h) / w); + pixels += (w + i) * (((w + i) * h) / w); + } + } + else if (scaleboth) + { + for (i = 0; i < w * 2; i+= 1) + { + if (!blendtest) + imlib_render_image_on_drawable_at_size(0, 0, + 2 * w - i, (((i) * h) / w)); + else + { + Imlib_Image im_tmp; + im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h, + 2 * w - i, (((i) * h) / w)); + if (im_tmp) + { + imlib_context_set_image(im_tmp); + imlib_free_image(); + } + imlib_context_set_image(im); + } + pixels += (2 * w - i) * (((i) * h) / w); } } }