summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java33
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java25
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java32
3 files changed, 88 insertions, 2 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
index 715511d1b..7203ba214 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
@@ -81,12 +81,41 @@ public class GLRendererQuirks {
*/
public static final int GLFlushBeforeRelease = 7;
+ //
+ // The JVM for the following system crashes on the second call to glXDestroyContext after
+ // XCloseDisplay has been called once.
+ //
+ // The following will crash the system:
+ // XOpenDisplay(A), glXCreateNewContext(A), XOpenDisplay(B), glXCreateNewContext(B),
+ // glXDestroyContext(A/B), XCloseDisplay(A/B), glXDestroyContext(B/A) (crash)
+ //
+ // Dell Latitude D520
+ // Intel(R) Core(TM)2 CPU T7200
+ // i810 Monitor driver
+ // Platform LINUX / Linux 2.6.18.8-0.3-default (os), i386 (arch), GENERIC_ABI, 2 cores
+ // Platform Java Version: 1.6.0_18, VM: Java HotSpot(TM) Server VM, Runtime: Java(TM) SE Runtime Environment
+ // Platform Java Vendor: Sun Microsystems Inc., http://java.sun.com/, JavaSE: true, Java6: true, AWT enabled: true
+ // GL Profile GLProfile[GL2/GL2.sw]
+ // CTX VERSION 2.1 (Compatibility profile, FBO, software) - 2.1 Mesa 7.8.2
+ // GL jogamp.opengl.gl4.GL4bcImpl@472d48
+ // GL_VENDOR Brian Paul
+ // GL_RENDERER Mesa X11
+ // GL_VERSION 2.1 Mesa 7.8.2
+ //
+ // The error can be reproduced using a C code, thus the error is indpendent of Java and JOGL.
+ // The work around is to close all the X11 displays upon exit for a "Mesa X11" version < 8.
+ // At this moment, it is unknown if the error exists in versions greater than 7.
+ //
+ // Martin C. Hegedus, March 30, 2013
+ //
+ public static final int DontCloseX11DisplayConnection = 8;
+
/** Number of quirks known. */
- public static final int COUNT = 8;
+ public static final int COUNT = 9;
private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval",
"NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard",
- "GLNonCompliant", "GLFlushBeforeRelease"
+ "GLNonCompliant", "GLFlushBeforeRelease", "DontCloseX11DisplayConnection"
};
private final int _bitmask;
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 25bba1725..54ed479a9 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -64,6 +64,11 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+// Added to check if X11 Displays should be closed on exit
+// Martin C. Hegedus, March 30, 2013
+import com.jogamp.opengl.GLRendererQuirks;
+import jogamp.nativewindow.x11.X11Util;
+
/**
* Specifies the the OpenGL profile.
*
@@ -1524,6 +1529,26 @@ public class GLProfile {
final boolean addedEGLProfile = null != defaultEGLDevice ? initProfilesForDevice(defaultEGLDevice) : false;
final boolean addedDesktopProfile = null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false;
final boolean addedAnyProfile = addedEGLProfile || addedDesktopProfile ;
+
+ // Added to check if X11 Displays should be closed on exit
+ // NOTE: This checks defaultEGLDevice and defaultDesktopDevice to determine if XCloseDisplay should be called on exit
+ // NOTE: These checks must be done after initProfilesForDevice since GLContext must set up the renderer quirks.
+ // NOTE: At this point the shared resource has already opened a display, created a new context, made it current, and
+ // released it. Let's cross our fingers that at this point in the code the context will not be destroyed and
+ // the display closed under any circumstances.
+ // NOTE: The checks can be tricked if the default screen is using a driver other than X11 and later a X11 Display,
+ // such as a remote display, is opened. If this occurs then markAllDisplaysUnclosable will not have been
+ // correctly set. Something to deal with at a later date.
+ //
+ // Martin C. Hegedus, March 30, 2013
+ if (eglFactory != null && defaultEGLDevice != null &&
+ eglFactory.hasRendererQuirk(defaultEGLDevice,GLRendererQuirks.DontCloseX11DisplayConnection) &&
+ NativeWindowFactory.getNativeWindowType(true) == NativeWindowFactory.TYPE_X11)
+ X11Util.markAllDisplaysUnclosable();
+ if (desktopFactory != null && defaultDesktopDevice != null &&
+ desktopFactory.hasRendererQuirk(defaultDesktopDevice,GLRendererQuirks.DontCloseX11DisplayConnection) &&
+ NativeWindowFactory.getNativeWindowType(true) == NativeWindowFactory.TYPE_X11)
+ X11Util.markAllDisplaysUnclosable();
if(DEBUG) {
System.err.println("GLProfile.init addedAnyProfile "+addedAnyProfile+" (desktop: "+addedDesktopProfile+", egl "+addedEGLProfile+")");
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 9f7c9cf57..74bc59c7c 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1562,9 +1562,41 @@ public abstract class GLContextImpl extends GLContext {
quirks[i++] = quirk;
}
}
+
+ //
+ // Mesa RENDERER related quirks
+ //
+ if( glRendererLowerCase.contains("mesa") ) {
+ // Added March 30, 2013
+ // Martin C. Hegedus
+ if ( glRendererLowerCase.contains("x11") && getMesaMajorVersion(glVersion) < 8.0 ) {
+ final int quirk = GLRendererQuirks.DontCloseX11DisplayConnection;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Mesa X11 < 8 : Renderer=" + glRenderer + ", Version=" +glVersion);
+ }
+ quirks[i++] = quirk;
+ }
+ }
glRendererQuirks = new GLRendererQuirks(quirks, 0, i);
}
+
+ // Added by Martin C. Hegedus, March 30, 2013
+ private static final int getMesaMajorVersion(String version) {
+ if (version == null || version.length() <= 0) return -1;
+ String[] strings = version.trim().split("\\s+");
+ if (strings.length <= 0) return -1;
+ version = strings[strings.length-1];
+ int index = version.indexOf(".");
+ if (index == 0) return -1;
+ if (index != -1) version = version.substring(0,index);
+ try {
+ Integer iNumber = new Integer(version);
+ return (iNumber == null) ? -1 : iNumber.intValue();
+ } catch (Throwable t) {
+ return -1;
+ }
+ }
private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) {