summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-11-18 00:05:06 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-11-18 00:05:06 +0000
commit803c6427205dd92bf1df072c49e26f7c700a2423 (patch)
tree0447962e6f8e33f28788fd0f991ee38a373f54c7
parent9ee92c975ddef88214ce317d9a25ff37d080aeed (diff)
downloadxine-lib-803c6427205dd92bf1df072c49e26f7c700a2423.tar.gz
xine-lib-803c6427205dd92bf1df072c49e26f7c700a2423.tar.bz2
update to latest mpeg2dec x86_accel sources, hopefully this solves conftest segfault
CVS patchset: 1062 CVS date: 2001/11/18 00:05:06
-rw-r--r--src/xine-utils/Makefile.am29
-rw-r--r--src/xine-utils/cpu_accel.c159
-rw-r--r--src/xine-utils/memcpy.c28
3 files changed, 102 insertions, 114 deletions
diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am
index c3f61ef41..2f6da8855 100644
--- a/src/xine-utils/Makefile.am
+++ b/src/xine-utils/Makefile.am
@@ -2,18 +2,11 @@
## Process this file with automake to produce Makefile.in
##
-CFLAGS = @GLOBAL_CFLAGS@ @THREAD_CFLAGS@ -DXINEUTILS_COMPILE
-
-
-EXTRA_DIST = cpu_accel.c
+CFLAGS = @GLOBAL_CFLAGS@
lib_LTLIBRARIES = libxineutils.la
-libxineutils_la_SOURCES = utils.c memcpy.c monitor.c
-libxineutils_la_LIBADD = cpu_accel.lo \
- $(THREAD_LIBS) \
- $(DYNAMIC_LD_LIBS) \
- -lm
+libxineutils_la_SOURCES = utils.c memcpy.c monitor.c cpu_accel.c
libxineutils_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
@@ -21,24 +14,6 @@ libxineutils_la_LDFLAGS = \
include_HEADERS = xineutils.h attributes.h
-###
-# Hardcoded rule:
-# gcc failed to compile this with -fPIC flag
-# hackish: [X] yes [ ] no
-#
-LIBTOOLNOFPIC = $(SHELL) $(top_builddir)/libtool-nofpic
-LTCOMPILENOFPIC = $(LIBTOOLNOFPIC) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-cpu_accel.lo: cpu_accel.c
- @mkdir -p .deps; touch .deps/cpu_accel.pp; \
- echo '$(LTCOMPILENOFPIC) -c $<'; \
- $(LTCOMPILENOFPIC) -Wp,-MD,.deps/$(*F).pp -c $<
- @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
- < .deps/$(*F).pp > .deps/$(*F).P; \
- tr ' ' '\012' < .deps/$(*F).pp \
- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
- >> .deps/$(*F).P; \
- rm -f .deps/$(*F).pp
-
debug:
@$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c
index b463b3140..838366c77 100644
--- a/src/xine-utils/cpu_accel.c
+++ b/src/xine-utils/cpu_accel.c
@@ -18,7 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define XINEUTILS_COMPILE
#include "config.h"
@@ -30,98 +29,100 @@
#ifdef ARCH_X86
static uint32_t x86_accel (void)
{
- uint32_t eax, ebx, ecx, edx;
- int AMD;
- uint32_t caps;
-
-#define cpuid(op,eax,ebx,ecx,edx) \
- asm ("cpuid" \
- : "=a" (eax), \
- "=b" (ebx), \
- "=c" (ecx), \
- "=d" (edx) \
- : "a" (op) \
- : "cc")
-
-
- asm ("pushfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "movl %0,%1\n\t"
- "xorl $0x200000,%0\n\t"
- "pushl %0\n\t"
- "popfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "popfl"
- : "=a" (eax),
- "=b" (ebx)
- :
- : "cc");
-
- if (eax == ebx) /* no cpuid */
- return 0;
-
- cpuid (0x00000000, eax, ebx, ecx, edx);
- if (!eax) /* vendor string only */
- return 0;
-
- AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
-
- cpuid (0x00000001, eax, ebx, ecx, edx);
- if (! (edx & 0x00800000)) /* no MMX */
- return 0;
- caps = MM_ACCEL_X86_MMX;
-
- if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */
- caps |= MM_ACCEL_X86_SSE | MM_ACCEL_X86_MMXEXT;
-
- if (edx & 0x04000000) /* SSE2 */
- caps |= MM_ACCEL_X86_SSE2;
-
- cpuid (0x80000000, eax, ebx, ecx, edx);
- if (eax < 0x80000001) /* no extended capabilities */
- return caps;
-
- cpuid (0x80000001, eax, ebx, ecx, edx);
-
- if (edx & 0x80000000) /* 3DNOW */
- caps |= MM_ACCEL_X86_3DNOW;
-
- if (edx & 0x40000000) /* 3DNOWEXT */
- /*caps |= MM_ACCEL_X86_???*/ ;
-
- if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
- caps |= MM_ACCEL_X86_MMXEXT;
+ uint32_t eax, ebx, ecx, edx;
+ int AMD;
+ uint32_t caps;
+
+#ifndef PIC
+#define cpuid(op,eax,ebx,ecx,edx) \
+ asm ("cpuid" \
+ : "=a" (eax), \
+ "=b" (ebx), \
+ "=c" (ecx), \
+ "=d" (edx) \
+ : "a" (op) \
+ : "cc")
+#else // PIC version : save ebx
+#define cpuid(op,eax,ebx,ecx,edx) \
+ asm ("pushl %%ebx\n\t" \
+ "cpuid\n\t" \
+ "movl %%ebx,%1\n\t" \
+ "popl %%ebx" \
+ : "=a" (eax), \
+ "=r" (ebx), \
+ "=c" (ecx), \
+ "=d" (edx) \
+ : "a" (op) \
+ : "cc")
+#endif
+
+ asm ("pushfl\n\t"
+ "pushfl\n\t"
+ "popl %0\n\t"
+ "movl %0,%1\n\t"
+ "xorl $0x200000,%0\n\t"
+ "pushl %0\n\t"
+ "popfl\n\t"
+ "pushfl\n\t"
+ "popl %0\n\t"
+ "popfl"
+ : "=r" (eax),
+ "=r" (ebx)
+ :
+ : "cc");
+
+ if (eax == ebx) /* no cpuid */
+ return 0;
+
+ cpuid (0x00000000, eax, ebx, ecx, edx);
+ if (!eax) /* vendor string only */
+ return 0;
+
+ AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
+
+ cpuid (0x00000001, eax, ebx, ecx, edx);
+ if (! (edx & 0x00800000)) /* no MMX */
+ return 0;
+
+ caps = MM_ACCEL_X86_MMX;
+ if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */
+ caps = MM_ACCEL_X86_MMX | MM_ACCEL_X86_MMXEXT;
+ cpuid (0x80000000, eax, ebx, ecx, edx);
+ if (eax < 0x80000001) /* no extended capabilities */
return caps;
+
+ cpuid (0x80000001, eax, ebx, ecx, edx);
+
+ if (edx & 0x80000000)
+ caps |= MM_ACCEL_X86_3DNOW;
+
+ if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
+ caps |= MM_ACCEL_X86_MMXEXT;
+
+ return caps;
}
#endif
+
uint32_t xine_mm_accel (void)
{
#ifdef ARCH_X86
- static int got_accel = 0;
- static uint32_t accel;
+ static int got_accel = 0;
+ static uint32_t accel;
- if (!got_accel) {
- got_accel = 1;
- accel = x86_accel ();
- }
+ if (!got_accel) {
+ got_accel = 1;
+ accel = x86_accel ();
+ }
- return accel;
+ return accel;
#else
#ifdef HAVE_MLIB
- return MM_ACCEL_MLIB;
+ return MM_ACCEL_MLIB;
#else
- return 0;
+ return 0;
#endif
#endif
}
-/*
-uint32_t xine_mm_support (void)
-{
- return xine_mm_accel();
-}
-*/
diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c
index 39cbad416..66185d632 100644
--- a/src/xine-utils/memcpy.c
+++ b/src/xine-utils/memcpy.c
@@ -362,6 +362,7 @@ static struct {
uint32_t cpu_require;
} memcpy_method[] =
{
+ { NULL, NULL, 0, 0 },
{ "glibc memcpy()", memcpy, 0, 0 },
#ifdef ARCH_X86
{ "linux kernel memcpy()", linux_kernel_memcpy, 0, 0 },
@@ -407,6 +408,8 @@ void xine_probe_fast_memcpy(config_values_t *config)
char *buf1, *buf2;
int i, j, best;
static int config_flags = -1;
+ static char *memcpy_methods[] = {"probe", "glibc", "kernel",
+ "mmx", "mmxext", "sse", NULL};
#ifdef ARCH_X86
config_flags = xine_mm_accel();
@@ -414,9 +417,13 @@ void xine_probe_fast_memcpy(config_values_t *config)
config_flags = 0;
#endif
- best = config->lookup_int (config, "fast_memcpy", -1);
+ best = config->register_enum (config, "misc.memcpy_method", 0,
+ memcpy_methods,
+ "Memcopy method to use in xine for large data chunks.",
+ NULL, NULL, NULL);
+
/* check if function is configured and valid for this machine */
- if( best != -1 &&
+ if( best != 0 &&
(config_flags & memcpy_method[best].cpu_require) ==
memcpy_method[best].cpu_require ) {
printf("xine: using %s\n", memcpy_method[best].name );
@@ -424,7 +431,7 @@ void xine_probe_fast_memcpy(config_values_t *config)
return;
}
- best = -1;
+ best = 0;
xine_fast_memcpy = memcpy;
@@ -440,7 +447,7 @@ void xine_probe_fast_memcpy(config_values_t *config)
/* make sure buffers are present on physical memory */
memcpy(buf1,buf2,BUFSIZE);
- for(i=0; memcpy_method[i].name; i++)
+ for(i=1; memcpy_method[i].name; i++)
{
if( (config_flags & memcpy_method[i].cpu_require) !=
memcpy_method[i].cpu_require )
@@ -464,13 +471,18 @@ void xine_probe_fast_memcpy(config_values_t *config)
printf("\t%s : %lld\n",memcpy_method[i].name, t);
- if( best == -1 || t < memcpy_method[best].time )
+ if( best == 0 || t < memcpy_method[best].time )
best = i;
}
- printf("xine: using %s\n", memcpy_method[best].name );
+
+ printf("memcpy: using %s\n", memcpy_method[best].name );
xine_fast_memcpy = memcpy_method[best].function;
- config->set_int (config, "fast_memcpy", best );
-
+
+ {
+ cfg_entry_t *cfg_entry = config->lookup_entry (config, "fast_memcpy");
+ cfg_entry->enum_value = best;
+ }
+
free(buf1);
free(buf2);
}