Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 487728 - media-video/mplayer and media-video/mplayer2 crashes with invalid instruction in vo_draw_alpha_yv12 when using xv output
Summary: media-video/mplayer and media-video/mplayer2 crashes with invalid instruction...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-12 08:28 UTC by Marcin Kowalski
Modified: 2013-10-12 16:44 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Kowalski 2013-10-12 08:28:59 UTC
I've switched my system from amd64 x2 3200+ cpu to a10-6700 cpu. Everything works fine, except mplayer2 with default video output.

I start playing a mp4 file and skip forward with up arrow (or right arrow), and i get this : 

MPlayer interrupted by signal 4 in module: unknown
- MPlayer crashed by an 'Illegal Instruction'.
  It usually happens when you run it on a CPU different than the one it was
  compiled/optimized for.
  Verify this!
- MPlayer crashed by bad usage of CPU/FPU/RAM.
  Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and
  disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.
- MPlayer crashed. This shouldn't happen.
  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
  gcc version. If you think it's MPlayer's fault, please read
  DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and
  won't help unless you provide this information when reporting a possible bug.



gdb backtrace : 

Program received signal SIGILL, Illegal instruction.
0x00000000004f99f6 in vo_draw_alpha_yv12 ()
(gdb) bt
#0  0x00000000004f99f6 in vo_draw_alpha_yv12 ()
#1  0x0000000000441596 in draw_alpha_yv12 ()
#2  0x0000000000503c33 in osd_draw_text_ext ()
#3  0x0000000000503caa in osd_draw_text ()
#4  0x00000000004412e7 in draw_osd ()
#5  0x00000000004a39b8 in control ()
#6  0x00000000004148f4 in main ()


Playback with -vo gl3 doesn't experience any crashes. VLC works fine. mplayer1 also crashes the same way (all packages from current ~amd64 branch)

I've rebuilt mplayer, ffmpeg and x264 on new cpu (i use -march=native all the time) and i can still reproduce the crash.

sample file to reproduce the problem (it happens also on webm files).

youtube-dl --format=22 "https://www.youtube.com/watch?v=QTVU838725c" 


I am using ~amd64 system and system set is up to date.

Reproducible: Always
Comment 1 Nikoli 2013-10-12 12:47:19 UTC
Can not reproduce with mplayer2-2.0_p20130428-r1 or mpv-9999 and the sample (md5 is 965a2b09b8322d4d8a2ce60e349c8c33), are you sure your system is not broken? Are CFLAGS correct? Do all tests work for ffmpeg and git ebuilds? Please try also mpv.

Show your emerge --info and emerge -vp mesa ffmpeg mplayer2
What is your video driver?

I think most likely the problem is related to -march=native, something was done wrong during CPU change.
Comment 2 Marcin Kowalski 2013-10-12 16:15:52 UTC
i am using xf86-video-ati and git build of mesa (updated weekly).

I've been using cflags tuned for lower ram consumption during buildtime : 

CFLAGS="-march=native -mtune=native -O2 -pipe --param ggc-min-expand=10"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--no-keep-memory"

I will see what happens on a few binary distributions with mplayer/mpv, could be some quirk related to cpu.

cflags : 
=============================================================================================
vendor_id	: AuthenticAMD
cpu family	: 21
model		: 19
model name	: AMD A10-6700 APU with Radeon(tm) HD Graphics   
stepping	: 1
cpu MHz		: 1800.000
cache size	: 2048 KB
physical id	: 0
siblings	: 4
core id		: 3
cpu cores	: 2
apicid		: 19
initial apicid	: 3
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold bmi1
bogomips	: 7386.50
TLB size	: 1536 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb eff_freq_ro

=============================================================================================
gcc's explanation of -march=native 
( gcc -march=native -E -v - </dev/null 2>&1 )

COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1/gcc
Target: x86_64-pc-linux-gnu
Configured with: /mnt/storage/tmp/sys-devel-gcc-4.8.1-r1/work/gcc-4.8.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-cloog --disable-isl-version-check --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/python --enable-checking=release --disable-libgcj --enable-libstdcxx-time --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.1-r1 p1.2, pie-0.5.7'
Thread model: posix
gcc version 4.8.1 (Gentoo 4.8.1-r1 p1.2, pie-0.5.7) 
COLLECT_GCC_OPTIONS='-march=native' '-E' '-v'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.1/cc1 -E -quiet -v - -march=bdver2 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mabm -mlwp -mfma -mfma4 -mxop -mbmi -mno-bmi2 -mtbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mno-rdrnd -mf16c -mno-fsgsbase -mno-rdseed -mprfchw -mno-adx -mfxsr -mxsave -mno-xsaveopt --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=bdver2
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include-fixed
 /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"
COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.1/:/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.1/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-march=native' '-E' '-v'



The odd thing is, that the build of mplayer from previous cpu also had the same problem. And this cpu is the exact superset of previous cpu's capabilities. But i had cpudetect flag disabled. I'll see what happens if i enable it.

I'll look into tests in ffmpeg. 

Can someone mark this as waiting for information for now (i don't seem to be able to) ?
Comment 3 Nikoli 2013-10-12 16:30:18 UTC
Running tests is simple:
# FEATURES="test" emerge -1vka ffmpeg git
Comment 4 Marcin Kowalski 2013-10-12 16:44:12 UTC
I rebuilt pretty much everything from the ground up and enabled cpudetection use flag in mplayer2. I no longer experience the crash.

I think it can be closed for now. I'll experiment with it some more.