Bug#738760: libav: Add proper raspberry pi CPU detection

Florian Will florian.will at gmail.com
Thu Sep 4 22:17:15 UTC 2014


Hi,

Please note that I'm not the bug submitter.

> Can you provide a patch, please?

As of now, I can't. :/ I don't have the hardware to reproduce this or to
verify the correctness of a patch.

So I can only give a few hints about the background of this bug report.
Anyone not planning to come up with a patch can probably skip it. :-)

> I don't know much about raspbian, and don't understand what you
> actually want to be changed here.

I've used raspbian some time ago. The issue with some packages is that
they enable ARM NEON instructions (and other illegal instructions?)
during compilation, either generally for the armhf architecture, or
based on what the build machine supports. The Raspberry Pi is armhf, but
does not support NEON. Raspbian buildds *do* probably support NEON though.

The Raspbian toolchain is configured to disable NEON. However, libav
apparently still ends up with NEON instructions in the binary.
Surprisingly, NEON is supposed to get enabled for libav only if the
"debian/confflag" script detects that the toolchain supports NEON.

Still, for the libav package in Raspbian, this line was changed:
    #RPI -- don't build neon flavour
    #FLAVORS += neon
And I know Peter Green (plugwash, Raspbian maintainer) wants to stay as
close to Debian as possible since he's a DD, so I assume there is a good
reason for that change.

Since that automatic detection had to be disabled, it probably fails to
work correctly. I guess that means that gcc accepts NEON instructions in
inline assembly if the build machine supports it, even when disabling
NEON in the default compiler flags. Or there's another issue. I don't
have any hardware available to test that.

Also I'm not absolutely sure about the technical background, so take
this with a grain of salt.

If anyone knows how to detect whether or not NEON is enabled in the
toolchain, this check should be used in the "confflags" file, around
line 37, instead of "check_asm vadd.i16"…

Plugwash once told me that cpp -dM /dev/null | grep -i ARM_ARCH_ should
result in "#define __ARM_ARCH_6__ 1" for Raspbian (even on buildds,
IIRC) and in "#define __ARM_ARCH_7A__ 1" for vanilla Debian armhf. Maybe
this can be used as a workaround to check for the environment and
disable NEON if it's ARM_ARCH_6.

Since I don't have the hardware to reproduce this or verify correctness
of a patch, I suppose someone can use these pointers to do the work. Or
maybe the bug will rot in this place until the RPi (or Debian, or libav,
whichever comes first) is obsolete. I wonder if it's worth the effort or
if we should just hope that plugwash always comments out that single
line fast enough. :-) (libav11 was not built for Raspbian yet, probably
because of this.)

Cheers
Florian



More information about the pkg-multimedia-maintainers mailing list