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

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?

Thanks,

-Ian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to