mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
Add --gst-disable-cpu-opt argument.
Original commit message from CVS: Add --gst-disable-cpu-opt argument.
This commit is contained in:
parent
ed086d5f79
commit
28fbd2e87b
3 changed files with 49 additions and 38 deletions
|
@ -49,6 +49,8 @@ static gboolean _gst_registry_fixed = FALSE;
|
|||
|
||||
static gboolean _gst_use_threads = TRUE;
|
||||
|
||||
static gboolean _gst_enable_cpu_opt = TRUE;
|
||||
|
||||
static gboolean gst_initialized = FALSE;
|
||||
/* this will be set in popt callbacks when a problem has been encountered */
|
||||
static gboolean _gst_initialization_failure = FALSE;
|
||||
|
@ -88,6 +90,7 @@ enum {
|
|||
ARG_DEBUG_MASK,
|
||||
ARG_MASK,
|
||||
ARG_MASK_HELP,
|
||||
ARG_DISABLE_CPU_OPT,
|
||||
ARG_PLUGIN_SPEW,
|
||||
ARG_PLUGIN_PATH,
|
||||
ARG_PLUGIN_LOAD,
|
||||
|
@ -111,6 +114,7 @@ static const struct poptOption gstreamer_options[] = {
|
|||
{"gst-debug-mask", NUL, POPT_ARG_INT|POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG_MASK, "debugging bitmask", "MASK"},
|
||||
{"gst-mask", NUL, POPT_ARG_INT|POPT_ARGFLAG_STRIP, NULL, ARG_MASK, "bitmask for both info and debugging", "MASK"},
|
||||
{"gst-mask-help", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_MASK_HELP, "how to set the level of diagnostic output (-mask values)", NULL},
|
||||
{"gst-disable-cpu-opt",NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_DISABLE_CPU_OPT,"Disable accelerated CPU instructions", NULL},
|
||||
{"gst-plugin-spew", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_PLUGIN_SPEW, "enable verbose plugin loading diagnostics", NULL},
|
||||
{"gst-plugin-path", NUL, POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, ARG_PLUGIN_PATH, "'" G_SEARCHPATH_SEPARATOR_S "'--separated path list for loading plugins", "PATHS"},
|
||||
{"gst-plugin-load", NUL, POPT_ARG_STRING|POPT_ARGFLAG_STRIP, NULL, ARG_PLUGIN_LOAD, "comma-separated list of plugins to preload in addition to the list stored in env variable GST_PLUGIN_PATH", "PLUGINS"},
|
||||
|
@ -483,7 +487,7 @@ init_post (void)
|
|||
/* register core plugins */
|
||||
_gst_plugin_register_static (&plugin_desc);
|
||||
|
||||
_gst_cpu_initialize ();
|
||||
_gst_cpu_initialize (_gst_enable_cpu_opt);
|
||||
_gst_props_initialize ();
|
||||
_gst_caps_initialize ();
|
||||
_gst_plugin_initialize ();
|
||||
|
@ -598,6 +602,9 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
|
|||
case ARG_MASK_HELP:
|
||||
gst_mask_help ();
|
||||
exit (0);
|
||||
case ARG_DISABLE_CPU_OPT:
|
||||
_gst_enable_cpu_opt = FALSE;
|
||||
break;
|
||||
case ARG_PLUGIN_SPEW:
|
||||
break;
|
||||
case ARG_PLUGIN_PATH:
|
||||
|
|
76
gst/gstcpu.c
76
gst/gstcpu.c
|
@ -1,6 +1,7 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
* 2003 Colin Walters <walters@verbum.org>
|
||||
*
|
||||
* gstcpu.c: CPU detection and architecture-specific routines
|
||||
*
|
||||
|
@ -25,78 +26,81 @@
|
|||
#include "gst_private.h"
|
||||
#include "gstcpu.h"
|
||||
|
||||
static guint32 _gst_cpu_flags;
|
||||
static guint32 _gst_cpu_flags = 0;
|
||||
|
||||
#ifdef HAVE_CPU_I386
|
||||
#define _gst_cpu_initialize_arch _gst_cpu_initialize_i386
|
||||
void gst_cpuid_i386 (int, unsigned long *, unsigned long *, unsigned long *, unsigned long *);
|
||||
#define gst_cpuid gst_cpuid_i386
|
||||
#else
|
||||
#define gst_cpuid(o,a,b,c,d) (void)(a);(void)(b);(void)(c);
|
||||
#define _gst_cpu_initialize_arch _gst_cpu_initialize_none
|
||||
#endif
|
||||
|
||||
static gchar *
|
||||
stringcat (gchar * a, gchar * b)
|
||||
{
|
||||
gchar *c;
|
||||
|
||||
if (a) {
|
||||
c = g_strconcat (a, b, NULL);
|
||||
g_free (a);
|
||||
}
|
||||
else {
|
||||
c = g_strdup (b);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
gboolean _gst_cpu_initialize_i386 (gulong *flags, GString *featurelist);
|
||||
|
||||
void
|
||||
_gst_cpu_initialize (void)
|
||||
_gst_cpu_initialize (gboolean opt)
|
||||
{
|
||||
gchar *featurelist = NULL;
|
||||
gboolean AMD;
|
||||
GString *featurelist = g_string_new ("");
|
||||
gulong flags = 0;
|
||||
|
||||
if (opt) {
|
||||
if (!_gst_cpu_initialize_arch (&flags, featurelist))
|
||||
g_string_append (featurelist, "NONE");
|
||||
} else
|
||||
g_string_append (featurelist, "(DISABLED)");
|
||||
|
||||
GST_INFO (GST_CAT_GST_INIT, "CPU features: (%08lx) %s", flags, featurelist->str);
|
||||
g_string_free (featurelist, TRUE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gst_cpu_initialize_none (gulong *flags, GString *featurelist)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gst_cpu_initialize_i386 (gulong *flags, GString *featurelist)
|
||||
{
|
||||
gboolean AMD;
|
||||
gulong eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
|
||||
gst_cpuid (0, &eax, &ebx, &ecx, &edx);
|
||||
gst_cpuid_i386 (0, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
|
||||
|
||||
gst_cpuid (1, &eax, &ebx, &ecx, &edx);
|
||||
gst_cpuid_i386 (1, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
if (edx & (1 << 23)) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_MMX;
|
||||
featurelist = stringcat (featurelist, "MMX ");
|
||||
g_string_append (featurelist, "MMX ");
|
||||
|
||||
if (edx & (1 << 25)) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_SSE;
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_MMXEXT;
|
||||
featurelist = stringcat (featurelist, "SSE ");
|
||||
g_string_append (featurelist, "SSE ");
|
||||
}
|
||||
|
||||
gst_cpuid (0x80000000, &eax, &ebx, &ecx, &edx);
|
||||
gst_cpuid_i386 (0x80000000, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
if (eax >= 0x80000001) {
|
||||
|
||||
gst_cpuid (0x80000001, &eax, &ebx, &ecx, &edx);
|
||||
gst_cpuid_i386 (0x80000001, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
if (edx & (1 << 31)) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_3DNOW;
|
||||
featurelist = stringcat (featurelist, "3DNOW ");
|
||||
g_string_append (featurelist, "3DNOW ");
|
||||
}
|
||||
if (AMD && (edx & (1 << 22))) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_MMXEXT;
|
||||
featurelist = stringcat (featurelist, "MMXEXT ");
|
||||
g_string_append (featurelist, "MMXEXT ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!_gst_cpu_flags) {
|
||||
featurelist = stringcat (featurelist, "NONE");
|
||||
}
|
||||
|
||||
GST_INFO (GST_CAT_GST_INIT, "CPU features: (%08lx) %s", edx, featurelist);
|
||||
g_free (featurelist);
|
||||
*flags = eax;
|
||||
if (_gst_cpu_flags)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GstCPUFlags
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef enum {
|
|||
GST_CPU_FLAG_3DNOW = (1<<3)
|
||||
} GstCPUFlags;
|
||||
|
||||
void _gst_cpu_initialize (void);
|
||||
void _gst_cpu_initialize (gboolean useopt);
|
||||
|
||||
GstCPUFlags gst_cpu_get_flags (void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue