summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-02 07:28:00 +0200
committerSven Gothel <[email protected]>2012-10-02 07:28:00 +0200
commit7c333e3e2574879465719ed968112b27255368d4 (patch)
treef9c81117469fe10d23c106bb46151a3451169e3f /src/nativewindow/classes/jogamp
parent0790108ca9c2a6a6d494e5017589fe083c518e23 (diff)
Relax Bug 613 workaround of commit 92398025abdabb2fdef0d78edd41e730991a6f94
Utilizing a GlobalToolkitLock in general to lock the display connection results in deadlock situations where locked surfaces signal other [offscreen] surfaces to render. We have to see whether we find a better solution, for now sporadic XCB assertion still happen. But it is preferrable to point to the root cause, then to jumping through hoops to complicate locking or even to deadlock. Locking: - X11GLXGraphicsConfigurationFactory add missing device locking in: - getAvailableCapabilities - chooseGraphicsConfigurationStatic - Newt/X11Window: Discard display events after window close. Relax ATI XCB/threading bug workaround: - ToolkitProperties: requiresGlobalToolkitLock() -> hasThreadingIssues() - NativeWindowFactory: Don't use GlobalToolkitLock in case of 'threadingIssues' the impact is too severe (see above) - NativeWindowFactory: Add getGlobalToolkitLockIfRequired(): To be used for small code blocks. If having 'threadingIssues' a GlobalToolkitLock is returned, otherwise NullToolkitLock. - X11GLXContext: [create/destroy]ContextARBImpl: Use 'NativeWindowFactory.getGlobalToolkitLockIfRequired()' for extra locking Misc Cleanup: - *DrawableFactory createMutableSurface: Also create new device if type is not suitable - *DrawableFactory createDummySurfaceImpl: Pass chosenCaps and use it (preserves orig. requested user caps)
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java13
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java5
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java8
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java3
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java10
7 files changed, 17 insertions, 26 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
index 0c2a1e43f..c9f830811 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
@@ -36,16 +36,19 @@ import com.jogamp.common.util.locks.RecursiveLock;
/**
* Implementing a global recursive {@link javax.media.nativewindow.ToolkitLock}.
* <p>
- * This is the last resort for unstable driver, e.g. proprietary ATI/X11 12.8 and 12.9,
- * where multiple X11 display connections to the same connection name are not treated
- * thread safe within the GL/X11 driver.
+ * This is the last resort for unstable driver where multiple X11 display connections
+ * to the same connection name are not treated thread safe within the GL/X11 driver.
* </p>
*/
public class GlobalToolkitLock implements ToolkitLock {
private static final RecursiveLock globalLock = LockFactory.createRecursiveLock();
+ private static GlobalToolkitLock singleton = new GlobalToolkitLock();
- /** Singleton via {@link NativeWindowFactoryImpl#getGlobalToolkitLock()} */
- protected GlobalToolkitLock() { }
+ public static final GlobalToolkitLock getSingleton() {
+ return singleton;
+ }
+
+ private GlobalToolkitLock() { }
@Override
public final void lock() {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
index c35cede77..a3a66b7f1 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
@@ -44,16 +44,11 @@ import com.jogamp.common.util.ReflectionUtil.AWTNames;
public class NativeWindowFactoryImpl extends NativeWindowFactory {
private static final ToolkitLock nullToolkitLock = new NullToolkitLock();
- private static final ToolkitLock globalToolkitLock = new GlobalToolkitLock();
public static ToolkitLock getNullToolkitLock() {
return nullToolkitLock;
}
- public static ToolkitLock getGlobalToolkitLock() {
- return globalToolkitLock;
- }
-
// This subclass of NativeWindowFactory handles the case of
// NativeWindows being passed in
protected NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
index 2062d1f58..ed23def8f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
@@ -13,15 +13,11 @@ import javax.media.nativewindow.NativeWindowFactory;
public static boolean requiresToolkitLock() {}
- public static boolean requiresGlobalToolkitLock() {}
+ public static boolean hasThreadingIssues() {}
* </pre>
* Above static methods are invoked by {@link NativeWindowFactory#initSingleton()},
* or {@link NativeWindowFactory#shutdown()} via reflection.
* </p>
- * <p>
- * If <code>requiresGlobalToolkitLock() == true</code>, then
- * <code>requiresToolkitLock() == true</code> shall be valid as well.
- * </p>
*/
public interface ToolkitProperties {
@@ -46,6 +42,6 @@ public interface ToolkitProperties {
/**
* Called by {@link NativeWindowFactory#initSingleton()}
*/
- // boolean requiresGlobalToolkitLock();
+ // boolean hasThreadingIssues();
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
index 67c64a95c..349da8ee6 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
@@ -237,18 +237,15 @@ public class JAWTUtil {
jawtToolkitLock = new ToolkitLock() {
public final void lock() {
- NativeWindowFactory.getGlobalToolkitLock().lock();
JAWTUtil.lockToolkit();
if(TRACE_LOCK) { System.err.println("JAWTToolkitLock.lock()"); }
}
public final void unlock() {
if(TRACE_LOCK) { System.err.println("JAWTToolkitLock.unlock()"); }
JAWTUtil.unlockToolkit();
- NativeWindowFactory.getGlobalToolkitLock().unlock();
}
@Override
public final void validateLocked() throws RuntimeException {
- NativeWindowFactory.getGlobalToolkitLock().validateLocked();
JAWTUtil.validateLocked();
}
public final void dispose() {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index 481cbbe39..a195f137e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -76,7 +76,7 @@ public class OSXUtil implements ToolkitProperties {
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
- public static final boolean requiresGlobalToolkitLock() { return false; }
+ public static final boolean hasThreadingIssues() { return false; }
public static boolean isNSView(long object) {
return isNSView0(object);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
index 4408a0903..2f4e18359 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
@@ -84,7 +84,7 @@ public class GDIUtil implements ToolkitProperties {
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
- public static final boolean requiresGlobalToolkitLock() { return false; }
+ public static final boolean hasThreadingIssues() { return false; }
private static RegisteredClass dummyWindowClass = null;
private static Object dummyWindowSync = new Object();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index 103995a8d..c771cd67a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -95,7 +95,7 @@ public class X11Util implements ToolkitProperties {
private static String nullDisplayName = null;
private static volatile boolean isInit = false;
private static boolean markAllDisplaysUnclosable = false; // ATI/AMD X11 driver issues
- private static boolean requiresGlobalToolkitLock = false; // ATI/AMD X11 driver issues
+ private static boolean hasThreadingIssues = false; // ATI/AMD X11 driver issues
private static Object setX11ErrorHandlerLock = new Object();
private static final String X11_EXTENSION_ATIFGLRXDRI = "ATIFGLRXDRI";
@@ -137,7 +137,7 @@ public class X11Util implements ToolkitProperties {
hasX11_EXTENSION_ATIFGLRXDRI = false;
hasX11_EXTENSION_ATIFGLEXTENSION = false;
}
- requiresGlobalToolkitLock = ATI_HAS_MULTITHREADING_BUG && ( hasX11_EXTENSION_ATIFGLRXDRI || hasX11_EXTENSION_ATIFGLEXTENSION );
+ hasThreadingIssues = ATI_HAS_MULTITHREADING_BUG && ( hasX11_EXTENSION_ATIFGLRXDRI || hasX11_EXTENSION_ATIFGLEXTENSION );
markAllDisplaysUnclosable = ATI_HAS_XCLOSEDISPLAY_BUG && ( hasX11_EXTENSION_ATIFGLRXDRI || hasX11_EXTENSION_ATIFGLEXTENSION );
if(DEBUG) {
@@ -147,7 +147,7 @@ public class X11Util implements ToolkitProperties {
",\n\t X11_EXTENSION_ATIFGLRXDRI " + hasX11_EXTENSION_ATIFGLRXDRI+
",\n\t X11_EXTENSION_ATIFGLEXTENSION " + hasX11_EXTENSION_ATIFGLEXTENSION+
",\n\t requiresToolkitLock "+requiresToolkitLock()+
- ",\n\t requiresGlobalToolkitLock "+requiresGlobalToolkitLock()+
+ ",\n\t hasThreadingIssues "+hasThreadingIssues()+
",\n\t markAllDisplaysUnclosable "+getMarkAllDisplaysUnclosable()
);
// Thread.dumpStack();
@@ -228,8 +228,8 @@ public class X11Util implements ToolkitProperties {
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
- public static final boolean requiresGlobalToolkitLock() {
- return requiresGlobalToolkitLock; // JAWT locking: yes, instead of native X11 locking w use a global lock.
+ public static final boolean hasThreadingIssues() {
+ return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere"
}
public static void setX11ErrorHandler(boolean onoff, boolean quiet) {