GLXPixmap and radeon driver
Glynn Clements
glynn at gclements.plus.com
Sat Mar 29 05:00:59 PDT 2008
I have the following code, which tries to set up OpenGL rendering to a
GLXPixmap:
static Display *dpy;
static int scr;
static GLXContext ctx;
#ifdef HAVE_PIXMAPS
Pixmap pixmap;
static GLXPixmap glxpixmap;
#endif
...
static void create_pixmap(int width, int height)
{
#ifdef HAVE_PIXMAPS
static int att[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
None
};
XVisualInfo *vi;
if (getenv("GRASS_NO_GLX_PIXMAPS"))
return;
fprintf(stderr, "Create PixMap Using GLX 1.1\n");
vi = glXChooseVisual(dpy, scr, att);
if (!vi) {
fprintf(stderr, "Unable to get Visual\n");
return;
}
ctx = glXCreateContext(dpy, vi, NULL, GL_FALSE);
if (!ctx) {
fprintf(stderr, "Unable to create context\n");
return;
}
pixmap = XCreatePixmap(dpy, RootWindow(dpy, vi->screen),
width, height, vi->depth);
if (!pixmap) {
fprintf(stderr, "Unable to create pixmap\n");
return;
}
glxpixmap = glXCreateGLXPixmap(dpy, vi, pixmap);
if (!glxpixmap) {
fprintf(stderr, "Unable to create GLX pixmap\n");
return;
}
if (!glXMakeCurrent(dpy, glxpixmap, ctx)) {
fprintf(stderr, "Unable to use context\n");
glXDestroyGLXPixmap(dpy, glxpixmap);
glxpixmap = None;
return;
}
#endif
}
It isn't essential that the code succeeds. If glxpixmap is None, a
fall-back will be used.
The code works fine with the nv and nvidia drivers, and with Cygwin's
XWin.exe.
However, I'm getting a report that with the following setup:
Debian testing x86, X.Org 7.2, Mesa 7.0.3 rc2, "radeon" driver 6.6.3, Ati
Radeon Mobility X700, GRASS SVN r30759.
the glXMakeCurrent() call generates a GLXBadContext error then
terminates the program.
So:
1. Is the code doing something wrong?
2. Is there anything which it can do to determine that it can't use a
GLXPixmap (without terminating the program)?
3. Is this a known issue which has since been fixed in a later version
of the driver (or some other part of X)?
FWIW:
Bug report:
http://trac.osgeo.org/grass/ticket/104#comment:6
Source code:
http://trac.osgeo.org/grass/browser/grass/trunk/visualization/nviz/src/do_zoom.c
--
Glynn Clements <glynn at gclements.plus.com>
More information about the xorg
mailing list