summaryrefslogtreecommitdiff
path: root/src/xine-utils/memcpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-utils/memcpy.c')
-rw-r--r--src/xine-utils/memcpy.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c
index 39cbad416..3e1de857d 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,15 @@ 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 );
-
+
+ config->update_num (config, "misc.memcpy_method", best);
+
free(buf1);
free(buf2);
}