[vlc-commits] Remove plugin directory per CPU capability hack

Rémi Denis-Courmont git at videolan.org
Mon May 9 18:41:33 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May  9 19:19:59 2011 +0300| [da76807ffd1e5792f5279456aea4fae5b8a2c309] | committer: Rémi Denis-Courmont

Remove plugin directory per CPU capability hack

On x86, describing and probing optimized plugins is safe (thanks to the
removal of the -mmmx and -msse2 compiler flags).

On PowerPC, libvlccore is built with -maltivec. This is a bug (no
difference before or after the plugin directory hack).
Describing and probing Altivec plugins is no worse.

On ARM, NEON support is detected only at compilation time currently
for lack of a better alternative. So this is a non-issue.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=da76807ffd1e5792f5279456aea4fae5b8a2c309
---

 src/libvlc.h          |    1 -
 src/misc/cpu.c        |   42 ------------------------------------------
 src/modules/modules.c |    4 +---
 3 files changed, 1 insertions(+), 46 deletions(-)

diff --git a/src/libvlc.h b/src/libvlc.h
index 73270c9..95f9f88 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -68,7 +68,6 @@ void vlc_assert_locked (vlc_mutex_t *);
  */
 extern uint32_t cpu_flags;
 uint32_t CPUCapabilities( void );
-bool vlc_CPU_CheckPluginDir (const char *name);
 
 /*
  * Message/logging stuff
diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index a200936..f40654a 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -317,25 +317,6 @@ unsigned vlc_CPU (void)
     return cpu_flags;
 }
 
-const struct
-{
-    uint32_t value;
-    char name[12];
-} cap_dirs[] = {
-#if defined ( __i386__ ) || defined ( __x86_64__ )
-    { CPU_CAPABILITY_MMX,     "mmx" },
-    { CPU_CAPABILITY_MMXEXT,  "mmxext" },
-    { CPU_CAPABILITY_3DNOW,   "3dnow" },
-    { CPU_CAPABILITY_SSE,     "sse" },
-#endif
-#if defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__)
-    { CPU_CAPABILITY_ALTIVEC, "altivec" },
-#endif
-#if defined (__arm__)
-    { CPU_CAPABILITY_NEON,    "arm_neon" },
-#endif
-};
-
 /**
  * Return the number of available logical CPU.
  */
@@ -403,29 +384,6 @@ unsigned vlc_GetCPUCount(void)
 #endif
 }
 
-/**
- * Check if a directory name contains usable plugins w.r.t. the hardware
- * capabilities. Loading a plugin when the hardware has insufficient
- * capabilities may lead to illegal instructions (SIGILL) and must be avoided.
- *
- * @param name the name of the directory (<b>not</b> the path)
- *
- * @return true if the hardware has sufficient capabilities or the directory
- * does not require any special capability; false if the running hardware has
- * insufficient capabilities.
- */
-bool vlc_CPU_CheckPluginDir (const char *name)
-{
-    const unsigned flags = vlc_CPU ();
-    for (size_t i = 0; i < sizeof (cap_dirs) / sizeof (cap_dirs[0]); i++)
-    {
-        if (strcmp (name, cap_dirs[i].name))
-            continue;
-        return (flags & cap_dirs[i].value) != 0;
-    }
-    return true;
-}
-
 static vlc_memcpy_t pf_vlc_memcpy = memcpy;
 static vlc_memset_t pf_vlc_memset = memset;
 
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 2a4f668..4730661 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -901,9 +901,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
             break;
 
         /* Skip ".", ".." */
-        if (!strcmp (file, ".") || !strcmp (file, "..")
-        /* Skip directories for unsupported optimizations */
-         || !vlc_CPU_CheckPluginDir (file))
+        if (!strcmp (file, ".") || !strcmp (file, ".."))
         {
             free (file);
             continue;



More information about the vlc-commits mailing list