From fbe00e6f5dca8043b40dd96f096fecc9424e0cc3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 24 Jan 2014 05:16:05 +0100 Subject: Bug 948 - NVIDIA 331.38 (Linux X11) EGL impl. only supports _one_ EGL Display via eglGetDisplay(..) NVIDIA 331.38 (Linux X11) EGL impl. only supports _one_ EGL Display via eglGetDisplay. - Subsequent eglGetDisplay(..) calls fail. - Using the same 'global' egl-display does work though Remedy: Add 'GLRendererQuirks.SingletonEGLDisplayOnly' Detection of quirk is done as usual in GLContextImpl.setRendererQuirks(..), and EGLDrawableFactory passes the quirk, if detected, down to EGLDisplayUtil. The latter implements the singleton eglDisplay handle. EGLDisplayUtil: Cleaned up .. - EGLDisplayRef employs the reference handling incl. eglInitialize(..) and eglTerminate(), as well as the new singleton quirk. - Mark all internal methods 'private', to remove possible [untested] sideffects. --- .../com/jogamp/opengl/GLRendererQuirks.java | 51 ++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index daa0d94dd..0ac0c0f03 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -31,6 +31,8 @@ import java.util.IdentityHashMap; import javax.media.nativewindow.AbstractGraphicsDevice; +import com.jogamp.common.os.Platform; + import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLExt; @@ -70,7 +72,13 @@ public class GLRendererQuirks { /** SIGSEGV on setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel) */ public static final int NoSetSwapIntervalPostRetarget = 4; - /** GLSL discard command leads to undefined behavior or won't get compiled if being used. Appears to have happened on Nvidia Tegra2, but seems to be fine now. FIXME: Constrain version. */ + /** + * GLSL discard command leads to undefined behavior or won't get compiled if being used. + *

+ * Appears to have happened on Nvidia Tegra2, but seems to be fine now.
+ * FIXME: Constrain version. + *

+ */ public static final int GLSLBuggyDiscard = 5; /** @@ -256,15 +264,36 @@ public class GLRendererQuirks { */ public static final int GLES3ViaEGLES2Config = 15; + /** + * Bug 948 - NVIDIA 331.38 (Linux X11) EGL impl. only supports _one_ EGL Device via {@link EGL#eglGetDisplay(long)}. + *

+ * Subsequent calls to {@link EGL#eglGetDisplay(long)} fail. + *

+ *

+ * Reusing global EGL display works. + *

+ * + *

+ * FIXME: Constrain driver version. + *

+ */ + public static final int SingletonEGLDisplayOnly = 16; + /** Number of quirks known. */ - public static final int COUNT = 16; + public static final int COUNT = 17; private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval", "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard", "GLNonCompliant", "GLFlushBeforeRelease", "DontCloseX11Display", "NeedCurrCtx4ARBPixFmtQueries", "NeedCurrCtx4ARBCreateContext", "NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request", - "GLSharedContextBuggy", "GLES3ViaEGLES2Config" + "GLSharedContextBuggy", "GLES3ViaEGLES2Config", "SingletonEGLDisplayOnly" }; private static final IdentityHashMap stickyDeviceQuirks = new IdentityHashMap(); @@ -272,8 +301,12 @@ public class GLRendererQuirks { /** * Retrieval of sticky {@link AbstractGraphicsDevice}'s {@link GLRendererQuirks}. *

+ * The {@link AbstractGraphicsDevice}s are mapped via their {@link AbstractGraphicsDevice#getUniqueID()}. + *

+ *

* Not thread safe. *

+ * @see #areSameStickyDevice(AbstractGraphicsDevice, AbstractGraphicsDevice) */ public static GLRendererQuirks getStickyDeviceQuirks(AbstractGraphicsDevice device) { final String key = device.getUniqueID(); @@ -288,11 +321,20 @@ public class GLRendererQuirks { return res; } + /** + * Returns true if both devices have the same {@link AbstractGraphicsDevice#getUniqueID()}, + * otherwise false. + */ + public static boolean areSameStickyDevice(AbstractGraphicsDevice device1, AbstractGraphicsDevice device2) { + return device1.getUniqueID() == device2.getUniqueID(); + } + /** * {@link #addQuirks(int[], int, int) Adding given quirks} of sticky {@link AbstractGraphicsDevice}'s {@link GLRendererQuirks}. *

* Not thread safe. *

+ * @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ public static void addStickyDeviceQuirks(AbstractGraphicsDevice device, int[] quirks, int offset, int len) throws IllegalArgumentException { final GLRendererQuirks sq = getStickyDeviceQuirks(device); @@ -303,6 +345,7 @@ public class GLRendererQuirks { *

* Not thread safe. *

+ * @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ public static void addStickyDeviceQuirks(AbstractGraphicsDevice device, GLRendererQuirks quirks) throws IllegalArgumentException { final GLRendererQuirks sq = getStickyDeviceQuirks(device); @@ -313,6 +356,7 @@ public class GLRendererQuirks { *

* Not thread safe. However, use after changing the sticky quirks is safe. *

+ * @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ public static boolean existStickyDeviceQuirk(AbstractGraphicsDevice device, int quirk) { return getStickyDeviceQuirks(device).exist(quirk); @@ -323,6 +367,7 @@ public class GLRendererQuirks { *

* Not thread safe. However, use after changing the sticky quirks is safe. *

+ * @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ public static void pushStickyDeviceQuirks(AbstractGraphicsDevice device, GLRendererQuirks dest) { dest.addQuirks(getStickyDeviceQuirks(device)); -- cgit v1.2.3