aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-29 05:41:47 +0200
committerSven Gothel <[email protected]>2014-07-29 05:41:47 +0200
commit70c6a54fa2b8dec880b5808d87b31f4afb09dd3b (patch)
tree6f0623066f6cb334923ea2c6d8837f59bc03fb7a
parent3fe8ce051d6d0d2da456434a3f6e7bc4e95c9281 (diff)
Bug 1036: NVidia Windows Driver 'Threaded optimization' workaround. [3/3]
Commit 5166d6a6b617ccb15c40fcb8d4eac2800527aa7b added a workaround for NVidia's Windows Driver Threaded optimization bug existing in NVidia driver 260.99 for Window from 2010-12-11. Commit 007f120cd8d33e4231ef4d207b85ed156d1e0c82 fixed the workaround and made it optional, default: turned off! Rational of turning the workaround off was due to testing against the original test-case 'Applet and Webstart' with drivers >= 266.58 from 2011-01-24, which did not reproduce this issue. However, our unit tests reproduced the issue, e.g. test: com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT Hence we have to re-enable the workaround per default. Added the following documentation of the issue: +++ Since NV driver 260.99 from 2010-12-11 a 'Threaded optimization' feature has been introduced. The driver spawns off a dedicated thread to off-load certain OpenGL tasks from the calling thread to perform them async and off-thread. If 'Threaded optimization' is manually enabled 'on', the driver may crash with JOGL's consistent multi-threaded usage - this is a driver bug. If 'Threaded optimization' is manually disabled 'off', the driver always works correctly. 'Threaded optimization' default setting is 'auto' and the driver may crash without this workaround. If setting the process affinity to '1' (1st CPU) while initialization and launching the SharedResourceRunner, the driver does not crash anymore in 'auto' mode. This might be either because the driver does not enable 'Threaded optimization' or because the driver's worker thread is bound to the same CPU. Property integer value <code>jogl.debug.windows.cpu_affinity_mode</code>: 0 - none (no affinity, may cause driver crash with 'Threaded optimization' = ['auto', 'on']) 1 - process affinity (default, workaround for driver crash for 'Threaded optimization' = 'auto', still crashes if set to 'on') +++ Note: WindowsThreadAffinity does _not_ work.
-rwxr-xr-xmake/scripts/tests-win.bat5
-rwxr-xr-xmake/scripts/tests-x32-dbg.bat6
-rwxr-xr-xmake/scripts/tests-x64-dbg.bat4
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java45
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java14
6 files changed, 59 insertions, 19 deletions
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index d4e10e889..fb3bc3b5c 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -7,7 +7,7 @@ REM scripts\java-win.bat com.jogamp.oculusvr.OVRVersion %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -time 30000
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 4000 -x 10 -y 10 -width 100 -height 100 -screen 0
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 40000 -width 100 -height 100 -screen 0 %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT -time 5000
@@ -66,6 +66,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDraw
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT %*
@@ -182,7 +183,7 @@ REM scripts\java-win.bat testawt com.jogamp.opengl.test.junit.jogl.caps.TestMult
REM scripts\java-win.bat testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT %*
REM scripts\java-win.bat testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES2NEWT %*
REM scripts\java-win.bat testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentChildWindowBug632NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug461OffscreenSupersamplingSwingAWT
diff --git a/make/scripts/tests-x32-dbg.bat b/make/scripts/tests-x32-dbg.bat
index fbef1532c..a37dd7b7b 100755
--- a/make/scripts/tests-x32-dbg.bat
+++ b/make/scripts/tests-x32-dbg.bat
@@ -27,7 +27,9 @@ echo CP_ALL %CP_ALL%
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.GLContext" "-Djogl.debug.FBObject" "-Djogl.enable.ANGLE"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.DontQuery"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.QueryNativeTK"
-REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
+REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogl.debug.windows.cpu_affinity_mode=0" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.GLContext"
+REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.GLContext"
+REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.windows.cpu_affinity_mode=0"
REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogl.debug.GLSLCode" "-Djogl.debug.GLMediaPlayer"
REM set D_ARGS="-Djogl.debug.ExtensionAvailabilityCache" "-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.ProcAddressHelper=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.NativeLibrary=true"
@@ -41,7 +43,7 @@ REM set D_ARGS="-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL" "-Djogl.debug=all"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.test.Window.reparent.incompatible=true"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent"
REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
-set D_ARGS="-Djogl.debug.GLMediaPlayer" "-Djogl.debug.GLMediaPlayer.Native"
+REM set D_ARGS="-Djogl.debug.GLMediaPlayer" "-Djogl.debug.GLMediaPlayer.Native"
REM set D_ARGS="-Xcheck:jni" "-Xint" "-verbose:jni"
set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true"
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat
index 03cfc623e..da5746c45 100755
--- a/make/scripts/tests-x64-dbg.bat
+++ b/make/scripts/tests-x64-dbg.bat
@@ -21,9 +21,11 @@ set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\atomic\oculusvr.jar;%BLD_D
echo CP_ALL %CP_ALL%
REM set D_ARGS="-Djogamp.debug=all"
-set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all"
+REM set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug=all" "-Djogl.debug.EGLDrawableFactory.DontQuery"
+REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogl.debug.windows.cpu_affinity_mode=0" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.GLContext"
+REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.GLContext"
REM set D_ARGS="-Dnativewindow.debug.GDIUtil" "-Dnativewindow.debug.RegisteredClass"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.FBObject"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.DontQuery"
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 5e4857ba1..1871871d9 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -395,7 +395,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.ManualHiDPIBufferedImage01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
@@ -706,7 +706,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT
#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES2NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT $*
+testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentChildWindowBug632NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageAWT $*
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 3daf6e1a8..b4cd184f5 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -85,14 +85,42 @@ import com.jogamp.opengl.GLRendererQuirks;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
/**
+ * Bug 1036: NVidia Windows Driver 'Threaded optimization' workaround.
+ * <p>
+ * https://jogamp.org/bugzilla/show_bug.cgi?id=1036
+ * </p>
+ * <p>
+ * Since NV driver 260.99 from 2010-12-11 a 'Threaded optimization' feature has been introduced.
+ * The driver spawns off a dedicated thread to off-load certain OpenGL tasks from the calling thread
+ * to perform them async and off-thread.
+ * </p>
+ * <p>
+ * If 'Threaded optimization' is manually enabled 'on', the driver may crash with JOGL's consistent
+ * multi-threaded usage - this is a driver bug.
+ * </p>
+ * <p>
+ * If 'Threaded optimization' is manually disabled 'off', the driver always works correctly.
+ * </p>
+ * <p>
+ * 'Threaded optimization' default setting is 'auto' and the driver may crash without this workaround.
+ * </p>
+ * <p>
+ * If setting the process affinity to '1' (1st CPU) while initialization and launching
+ * the {@link SharedResourceRunner}, the driver does not crash anymore in 'auto' mode.
+ * This might be either because the driver does not enable 'Threaded optimization'
+ * or because the driver's worker thread is bound to the same CPU.
+ * </p>
* Property integer value <code>jogl.debug.windows.cpu_affinity_mode</code>:
* <ul>
- * <li>0 - none (default, no affinity required for Windows NV driver >= 266.58 from 2011-01-24)</li>
- * <li>1 - process affinity (was required w/ Windows NV driver 260.99 from 2010-12-11, see commit 5166d6a6b617ccb15c40fcb8d4eac2800527aa7b)</li>
- * <li>2 - thread affinity (experimental)</li>
+ * <li>0 - none (no affinity, may cause driver crash with 'Threaded optimization' = ['auto', 'on'])</li>
+ * <li>1 - process affinity (default, workaround for driver crash for 'Threaded optimization' = 'auto', still crashes if set to 'on')</li>
* </ul>
+ * <p>
+ * Test case reproducing the crash reliable is: com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT<br>
+ * (don't ask why ..)
+ * </p>
*/
- private static final int CPU_AFFINITY_MODE = Debug.getIntProperty("jogl.debug.windows.cpu_affinity_mode", true, 0);
+ private static final int CPU_AFFINITY_MODE = Debug.getIntProperty("jogl.debug.windows.cpu_affinity_mode", true, 1);
private static DesktopGLDynamicLookupHelper windowsWGLDynamicLookupHelper = null;
@@ -102,14 +130,17 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
super();
switch( CPU_AFFINITY_MODE ) {
- case 1:
- cpuAffinity = new WindowsProcessAffinity();
+ case 0:
+ cpuAffinity = new NopCPUAffinity();
break;
+ /**
+ * Doesn't work !
case 2:
cpuAffinity = new WindowsThreadAffinity();
break;
+ */
default:
- cpuAffinity = new NopCPUAffinity();
+ cpuAffinity = new WindowsProcessAffinity();
break;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
index 8f23b57a0..10ac9417a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
@@ -31,11 +31,10 @@ package com.jogamp.opengl.test.junit.jogl.caps;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
-
import com.jogamp.opengl.util.Animator;
-
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import javax.media.opengl.GLCapabilities;
@@ -147,14 +146,19 @@ public class TestTranslucencyNEWT extends UITestCase {
static long duration = 500; // ms
public static void main(final String args[]) {
+ boolean waitForKey = false;
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
- try {
- duration = Integer.parseInt(args[i]);
- } catch (final Exception ex) { ex.printStackTrace(); }
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
}
}
+ if( waitForKey ) {
+ UITestCase.waitForKey("main");
+ }
org.junit.runner.JUnitCore.main(TestTranslucencyNEWT.class.getName());
}
}