Simple GLX test program crashes

Bug #114502 reported by Elias Naur
4
Affects Status Importance Assigned to Milestone
mesa (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Here's a simple program that crashes on my Ubuntu 7.04[1] - compile and run with "gcc -Wall -g test.c -lX11 -lGL && ./a.out".
GDB tells me it crashes in the second glXQueryVersion[2]. Removing the first XCloseDisplay "fixes" the crash, indicating that GLX gets confused when a second Display is opened at the same address as the first. OpenGL is working fine for me doing much more complicated things (games), so this seems like a simple overlooked case in the GLX core or in the radeon driver.

Relevant configuration is:
Ubuntu 7.04
Pentium M 1700 Mhz
Radeon 9700 mobile
I'm using the "radeon" open source driver, _not_ the ATI provided fglrx driver.

Excerpts from glxinfo:
direct rendering: Yes
OpenGL vendor string: Tungsten Graphics, Inc.
OpenGL renderer string: Mesa DRI R300 20060815 AGP 4x x86/MMX/SSE2 TCL
OpenGL version string: 1.3 Mesa 6.5.2

[1]
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/glx.h>
#include <stdio.h>

int main(int nargs, char **vargs) {
    int major, minor;
    Display *disp = XOpenDisplay(NULL);
    glXQueryVersion(disp, &major, &minor);
    fprintf(stderr, "%p: %d.%d\n", disp, major, minor);
    XCloseDisplay(disp);
    disp = XOpenDisplay(NULL);
    glXQueryVersion(disp, &major, &minor);
    fprintf(stderr, "%p: %d.%d\n", disp, major, minor);
    XCloseDisplay(disp);
    return 0;
}

[2]:
elias@elias-laptop:~/glxcrash$ gdb ./a.out
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) run
Starting program: /media/hda6/storage/glxcrash/a.out
[Thread debugging using libthread_db enabled]
[New Thread -1212192560 (LWP 19851)]
0x804a008: 1.2

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212192560 (LWP 19851)]
0xb7a11940 in ?? ()
(gdb) bt
#0 0xb7a11940 in ?? ()
#1 0xb7dc1ab1 in __glXInitialize () from /usr/lib/libGL.so.1
#2 0xb7dbda1d in glXQueryVersion () from /usr/lib/libGL.so.1
#3 0x080485db in main () at test.c:14

Revision history for this message
Elias Naur (elias-naur) wrote :

I managed to fetch and build a current version of Mesa directly from the git repository. Using LD_PRELOAD to preload the new libGL.so.1, I can no longer reproduce the bug.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Ok, I'll assume this has been fixed in 7.10.

Changed in mesa:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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