GNOME Bugzilla – Bug 518564
goom dies with illegal instruction
Last modified: 2008-02-26 09:33:23 UTC
zoom_filter_xmmx (prevX=426, prevY=320, expix1=0xb4aab080, expix2=0xb1870080, lbruS=0xb15bf080, lbruD=0xb13a9080, buffratio=127, precalCoef=0x85bddc8) at xmmx.c:212 212 __asm__ __volatile__ ("femms\n"); (gdb) bt
+ Trace 190375
$ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 13 model name : Intel(R) Pentium(R) M processor 1.86GHz stepping : 8 cpu MHz : 800.000 cache size : 2048 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe up est tm2 bogomips : 1598.38 clflush size : 64
Works fine for me with extended MMX, i.e. zoom_filter_xmmx()... From the /proc/cpuinfo output your CPU doesn't support extended MMX (aka XMMX, mmxext) so this looks like a liboil bug then. $ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 6 model : 10 model name : AMD Athlon(TM) XP 2600+ stepping : 0 cpu MHz : 1905.504 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow up ts bogomips : 3814.47 clflush size : 32
The assignment of zoom_filter_xmmx() and draw_line_xmmx() are inside: unsigned int cpuFlavour = oil_cpu_get_flags (); [..] if (cpuFlavour & OIL_IMPL_FLAG_MMXEXT) { } Sounds like a liboil indeed.
Strange, if I comments out //__asm__ __volatile__ ("femms\n"); in xmmx.c:212 it works. I also get the artifacts that tim reported in Bug Bug #518213 though.
I can confirm that it also works if I change the two occurances of __asm__ __volatile__ ("femms\n"); to __asm__ __volatile__ ("emms\n"); in xmmx.c
FEMMS is AMD only, but liboil says: * @OIL_IMPL_FLAG_MMXEXT: uses AMD's extended MMX instructions. These * are a subset of what Intel calls SSE2. If an implementation uses * only AMD's extended MMX instructions, it should set this flag, and * not @OIL_IMPL_FLAG_SSE2.
I can confirm that it also works if I change the two occurances of __asm__ __volatile__ ("femms\n"); to __asm__ __volatile__ ("emms\n"); in xmmx.c. I also filed a bug against liboil https://bugs.freedesktop.org/show_bug.cgi?id=14662 Then also the check in goom is not enough. See http://softpixel.com/~cwright/programming/simd/3dn.php femms is 'faster emms' and it is part of 3dnow. My cpu does not have 3dnow. So goom should either use emms or check for 3dnow as well.
femms is a 3dnow instruction, not mmxext, so you should check for its availability with OIL_IMPL_FLAG_3DNOW. MMXEXT are the overlap instructions between SSE2 and 3DNow!.
Let's go with emms instead then. David, is that safe to do?
Yes. "emms" and "femms" are identical. According to AMD, "femms" is faster on some CPU, but I've never seen evidence of that.
So this bug can be closed now: 2008-02-25 Stefan Kost <ensonic@users.sf.net> * gst/goom/xmmx.c: Use 'emms' instead of 'femms' to not crash on cpus that do not implement this 3dnow specific instruction.