[vlc-devel] [RFC] Plugins CPU requirements

Rémi Denis-Courmont remi at remlab.net
Sat Jan 9 15:03:04 CET 2010


Le samedi 9 janvier 2010 15:13:06 Rémi Denis-Courmont, vous avez écrit :
> If GCC were good at generating MMX and SSE instructions, it could actually
>  use them in the plugin descriptor, and VLC would crash while scanning the
>  plugin directories.
> 
> Obviously, this is a silent bug in the VLC plugins subsystem.

I can think of 6 different (classes of) solutions:


1) Make plugin descriptors static data (a big table of values) instead of an 
exported library function as currently.

I tried doing that -for other reasons- about a year ago, in hope of 
accelerating loading of plugins. It turned out to be slower, which is why I 
never pushed it. Also, some platforms, in particular PE/DLL platforms, cannot 
export data out of their libraries - only functions. So, this looks like a bad 
idea.


2) Encode each CPU requirement through a dedicated exported symbol. For 
instance, if a plugin exposes vlc_plugin_MMX, then it requires MMX.
Generating the module bank will be a tiny bit slower.


3) Encode CPU requirements in the name or path of each plugin. For instance, 
if a plugin file name ends in "_mmx.$(LIBEXT)" it requires MMX.


4) Store optimized plugins in dedicated directories, just like GNU ld (e.g. 
/usr/lib/i686/cmov vs /usr/lib). If a plugin is in an mmx/ (sub)directory, it 
requires MMX. It would be easier if optimized plugins were already in separate 
source code directories - they aren't.


5) Use the offending compiler flags when compiling the optimized functions, 
but not when compiling the plugin descriptor. This requires splitting every 
optimized plugin into two separate Automake targets, one importing the other 
as a static library. This would be annoying.


6) Never use the offending compiler flags at all. I guess this works with GCC 
on 386. I am quite sure this would not work for ARM. I suspect this does not 
work for PowerPC either. This might not work with other compilers (or 
versions).


So basically, solutions 1 and 5 suck. On the other hand, solution 2, 3 and 4 
make the plugins cache dependant on the running processor characteristics. As 
a consequence, optimized plugins will not even be visible in the modules list 
if the running CPU cannot use them.

Opinions?

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list