diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java | 70 |
1 files changed, 52 insertions, 18 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java index 7cc2d0f2e..22e2f14b5 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java @@ -51,33 +51,67 @@ public class GLXUtil { throw new IllegalArgumentException("null X11GraphicsDevice display handle"); } boolean glXAvailable = false; + x11Device.lock(); try { glXAvailable = GLX.glXQueryExtension(x11Device.getHandle(), null, 0, null, 0); - } catch (Throwable t) { /* n/a */ } + } catch (Throwable t) { /* n/a */ + } finally { + x11Device.unlock(); + } return glXAvailable; } - public static VersionNumber getGLXServerVersionNumber(long display) { + public static String getGLXClientString(X11GraphicsDevice x11Device, int name) { + x11Device.lock(); + try { + return GLX.glXGetClientString(x11Device.getHandle(), name); + } finally { + x11Device.unlock(); + } + } + public static String queryGLXServerString(X11GraphicsDevice x11Device, int screen_idx, int name) { + x11Device.lock(); + try { + return GLX.glXQueryServerString(x11Device.getHandle(), screen_idx, name); + } finally { + x11Device.unlock(); + } + } + public static String queryGLXExtensionsString(X11GraphicsDevice x11Device, int screen_idx) { + x11Device.lock(); + try { + return GLX.glXQueryExtensionsString(x11Device.getHandle(), screen_idx); + } finally { + x11Device.unlock(); + } + } + + public static VersionNumber getGLXServerVersionNumber(X11GraphicsDevice x11Device) { int[] major = new int[1]; int[] minor = new int[1]; - if (!GLX.glXQueryVersion(display, major, 0, minor, 0)) { - throw new GLException("glXQueryVersion failed"); + x11Device.lock(); + try { + if (!GLX.glXQueryVersion(x11Device.getHandle(), major, 0, minor, 0)) { + throw new GLException("glXQueryVersion failed"); + } + + // Work around bugs in ATI's Linux drivers where they report they + // only implement GLX version 1.2 on the server side + if (major[0] == 1 && minor[0] == 2) { + String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); + try { + // e.g. "1.3" + major[0] = Integer.valueOf(str.substring(0, 1)).intValue(); + minor[0] = Integer.valueOf(str.substring(2, 3)).intValue(); + } catch (Exception e) { + major[0] = 1; + minor[0] = 2; + } + } + } finally { + x11Device.unlock(); } - - // Work around bugs in ATI's Linux drivers where they report they - // only implement GLX version 1.2 on the server side - if (major[0] == 1 && minor[0] == 2) { - String str = GLX.glXGetClientString(display, GLX.GLX_VERSION); - try { - // e.g. "1.3" - major[0] = Integer.valueOf(str.substring(0, 1)).intValue(); - minor[0] = Integer.valueOf(str.substring(2, 3)).intValue(); - } catch (Exception e) { - major[0] = 1; - minor[0] = 2; - } - } return new VersionNumber(major[0], minor[0], 0); } |