Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 351338 - media-libs/mesa-7.9.1: Gallium does not work with >=sys-devel/llvm-2.9?
Summary: media-libs/mesa-7.9.1: Gallium does not work with >=sys-devel/llvm-2.9?
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo X packagers
URL: https://bugs.freedesktop.org/show_bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-10 21:39 UTC by Jan Seiffert
Modified: 2011-04-17 22:56 UTC (History)
3 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 Jan Seiffert 2011-01-10 21:39:00 UTC
Where to start...

I am a happy user of nouveau with working 3D. Thanks to a lot of "on-the-bleeding-edge" versions. A DRM-Tree Kernel, a libdrm-9999 and now thanks to the latest Gentoo move to xorg-1.9 with Mesa 7.9.
Not quite Mesa 7.9. due to the API breakage in libdrm-2.4.23 (libdrm-9999 clearly being above that) first Mesa 7.9-r1 and now Mesa-7.9.1.

The problem i want to describe here comes from another side: LLVM
Since i am also interrested in software development i have "the latest and greatest" LLVM.
More precisly sys-devel/llvm-9999.
Yes, thats the SVN-snapshot, i need it to test llvm/clang because i have several bugs open in the llvm Bugzilla...

The problem is now the following:
LLVM used to emit MMX code, which would badly interact with the x86 fpu. For this reason Gallium used to disable MMX generation (Mesa-7.9.1/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp:lp_set_target_options(void) passes "-disable-mmx" to llvm).
But LLVM droped that option (acording to the original bugreport mentioned in the Gallium source (http://llvm.org/bugs/show_bug.cgi?id=3287) already for llvm-2.8).

The result is: llvm aborts, gallium is not working, no gl.


Reproducible: Always

Steps to Reproduce:
1. make sure you have a gfx-card that would work with gallium
2. add "gallium llvm" to your use flags
2. install newest llvm
3. install mesa-7.9
5. configure mesa to use gallium (eselect mesa)
6. glxinfo

Actual Results:  
$ glxinfo 
name of display: :0
prog: Unknown command line argument '-disable-mmx'.  Try: 'prog -help'
$ echo $?
1


Expected Results:  
$ glxinfo 
name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
    GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, 
    GLX_EXT_visual_info,.....
....
....
$ echo $?
0


That LLVM-2.8 fails is a guess, i do not have LLVM-2.8 here, but according to the bugreport (http://llvm.org/bugs/show_bug.cgi?id=3287) it should fail.
This is a problem for Gentoo, since 2.8 should become stable soon (http://bugs.gentoo.org/show_bug.cgi?id=336371).

I made this little patch for my own use, maybe something similar is needed for the ebuild/upstream (with additional foo for 2.8):

diff -Nurp Mesa-7.9.1.orig/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp Mesa-7.9.1/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
--- Mesa-7.9.1.orig/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp       2010-12-15 22:50:00.000000000 +0100
+++ Mesa-7.9.1/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp    2011-01-10 21:48:19.000000000 +0100
@@ -153,6 +153,14 @@ lp_set_target_options(void)
     * - http://llvm.org/bugs/show_bug.cgi?id=3287
     * - http://l4.me.uk/post/2009/06/07/llvm-wrinkle-3-configuration-what-configuration/
     */
+#if HAVE_LLVM < 0x0209
+   /*
+    * latest llvm defaults to not emit any MMX, only for intrinsics reqested
+    * by the user.
+    * So the -disable-mmx option was removed.
+    * (It was actually already removed for 2.7, you have to use other magic
+    * to diable MMX there, see the bug URL for PR3287...)
+    */
    static boolean first = TRUE;
    if (first) {
       static const char* options[] = {
@@ -162,6 +170,7 @@ lp_set_target_options(void)
       llvm::cl::ParseCommandLineOptions(2, const_cast<char**>(options));
       first = FALSE;
    }
+#endif
 
    /*
     * By default LLVM adds a signal handler to output a pretty stack trace.

Greetings
Jan
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-01-11 06:41:41 UTC
Already fixed in 492afbce almost a month ago.
Comment 2 Chí-Thanh Christopher Nguyễn gentoo-dev 2011-01-12 00:16:55 UTC
Should be fixed by mesa-7.10, please reopen if it is not.
Comment 3 PaX Team 2011-01-14 01:12:30 UTC
having checked the 7.10 sources, this bug isn't fixed in there, and apps fail the same way (for me it's the X server itself, pretty annoying ;). after manually applying the fix things work fine so i guess gentoo needs this patch for now.
Comment 4 Chí-Thanh Christopher Nguyễn gentoo-dev 2011-01-14 14:53:34 UTC
2.8 doesn't fail
Comment 5 Alex Buell 2011-02-18 23:29:49 UTC
This fix is still not in 7.10-r1, can someone do a rev bump with a patch for that problem?
Comment 6 Jean-Francois Ostiguy 2011-04-17 22:22:34 UTC
I have just been hit by this (rather nasty) bug. My X server just freezes
with a black screen and I have to reboot. Some experimentation
led me to the conclusion that the issue is related to gallium.
Switching to the classic driver (I use the radeon driver) makes
the issue go away.

A search on gallium led me here.

I can reproduce exactly the behavior described in the first post i.e.
if I run glxinfo with gallium enabled i get:

prog: Unknown command line argument '-disable-mmx'. Try 'prog -help'

My llvm was recently updated to 2.9-r1. Mesa/gallium was recompiled
shortly thereafer. I will try the patch and report back ... but 
I am pretty sure it is needed ;-)
Comment 7 Chí-Thanh Christopher Nguyễn gentoo-dev 2011-04-17 22:56:57 UTC
Fixed in CVS.