summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2001-11-20 16:38:34 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2001-11-20 16:38:34 +0000
commit7123fe39ff2c42855c5d96039770bbc4b8ae1f75 (patch)
tree46f364a9cb656c6b7f1a2289b39b4be074b45075
parent047be6140aecd0f18ea0f6ad26590dccd51f0afd (diff)
downloadxine-lib-7123fe39ff2c42855c5d96039770bbc4b8ae1f75.tar.gz
xine-lib-7123fe39ff2c42855c5d96039770bbc4b8ae1f75.tar.bz2
playing with new configfile scheme
CVS patchset: 1089 CVS date: 2001/11/20 16:38:34
-rw-r--r--src/xine-utils/memcpy.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c
index fe548c987..b3cf0e32c 100644
--- a/src/xine-utils/memcpy.c
+++ b/src/xine-utils/memcpy.c
@@ -387,6 +387,22 @@ static unsigned long long int rdtsc()
}
#endif
+static void update_fast_memcpy(void *this_gen, cfg_entry_t *entry)
+{
+ static int config_flags = -1;
+
+ config_flags = xine_mm_accel();
+
+ if( entry->num_value != 0 &&
+ (config_flags & memcpy_method[entry->num_value].cpu_require) ==
+ memcpy_method[entry->num_value].cpu_require ) {
+ printf("xine: using %s\n", memcpy_method[entry->num_value].name );
+ xine_fast_memcpy = memcpy_method[entry->num_value].function;
+ return;
+ } else {
+ printf("xine: will probe memcpy on startup\n" );
+ }
+}
#define BUFSIZE 1024*1024
void xine_probe_fast_memcpy(config_values_t *config)
@@ -394,23 +410,19 @@ void xine_probe_fast_memcpy(config_values_t *config)
unsigned long long t;
char *buf1, *buf2;
int i, j, best;
- static int config_flags = -1;
+ int config_flags = -1;
static char *memcpy_methods[] = {"probe", "glibc",
#ifdef ARCH_X86
"kernel", "mmx", "mmxext", "sse",
#endif
NULL};
-#ifdef ARCH_X86
config_flags = xine_mm_accel();
-#else
- config_flags = 0;
-#endif
best = config->register_enum (config, "misc.memcpy_method", 0,
memcpy_methods,
"Memcopy method to use in xine for large data chunks.",
- NULL, NULL, NULL);
+ NULL, update_fast_memcpy, NULL);
/* check if function is configured and valid for this machine */
if( best != 0 &&
@@ -458,9 +470,6 @@ void xine_probe_fast_memcpy(config_values_t *config)
best = i;
}
- printf("memcpy: using %s\n", memcpy_method[best].name );
- xine_fast_memcpy = memcpy_method[best].function;
-
config->update_num (config, "misc.memcpy_method", best);
free(buf1);