Dave,
This is a problem that popped up on our testing with Fedora 15 and
swrast_dri.so, but I believe it can happen with any /usr/lib/dri/*_dri.so , and
will like happen with any other distro that tries to dynamically link DRI
drivers against LLVM 2.8. Which is why I'm bring it up here instead of a bug
report.
The issue is that the *_dri.so are linking against a shared LLVM library. When
XCloseDisplay is called, the *_dri.so to be unloaded, but misteriously
/usr/lib/dri/libllvmcore-2.8.so is not. A later attempt to use GL will cause
prog: for the -disable-mmx option: may only occur zero or one times!
Attached is a simple test program that illustrate this.
I believe the best alternative here is to build *_dri.so with -z nodelete when
linking against a shared libLLVM*.
Other alternatives are:
- build *_dri.so with statically linked LLVM
- get LLVM to unload (but I think it's a loosing battle, because it really
relies on , it can install signal handlers in some cases, and it will likely
cause leaks)
Jose
// Compile as:
//
// gcc -g3 -o bug bug.c -lX11 -lGL
//
// Run as
//
// ./bug
//
// It will fail with
//
// prog: for the -disable-mmx option: may only occur zero or one times!
//
// with DRI drivers with LLVM support on Fedora 15.
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glx.h>
// Straightforward function to check whether GLX direct rendering is supported
// or not
static Bool
isDirectRendering(void)
{
Display *dpy;
GLXContext ctx;
GLXFBConfig *configs;
GLXFBConfig config;
int attribList [] = {GLX_DRAWABLE_TYPE, GLX_USE_GL, GLX_RENDER_TYPE, GLX_USE_GL, GLX_DOUBLEBUFFER, 0};
int nitems = 0;
int i;
Bool ret;
dpy = XOpenDisplay(NULL);
configs = glXChooseFBConfig(dpy, 0, attribList, &nitems);
config = configs[0];
ctx = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, True);
ret = glXIsDirect(dpy, ctx);
glXDestroyContext(dpy, ctx);
// This call will cause /usr/lib/dri/swrast_dri.so to be dlclosed and
// unloaded. But it will not cause /usr/lib/dri/libllvmcore-2.8.so to
// be unloaded, causing problems later on.
//
// The reason libllvmcore-2.8 is not unloaded is not clear yet. Doing
// "readelf --dynamic /usr/lib/dri/libllvmcore-2.8.so" shows no
// no_delete flag.
//
// Solution is either to ensure /usr/lib/dri/libllvmcore-2.8.so is also
// unloaded, or prevent /usr/lib/dri/swrast_dri.so from being unloaded.
// The latter is more robust.
XCloseDisplay(dpy);
return ret;
}
int main(int argc, char **argv) {
// First call runs fine.
isDirectRendering();
// 2nd run will cause LLVM to abort with "prog: for the -disable-mmx
// option: may only occur zero or one times!"
isDirectRendering();
return 0;
}
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev