Altivec detection broken on G3 (multiple packages)

Bug #74282 reported by MenTaLguY
36
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ffmpeg (Ubuntu)
Fix Released
Undecided
Unassigned
mplayer (Debian)
Fix Released
Unknown
mplayer (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Most of the media player applications on my G3 iBook no longer work after upgrading to Edgy. Affected applications include totem, mplayer, vlc, and any application using ffmpeg.

All of the affected applications die with SIGILL at an mtrsave instruction when trying to detect whether the CPU supports Altivec.

I suspect the intent in the code is set up a SIGILL handler to catch this case, but the handler is not getting correctly set up, so the application is terminated instead.

Tags: apple g3
Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Actually, it seems to be a bit more complex than that. I've stepped through it more carefully in gdb, and vlc does correctly trap SIGLL from mtvrsave and lvx in its has_altivec(). The real problem comes later on in ff_er_frame_end().

 Program received signal SIGILL, Illegal instruction.
 0x0c7c603c in ff_er_frame_end () from /usr/lib/libavcodec.so.0d

 #0 0x0c7c603c in ff_er_frame_end () from /usr/lib/libavcodec.so.0d
 #1 0x0c7f5bc8 in ff_h263_decode_frame () from /usr/lib/libavcodec.so.0d
 #2 0x0c6bac28 in avcodec_decode_video () from /usr/lib/libavcodec.so.0d

 0x0c7c603c <ff_er_frame_end+8>: vxor v0,v0,v0

Attempting to play the same movie in totem gives me:

 0x0d0ff34c in ff_er_frame_end () from /usr/lib/gstreamer-0.10/libgstffmpeg.so

 #0 0x0d0ff34c in ff_er_frame_end ()
   from /usr/lib/gstreamer-0.10/libgstffmpeg.so
 #1 0x0d1baff8 in ff_h263_decode_frame ()
   from /usr/lib/gstreamer-0.10/libgstffmpeg.so
 #2 0x0d038a18 in avcodec_decode_video ()
   from /usr/lib/gstreamer-0.10/libgstffmpeg.so

 0x0d0ff34c <ff_er_frame_end+8>: vxor v0,v0,v0

ffmpeg appears to be the common factor in all cases. It appears that ffmpeg is incorrectly using Altivec instructions on machines which do not support it.

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

It's also probably worth emphasizing that this is a regression from Breezy.

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Er, and Dapper. ffmpeg worked for me on both.

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Actually, I'm not sure it always worked on Dapper (though that could have been a different issue). No problems on Breezy though.

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

I've confirmed that rebuilding ffmpeg with --disable-altivec fixes the problem for applications dynamically linked with the ffmpeg libraries.

Unfortunately, gstreamer0.10-ffmpeg includes its own copy of ffmpeg which it statically links, so programs using GStreamer still don't work.

Revision history for this message
didier (did447-deactivatedaccount) wrote :

It seems that with the -maltivec switch, gcc can use altivec instructions anywhere...
(maybe only with newer gcc, cf changelog:

Wed, 29 Mar 2006 18:53:35 +0200
 * 005_altivec_flags.diff: (new patch from old diff.gz) proper gcc flags to
    only generate AltiVec code when explicitely asked.
)

You can remove the vxor in ff_er_frame_end by changing the line 666 in
libavcodec/error_resilience.c:

    int threshold_part[4]= {100,100,100};
to
   int threshold_part[3]= {100,100,100};

Don't know if there's others, I haven't a G3 with linux around.

Revision history for this message
Reinhard Tartler (siretart) wrote :

also affects mplayer, see #78426

Changed in mplayer:
status: Unconfirmed → Confirmed
Revision history for this message
Daniel Gimpelevich (daniel-gimpelevich) wrote :

I have posted an ambitiously thorough patch for bug #78426. Please read my comment there.

Revision history for this message
Herbert V. Riedel (hvr) wrote :

Bug #85550 was marked as duplicate of this bug, but it's a different issue; it's about illegal instructions on G4s which _have_ altivec support, but lacks support for some additional opcodes supported by the G5

Revision history for this message
Gioele Barabucci (gioele) wrote :

This bug is still present in Feisty: mplayer crashes with "illegal instruction" and the backtrace shows GetCpuCaps as the last function called.

Changed in mplayer:
status: Unknown → New
Revision history for this message
ski (skibrianski) wrote :

Based on my experience running feisty on a G3, some of you are having a problem that has nothing to do with altivec - it's fsqrt (from -mpowerpc-gpopt) that's causing SIGILL - see #104630. The problem is many of these config scripts check to see what instructions to use based on what host they are compiling on, which results in using fsqrt() if you build on a G5. This is why recompiling with --disable-altivec works - recompiling on a G3, regardless of options, results in a working binary. Whomever compiles this stuff should be using -mcpu=740 -mtune=740 in CFLAGS (even if mplayer yells at you for using non-default flags).

Changed in mplayer:
status: New → Incomplete
Revision history for this message
Reinhard Tartler (siretart) wrote :

the current version of ffmpeg in intrepid does not include altivec code.

Changed in ffmpeg:
status: Confirmed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (5.8 KiB)

This bug was fixed in the package mplayer - 2:1.0~rc3+svn20090426-1ubuntu1

---------------
mplayer (2:1.0~rc3+svn20090426-1ubuntu1) karmic; urgency=low

  * Switch to debian packaging for the mplayer package
  * New upstream release, LP: #336697, #260918, #246675, #243453, #74282
  * Fixes security issues: CVE-2008-5616, LP: #308939
  * many flv fixes LP: #73271, #347021
  * Build and install mencoder
  * Bump epoch

mplayer (1.0~rc3+svn20090426-1) unstable; urgency=low

  [ fabrice ]
  * Introduce the mplayer-nogui package, that does not depend on GTK+

  [ Reinhard Tartler ]
  * new upstream svn version based on the 1.0rc3 branch
  * various cleanups and refactoring in debian/rules
  * no longer remove mencoder.c: It does hardly contain any "dangerous"
    or patented code. Instead:
  * strip libavcodec similar to how its done in the ffmpeg package. This
    brings the patent policy of the mplayer and ffmpeg package in debian
    finally in sync. c.f. the comments and the "discussion" in #522373.
  * install upstream's version of binary_codecs.sh

mplayer (1.0~rc3+svn20090405-1) unstable; urgency=low

  * New upstream version. Track the 1.0rc3 release branch for now.
  * remove 50_r28803_segfault_print_int.patch, merged upstream.
  * no longer remove the TOOLS subdirectory from the upstream source.
  * make get-orig-source rule actually work.
  * disable musepack support. Closes: #476384
  * completely delegate handling of /etc/mplayer/mplayer.conf to
    dpkg. This change removes also all debconf templates and reduces
    package complexity.
  * move .gbp.conf to debian/gbp.conf
  * cleanups in debian/rules: prefer external debhelper helper files
  * enhance upstream Makefile to install gmplayer manpages
     - implement as quilt patch, submitted upstream
     - debian/rules: make use of the added rules
  * use dh_prep instead of dh_clean -k
  * bump Standards-Version to 3.8.1

mplayer (1.0~rc2+svn20090303-7) unstable; urgency=low

  * various cleanups in debian/rules.
  * as a side effect, DEB_BUILD_OPTIONS set to noopt no longer works. It
    really needs to be implemented in ./configure instead of weird hackery
    in debian/rules. patches welcome.
  * run 'make distclean' only of config.mak exists.
  * remove debian/control.mplayer* variants.
  * don't --enable-debug on mipsen. This hopfully fixes the FTBFS on mipsen.

mplayer (1.0~rc2+svn20090303-6) unstable; urgency=low

  [ A Mennucc1 ]

  * use ./configure flags to dynamically link FFmpeg,
    delete patch 30link-system-ffmpeg.patch

  [ Reinhard Tartler ]

  * cleanup debian/rules: use --enable-debug on all architectures but mips.
    in order to fix a FTBFS. This results in making the -dbg package on mips
    useless. If you are interested in having a usable mplayer-dbg package on
    mips, please try enabling that switch in debian/rules and send us your
    buildlog!
  * run 'make distclean' only of config.mak exists
  * cleanup debian/rules: remove unnecessary clean statements

mplayer (1.0~rc2+svn20090303-5) unstable; urgency=low

  * debian/control : move docbook-xml,docbook-xsl,xsltproc from
    Build-Depends-Indep to Build-Depends, since they are needed to run
    config...

Read more...

Changed in mplayer (Ubuntu):
status: Confirmed → Fix Released
Changed in mplayer (Debian):
status: Incomplete → Confirmed
Changed in mplayer (Debian):
status: Confirmed → Fix Released
Changed in mplayer (Debian):
status: Fix Released → Confirmed
Changed in mplayer (Debian):
status: Confirmed → Fix Committed
Changed in mplayer (Debian):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.