Errors creating pbuffers with MESA + Xvfb

Wondering if anyone has some ideas on other workarounds for the system. The code is currently failing with the infamous glXFBConfig failure error message on the combination of MESA and Xvfb. Prior to attempting to create the pbuffer I check with canCreateGLPbuffer, but the actual creation fails.

Some relevant details:

GLCapabilities [DoubleBuffered: false, Stereo: false, HardwareAccelerated: true, DepthBits: 16, StencilBits: 0, Red: 8, Green: 8, Blue: 8, Alpha: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false ]

Exception in thread "main" javax.media.opengl.GLException: javax.media.opengl.GLException: pbuffer creation error: glXChooseFBConfig() failed
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.maybeDoSingleThreadedWorkaround(X11GLDrawableFactory.java:652)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.createGLPbuffer(X11GLDrawableFactory.java:313)
        at org.j3d.aviatrix3d.output.graphics.PbufferSurface.init(PbufferSurface.java:237)
        at org.j3d.aviatrix3d.output.graphics.PbufferSurface.<init>(PbufferSurface.java:154)
        at org.j3d.aviatrix3d.output.graphics.PbufferSurface.<init>(PbufferSurface.java:72)
        at org.xj3d.ui.awt.browser.ogl.OffscreenOGLConstruct.buildGraphicsRenderingDevice(OffscreenOGLConstruct.java:64)
        at org.xj3d.ui.construct.Construct.buildRenderingDevices(Construct.java:387)
        at xj3d.replica.OffscreenSceneRecorderConstruct.buildAll(OffscreenSceneRecorderConstruct.java:62)
        at xj3d.replica.SceneRecorder.<init>(SceneRecorder.java:224)
        at xj3d.replica.SceneRecorder.main(SceneRecorder.java:605)
Caused by: javax.media.opengl.GLException: pbuffer creation error: glXChooseFBConfig() failed
        at com.sun.opengl.impl.x11.X11PbufferGLDrawable.createPbuffer(X11PbufferGLDrawable.java:126)
        at com.sun.opengl.impl.x11.X11PbufferGLDrawable.<init>(X11PbufferGLDrawable.java:73)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory$2.run(X11GLDrawableFactory.java:306)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)

System is Fedora Core 6 with all the latest updates applied.

MESA 6.5.1
Xvfb

Commandline for running Xvfb is


Xvfb :1 -screen 0 1280x1024x24

Daily build of JOGL as of last night (21/7).

I’d like to try out MESA 7.0, but don’t have any prebuilt binaries for FC6 to try out, so that’s my next plan of attack. Note that this is on a server that doesn’t have any form of graphics hardware in it, hence the virtual framebuffer and MESA for JOGL. I cannot run JOGL headless due to other internal JOGL errors and the latest JDK 1.6 u2 JAWT libraries, so this is about all I have to work on for now.

Well, we have some resolution to the problem. It took a while to fix. I’ve already been chatting with Ken about this, so this reply is for infomration purposes only for those that also may come across the same problem.

JOGL is triggering a bug in the current releases of MESA. For pbuffers, JOGL would explicitly set the GLX_STEREO flag to GL_FALSE, which is the default value. This would cause MESA to fail and return no matching configs. If you did not pass in the GLX_STEREO flag and let MESA use the default (which is also GL_FALSE) then MESA would correctly return a matching FBConfig. I have posted a bug report to the MESA developers and a fix is already in their codebase and the bug report closed here:

https://bugs.freedesktop.org/show_bug.cgi?id=11705

Note that this will effect every MESA user up to and including development to this date. Both 6.5.1 and 7.0 are effected by this bug.

Of course, this doesn’t help those of us that are using the default installs of MESA and are not running from the current GIT version of the code. I am also sending a patch to Ken to remove explicit setting of the default value, which triggers the MESA bug.

A separate and somewhat related bug was that internally JOGL was not correctly fetching the right screen identifier. In several places in the codebase it was using a hard-coded screen ID of 0. This would also cause the GLX methods to fail when you were not using the default display. Instead the code needed to make calls to DefaultScreen(display) and use that returned integer value. A patch for that is also being sent.

Several other bugs relating to timing of JAWT calls were also found in headless mode and ken is working on fixes for those.

With these all in place, you should be able to run JOGL under AWT headless mode with just raw pbuffers, using Xvfb and MESA.

Justin’s suggested fixes as well as the ones to allow the X11GLDrawableFactory to run in pure headless mode have been incorporated and will show up in tonight’s nightly build. Thanks Justin for tracking down the Mesa issues and figuring out workarounds.

Howdy,

We’re attempting to use the GLPBuffer in a similar situation, but we’re running into exceptions with the canCreateGLPBuffer() method. We’re using JOGL v1.1.1 (May 22, 2008 release), running Ubuntu 8.04.1 on x86_64 with Mesa version 7.0.3 (~rc2) and Xvfb.

It may be related to the “hard coded display id” issue mentioned previously, since the call to GLX.XOpenDisplay() apparently returns 0.
Referring to the source here (may not be the correct version):
http://libjogl-java.sourcearchive.com/documentation/1.1.1plus-pdak1-3/X11GLDrawableFactory_8java-source.html

javax.media.opengl.GLException: javax.media.opengl.GLException: Unable to open default display, needed for visual selection and offscreen surface handling
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.maybeDoSingleThreadedWorkaround(X11GLDrawableFactory.java:669)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.canCreateGLPbuffer(X11GLDrawableFactory.java:295)

If we attempt to create the PBuffer without checking, we then run into this exception:

javax.media.opengl.GLException: javax.media.opengl.GLException: pbuffer creation error: glXChooseFBConfig() failed
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.maybeDoSingleThreadedWorkaround(X11GLDrawableFactory.java:669)
        at com.sun.opengl.impl.x11.X11GLDrawableFactory.createGLPbuffer(X11GLDrawableFactory.java:318)

Oddly, we’re able to use this same configuration to render a GLCanvas-based application by setting the display to a remote machine.

Any thoughts on how to resolve this issue? Perhaps upgrading Mesa to 7.3?

Thanks in advance for any help or pointers

Matt