[Mesa-dev] Mesa + glxPixmaps problems

Michel Dänzer michel at daenzer.net
Fri Aug 27 00:53:36 PDT 2010

On Don, 2010-08-26 at 16:30 +0100, Ian Molton wrote: 
> First, My colleague and I found that the following sequence of events 
> led to a crash:
> context1 = glXCreateNewContext()
> xPixmap = XCreatePixmap ()
> glxPixmap = glXCreatePixmap (dpy, blah, xPixmap, NULL);
> glXMakeCurrent (dpy, glxPixmap, context1);
> context2 = glXCreateNewContext()
> glXDestroyContext(dpy, context2);
> glXMakeCurrent (dpy, glxPixmap, context1);
> **KABOOM**
> It turns out that this is down to a flaw in the garbage collection code, 
> where a test is made to determine if a drawable still exists, and if 
> not, it is dropped from the hashtable (src/glx/glxcmd.c)
> The test is this:
> XGetWindowAttributes(dpy, draw, &xwa); /* dummy request */
> And if an error is caught, it is assumed the drawable is gone, however 
> if draw is a glxPixmap, it appears X does not consider them drawable, 
> and thus the test will ALWAYS return false, resulting in hashtable 
> entries for glxPixmaps being destroyed when they should not.
> Changing this line to:
> XGetWindowAttributes(dpy, pdraw->xDrawable, &xwa); /* dummy request */
> Fixes the problem (by extracting the underlying X drawable from the 
> pdraw struct).

Note that it's XGet*Window*Attributes. This call seems totally
inappropriate for pixmaps and it might be pure luck if it ever does
anything other than fail in that case.

> Sadly, however, it appears that there are many more similar looking bugs 
> in Mesa. Has anyone actually used Mesa to render to glxPixmaps? are 
> there patches available to make this stuff work?

The Mesa demos rendering to GLXPixmaps and gnubg have been working for
me at least basically.

Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer

More information about the mesa-dev mailing list