[Mesa-dev] Mesa + glxPixmaps problems

Ian Molton ian.molton at collabora.co.uk
Thu Aug 26 08:30:55 PDT 2010

Hi folks,

I've been working on some code that makes extensive use of glxPixmaps 
for offscreen rendering, and I've hit a number of problems.

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);

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).

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?



More information about the mesa-dev mailing list