aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-03-27 12:27:57 +0100
committerSven Gothel <[email protected]>2013-03-27 12:27:57 +0100
commit9a4fcc7ea4ec61e4ceed791acced734ac04ea270 (patch)
tree257383c6954b5decb19f9fd0f9a27a24ca865dc1 /src/jogl
parent83e9b0ce577e1a78eda20800f86cadcf90905141 (diff)
SharedRessourceRunner: Add isDeviceSupported(..) query before spawn off thread, allowing a more gracefull detection of n/a GLX on X11
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/SharedResourceRunner.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java16
3 files changed, 31 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
index a33e03a1a..7e050c81e 100644
--- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
+++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
@@ -46,6 +46,12 @@ public class SharedResourceRunner implements Runnable {
public static interface Implementation {
/**
* @param connection for creation a {@link AbstractGraphicsDevice} instance.
+ * @return <code>true</code> if the device supports all protocols required for the implementation, otherwise <code>false</code>.
+ */
+ boolean isDeviceSupported(String connection);
+
+ /**
+ * @param connection for creation a {@link AbstractGraphicsDevice} instance.
* @return A new shared resource instance
*/
Resource createSharedResource(String connection);
@@ -157,8 +163,10 @@ public class SharedResourceRunner implements Runnable {
if (DEBUG) {
System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+Thread.currentThread().getName());
}
- doAndWait(connection, null);
- sr = impl.mapGet(connection);
+ if ( impl.isDeviceSupported(connection) ) {
+ doAndWait(connection, null);
+ sr = impl.mapGet(connection);
+ }
if (DEBUG) {
System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+Thread.currentThread().getName());
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index c6bc61a27..9c96f3e3c 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -309,6 +309,11 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
+ public boolean isDeviceSupported(String connection) {
+ return true;
+ }
+
+ @Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT);
sharedDevice.lock();
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index e38aabef8..8d1717e75 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -228,6 +228,22 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
+ public boolean isDeviceSupported(String connection) {
+ final boolean res;
+ final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
+ x11Device.lock();
+ try {
+ res = GLXUtil.isGLXAvailableOnServer(x11Device);
+ } finally {
+ x11Device.unlock();
+ }
+ if(DEBUG) {
+ System.err.println("GLX "+(res ? "is" : "not")+" available on device/server: "+x11Device);
+ }
+ return res;
+ }
+
+ @Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
sharedDevice.lock();