diff options
author | Sven Gothel <[email protected]> | 2011-08-31 15:33:22 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-08-31 15:33:22 +0200 |
commit | b54497155815852744adb657816cb4057948dae2 (patch) | |
tree | e55f600951148661e8ad7611b5766581e3a18c17 /src | |
parent | c75785dcc4758b3d865c5ccf6677389ab112d2fb (diff) |
Workaround for X11/ATI fglrx bug 515 - Multiple Display Connections
https://jogamp.org/bugzilla/show_bug.cgi?id=515
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java | 4 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java | 28 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 39bcd2f37..d2c555a1c 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -177,6 +177,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { sharedDevice.lock(); try { String glXVendorName = GLXUtil.getVendorName(sharedDevice.getHandle()); + if(X11Util.ATI_HAS_XCLOSEDISPLAY_BUG && GLXUtil.isVendorATI(glXVendorName)) { + X11Util.setMarkAllDisplaysUnclosable(true); + X11Util.markDisplayUncloseable(sharedDevice.getHandle()); + } X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, 0); if (null == sharedScreen) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 28d75ea06..0964dbeb0 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -51,6 +51,21 @@ import javax.media.nativewindow.util.Point; * Contains a thread safe X11 utility to retrieve display connections. */ public class X11Util { + /** + * See Bug 515 - https://jogamp.org/bugzilla/show_bug.cgi?id=515 + * + * It is observed that ATI X11 drivers, eg. fglrx 8.78.6 and fglrx 11.08/8.881, + * are quite sensitive to multiple Display connections. + * Here, closing displays shall happen in the same order as + * they were opened, -OR- shall not be closed at all! + * Otherwise some driver related bug appears and brings down the JVM. + * You may test this, ie just reverse the destroy order below. + * See also native test: jogl/test/native/displayMultiple02.c + * + * Our current 'workaround' is to not close them at all if driver vendor is ATI. + */ + public static final boolean ATI_HAS_XCLOSEDISPLAY_BUG = true; + public static final boolean XINITTHREADS_ALWAYS_ENABLED = true; private static final boolean DEBUG = Debug.debug("X11Util"); @@ -59,6 +74,7 @@ public class X11Util { private static volatile String nullDisplayName = null; private static boolean requiresX11Lock = false; private static boolean isInit = false; + private static boolean markAllDisplaysUnclosable = false; // ATI/AMD X11 driver issues private static int setX11ErrorHandlerRecCount = 0; private static Object setX11ErrorHandlerLock = new Object(); @@ -143,7 +159,14 @@ public class X11Util { } return nullDisplayName; } - + + public static boolean getMarkAllDisplaysUnclosable() { + return markAllDisplaysUnclosable; + } + public static void setMarkAllDisplaysUnclosable(boolean v) { + markAllDisplaysUnclosable = v; + } + private X11Util() {} // not exactly thread safe, but good enough for our purpose, @@ -320,6 +343,9 @@ public class X11Util { openDisplayList.add(namedDpy); pendingDisplayList.add(namedDpy); } + if(markAllDisplaysUnclosable) { + namedDpy.setUncloseable(true); + } if(DEBUG) { Exception e = new Exception("X11Util.Display: Created new "+namedDpy+". Thread "+Thread.currentThread().getName()); e.printStackTrace(); |