From 78121938f8b432617bbb9f8e3e259ff1ffa9442e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 26 Nov 2011 18:33:20 +0100 Subject: Revert some changes: X11Screen/RANDR, X11Util (XInitThreads/XLockDisplay), NEWT XDisplay Locking Revert X11Screen RANDR commit 8cecd0c2963d982aa119cbb07698e56b9c271188, ie. use default 'render' display connection, best results on Ubuntu, Solaris, CentOS (no failures). Revert X11Util (XInitThreads/XLockDisplay) rational logic, commit 0314be79a7a93931a74fe4322bc78e699d7741e9, X11Util.HAS_XLOCKDISPLAY_BUG:=true and X11Util.XINITTHREADS_ALWAYS_ENABLED:=true. Which enables always utilizing XInitThreads() either before or after AWT initialization, as well as disable all XLockDisplay/XUnlockDisplay locks. Rever NEWT XDisplay X11 basic Locking commit 50100b85ce5fde48788efbc2211b26fb9d7c9dfd, ie use null locking if X11Util.HAS_XLOCKDISPLAY_BUG and X11Util.XINITTHREADS_ALWAYS_ENABLED. --- .../javax/media/nativewindow/NativeWindowFactory.java | 11 ++++++++--- .../classes/jogamp/nativewindow/x11/X11Util.java | 12 ++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src/nativewindow/classes') diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index adc946f70..9bc8ca9e4 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -195,9 +195,10 @@ public abstract class NativeWindowFactory { final ClassLoader cl = NativeWindowFactory.class.getClassLoader(); - // X11 initialization before possible AWT initialization - initNativeImpl(firstUIActionOnProcess, cl); - + if(firstUIActionOnProcess) { + // X11 initialization before possible AWT initialization + initNativeImpl(true, cl); + } isAWTAvailable = false; // may be set to true below if( !Debug.getBooleanProperty("java.awt.headless", true, acc) && @@ -229,6 +230,10 @@ public abstract class NativeWindowFactory { } } } + if(!firstUIActionOnProcess) { + // X11 initialization after possible AWT initialization + initNativeImpl(false, cl); + } registeredFactories = Collections.synchronizedMap(new HashMap, NativeWindowFactory>()); // register our default factory -> NativeWindow diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 94a47d0f7..bc43a9a97 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -73,8 +73,12 @@ public class X11Util { *

*/ public static final boolean ATI_HAS_XCLOSEDISPLAY_BUG = true; + + /** Value is true, best 'stable' results if always using XInitThreads(). */ + public static final boolean XINITTHREADS_ALWAYS_ENABLED = true; - // public static final boolean HAS_XLOCKDISPLAY_BUG = false; + /** Value is true, best 'stable' results if not using XLockDisplay/XUnlockDisplay at all. */ + public static final boolean HAS_XLOCKDISPLAY_BUG = true; private static final boolean DEBUG = Debug.debug("X11Util"); private static final boolean TRACE_DISPLAY_LIFECYCLE = Debug.getBooleanProperty("nativewindow.debug.X11Util.TraceDisplayLifecycle", true, AccessController.getContext()); @@ -89,15 +93,19 @@ public class X11Util { private static Object setX11ErrorHandlerLock = new Object(); + @SuppressWarnings("unused") public static synchronized void initSingleton(final boolean firstX11ActionOnProcess) { if(!isInit) { NWJNILibLoader.loadNativeWindow("x11"); - isX11LockAvailable = initialize0( firstX11ActionOnProcess ) /* && !HAS_XLOCKDISPLAY_BUG */ ; + final boolean callXInitThreads = XINITTHREADS_ALWAYS_ENABLED || firstX11ActionOnProcess; + final boolean isXInitThreadsOK = initialize0( XINITTHREADS_ALWAYS_ENABLED || firstX11ActionOnProcess ); + isX11LockAvailable = isXInitThreadsOK && !HAS_XLOCKDISPLAY_BUG ; if(DEBUG) { System.err.println("X11Util firstX11ActionOnProcess: "+firstX11ActionOnProcess+ ", requiresX11Lock "+requiresX11Lock+ + ", XInitThreads [called "+callXInitThreads+", OK "+isXInitThreadsOK+"]"+ ", isX11LockAvailable "+isX11LockAvailable); // Thread.dumpStack(); } -- cgit v1.2.3