aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-24 19:33:24 +0100
committerSven Gothel <[email protected]>2014-01-24 19:33:24 +0100
commitf1af72e1d93e8b928409c7bd8da0acb2b41cd345 (patch)
tree824b8b09227ef22d39a728d3dcbc1906c39a8f3a
parentbf99c8637f94695a802ff80eb4f630e7c4a4f136 (diff)
Bug 948 - Autodetect GLRendererQuirks.SingletonEGLDisplayOnly
Refines commit fbe00e6f5dca8043b40dd96f096fecc9424e0cc3 Instead of querying driver artifacts (vendor, platform, version ..) we simply can autodetect this quirk by trying to get a second egl-display handle when initializing the EGLDrawablFactory's default device: EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY)
-rw-r--r--make/scripts/tests.sh2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java23
4 files changed, 24 insertions, 25 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 1b93ff7ae..14a5548a8 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -174,7 +174,7 @@ function jrun() {
#D_ARGS="-Dnativewindow.debug.X11Util -Dnativewindow.debug.X11Util.XSync"
#D_ARGS="-Dnativewindow.debug.X11Util.XSync -Dnativewindow.debug.X11Util.TraceDisplayLifecycle"
#D_ARGS="-Dnativewindow.debug.X11Util.XSync -Dnewt.debug.Window"
- #D_ARGS="-Djogl.debug.GLDrawable -Djogl.debug.GLContext"
+ D_ARGS="-Djogl.debug.GLDrawable -Djogl.debug.GLContext"
#D_ARGS="-Dnativewindow.debug.NativeWindow -Dnativewindow.debug.X11Util"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=3000 -Djogamp.debug.Lock -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=3000 -Djogamp.debug.Lock -Dnativewindow.debug.ToolkitLock.TraceLock"
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
index 57c5446f1..a643d81a9 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
@@ -272,15 +272,19 @@ public class GLRendererQuirks {
* <p>
* Reusing global EGL display works.
* </p>
+ * <p>
+ * The quirk is autodetected within EGLDrawableFactory's initial default device setup!
+ * </p>
+ * <p>
+ * Appears on:
* <ul>
* <li>EGL_VENDOR NVIDIA</li>
* <li>EGL_VERSION 1.4</li>
* <li>GL_VENDOR NVIDIA Corporation</li>
+ * <li>GL_VERSION OpenGL ES 3.0 331.38 (probably w/ 1st NV EGL lib on x86)</li>
* <li>Platform X11</li>
* <li>CPU Family {@link Platform.CPUFamily#X86}</li>
* </ul>
- * <p>
- * FIXME: Constrain driver version.
* </p>
*/
public static final int SingletonEGLDisplayOnly = 16;
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 652fc6ba9..431bba6de 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1706,22 +1706,6 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
- if( isX11 && isDriverNVIDIAGeForce && Platform.CPUFamily.X86 == Platform.getCPUFamily() ) {
- final int quirk = GLRendererQuirks.SingletonEGLDisplayOnly;
- if(DEBUG) {
- System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: ES, X11, CPUFamily AMD/Intel, [Vendor "+glVendor+" or Renderer "+glRenderer+"]");
- }
- quirks[i++] = quirk;
- if( withinGLVersionsMapping ) {
- // Thread safe due to single threaded initialization!
- GLRendererQuirks.addStickyDeviceQuirks(adevice, quirks, i-1, 1);
- } else {
- // FIXME: Remove when moving EGL/ES to ARB ctx creation
- synchronized(GLContextImpl.class) {
- GLRendererQuirks.addStickyDeviceQuirks(adevice, quirks, i-1, 1);
- }
- }
- }
}
//
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 65ce98e07..9ee0134f1 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -389,7 +389,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
final GLProfile glp = GLProfile.get(adevice, profileString) ;
final GLDrawableFactoryImpl desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getDesktopFactory();
- final boolean mapsADeviceToDefaultDevice = !QUERY_EGL_ES_NATIVE_TK || null == desktopFactory || adevice instanceof EGLGraphicsDevice ;
+ final boolean initDefaultDevice = 0 == defaultDevice.getHandle(); // Note: GLProfile always triggers EGL device initialization first!
+ final boolean mapsADeviceToDefaultDevice = !QUERY_EGL_ES_NATIVE_TK || initDefaultDevice ||
+ null == desktopFactory || adevice instanceof EGLGraphicsDevice ;
if( DEBUG ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" ( "+esProfile+" ), "+
"defaultSharedResourceSet "+(null!=defaultSharedResource)+", mapsADeviceToDefaultDevice "+mapsADeviceToDefaultDevice+
@@ -410,7 +412,20 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if( mapsADeviceToDefaultDevice ) {
// In this branch, any non EGL device is mapped to EGL default shared resources (default behavior).
// Only one default shared resource instance is ever be created.
- defaultDevice.open();
+ if( initDefaultDevice ) {
+ defaultDevice.open();
+
+ // Probe for GLRendererQuirks.SingletonEGLDisplayOnly
+ final long secondEGLDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
+ if ( EGL.EGL_NO_DISPLAY == secondEGLDisplay ) {
+ final int[] quirks = { GLRendererQuirks.SingletonEGLDisplayOnly };
+ GLRendererQuirks.addStickyDeviceQuirks(adevice, quirks, 0, 1);
+ EGLDisplayUtil.setSingletonEGLDisplayOnly(true);
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirks[0])+": cause: Second eglGetDisplay(EGL_DEFAULT_DISPLAY) failed");
+ }
+ }
+ }
if( DEBUG ) {
dumpEGLInfo("EGLDrawableFactory.mapAvailableEGLESConfig: ", defaultDevice.getHandle());
}
@@ -547,10 +562,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
}
- if( null != rendererQuirks[0] && rendererQuirks[0].exist(GLRendererQuirks.SingletonEGLDisplayOnly) ) {
- EGLDisplayUtil.setSingletonEGLDisplayOnly(true);
- }
-
return success;
}