diff options
author | Sven Gothel <[email protected]> | 2015-02-03 21:18:02 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-02-03 21:18:02 +0100 |
commit | 3317e7a427fbb81dd3d7daa8116c7d33166ed003 (patch) | |
tree | 0a9d544f833ea6512588789461bd5b87a044d4da | |
parent | b88ae2698abe197e64c8ec8571933eaf3b7b740a (diff) |
Bug 1068 - Fix issue w/ unifying Surfaceless probing (commit 2120be14c7525ef051d105f9bb02294f78d17d28)
Commit 2120be14c7525ef051d105f9bb02294f78d17d28
caused GLDrawableFactoryImpl.probeSurfacelessCtx(..)
to be only called if appropriate, hence GLRendererQuirks.NoSurfacelessCtx
was not set otherwise.
This patch adds the required 'else' branch for the case
GLDrawableFactoryImpl.probeSurfacelessCtx(..) is not called
and issues GLDrawableFactoryImpl.setNoSurfacelessCtxQuirk(..).
+++
Add Note to EGLDrawableFactory's shutdown:
"sr.device.close() Issues eglTerminate(), which may cause SIGSEGV w/ NVIDIA 343.36 w/ TestGLProfile01NEWT"
However keep this code enabled, since this seems to be a driver issue.
+++
5 files changed, 39 insertions, 15 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index be930d3f6..50c71ac85 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -101,7 +101,7 @@ function jrun() { #D_ARGS="-Dnativewindow.debug=all" #D_ARGS="-Djogl.debug=all" #D_ARGS="-Djogl.debug=all -Dnewt.debug=all -Djogl.debug.DebugGL" - #D_ARGS="-Dnewt.debug=all" + D_ARGS="-Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" @@ -231,7 +231,7 @@ function jrun() { #D_ARGS="-Dnewt.debug.EDT" #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext" #D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen" - D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window -Djogl.debug.GLJPanel -Djogl.debug.GLCanvas -Djogamp.debug.TempJarCache" + #D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window -Djogl.debug.GLJPanel -Djogl.debug.GLCanvas -Djogamp.debug.TempJarCache" #D_ARGS="-Dnewt.debug.Window.KeyEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent" @@ -400,7 +400,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $* # @@ -840,7 +840,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.graph.demos.ui.UINewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo $* -testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* +#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* #testawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtCanvasAWTDemo $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index 1fd5c5b47..b7f861e13 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -96,7 +96,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * <p> * Caller shall skip probing in case surfaceless support is not possible, * e.g. OpenGL ES without {@code EGL_KHR_surfaceless_context} or EGL < 1.5, - * or desktop OpenGL context < 3.0. + * or desktop OpenGL context < 3.0 and instead call {@link #setNoSurfacelessCtxQuirk(GLContext)}! * </p> * * @param context the context to probe, must be current @@ -141,20 +141,39 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } } if( !noSurfacelessCtxQuirk && !allowsSurfacelessCtx ) { - final int quirk = GLRendererQuirks.NoSurfacelessCtx; - if(DEBUG || GLContext.DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+" -> "+device+": cause: probe"); - } - final GLRendererQuirks glrq = context.getRendererQuirks(); - if( null != glrq ) { - glrq.addQuirk(quirk); - } - GLRendererQuirks.addStickyDeviceQuirk(device, quirk); + setNoSurfacelessCtxQuirkImpl(device, context); } return allowsSurfacelessCtx; } /** + * Method will set the {@link GLRendererQuirks#NoSurfacelessCtx} + * if it has not been set already. + * + * @param context the context to probe, must be current + * @see GLRendererQuirks#NoSurfacelessCtx + */ + protected final void setNoSurfacelessCtxQuirk(final GLContext context) { + final boolean noSurfacelessCtxQuirk = context.hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx); + if( !noSurfacelessCtxQuirk ) { + final GLDrawable origDrawable = context.getGLDrawable(); + final AbstractGraphicsDevice device = origDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + setNoSurfacelessCtxQuirkImpl(device, context); + } + } + private final void setNoSurfacelessCtxQuirkImpl(final AbstractGraphicsDevice device, final GLContext context) { + final int quirk = GLRendererQuirks.NoSurfacelessCtx; + if(DEBUG || GLContext.DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+" -> "+device+": cause: probe"); + } + final GLRendererQuirks glrq = context.getRendererQuirks(); + if( null != glrq ) { + glrq.addQuirk(quirk); + } + GLRendererQuirks.addStickyDeviceQuirk(device, quirk); + } + + /** * Returns the shared resource mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}, * either a pre-existing or newly created, or <code>null</code> if creation failed or not supported.<br> * Creation of the shared resource is tried only once. diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 9c91bc788..8e2535309 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -745,6 +745,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if( probeSurfacelessCtx(context, false /* restoreDrawable */) ) { zeroDrawable = context.getGLDrawable(); } + } else { + setNoSurfacelessCtxQuirk(context); } rendererQuirks[0] = context.getRendererQuirks(); ctxProfile[0] = context.getContextOptions(); @@ -814,7 +816,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } if (null != sr.device) { - // may cause JVM SIGSEGV: + // Issues eglTerminate(), which may cause SIGSEGV w/ NVIDIA 343.36 w/ TestGLProfile01NEWT + // May cause JVM SIGSEGV: sr.device.close(); sr.device = null; } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index d65fa02bd..932c81f5d 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -356,6 +356,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { if( context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ) { allowsSurfacelessCtx = probeSurfacelessCtx(context, true /* restoreDrawable */); } else { + setNoSurfacelessCtxQuirk(context); allowsSurfacelessCtx = false; } hasARBPixelFormat = context.isExtensionAvailable(WGL_ARB_pixel_format); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 7c850549f..ecaf20d86 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -300,6 +300,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { if( contextIsCurrent && context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ) { allowsSurfacelessCtx = probeSurfacelessCtx(context, true /* restoreDrawable */); } else { + setNoSurfacelessCtxQuirk(context); allowsSurfacelessCtx = false; } |