diff options
author | Sven Gothel <[email protected]> | 2010-12-19 00:45:18 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-12-19 00:45:18 +0100 |
commit | 5166d6a6b617ccb15c40fcb8d4eac2800527aa7b (patch) | |
tree | 7a9debae4db5929e4e9e8351e2c5cd778c40c64c /src/jogl/classes/javax | |
parent | 5f67805a1cba7390cde0f862cbe4d4fcce3396ee (diff) |
Adding NVIDIA 'Threaded optimization' workaround/fix at initialization on Windows for javaws/applets.
It has been observed that for some combinations, eg:
- Windows 7 64bit (other variants may apply too)
- NVIDIA 8600M GT
- 260.99
the NVIDIA setting of 'Threaded optimization' := 'auto' (default) causes the JVM to simply crash
in case of javaws and [jnlp] applets.
'Threaded Optimization' := 'off' works reliable
'Threaded Optimization' := 'on' never works with javaws and applets on the above configuration
A user could workaround this by setting 'Threaded Optimization' := 'off',
however, this would disable many users on the spot,
since you cannot ask the average user for such a task, if she only wants to see a web page.
This patch 'fixes' the 'auto' mode by running the eager GL profile initialization
within a block of single CPU affinity:
SetProcessAffinityMask(pid, 1);
try {
initProfilesForDeviceImpl(device);
} finally {
SetProcessAffinityMask(pid, sysValue);
}
Hopefully we can remove this hack with a driver fix.
However this workaround is as little invasive as possible.
Diffstat (limited to 'src/jogl/classes/javax')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLDrawableFactory.java | 3 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 78ca24be0..fe591c9fc 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -220,6 +220,9 @@ public abstract class GLDrawableFactory { } } + protected void enterThreadCriticalZone() {}; + protected void leaveThreadCriticalZone() {}; + protected abstract void shutdownInstance(); /** diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 378d3df9c..3e1727f50 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -1218,6 +1218,15 @@ public class GLProfile { if(null == device) { return false; } + GLDrawableFactory factory = GLDrawableFactory.getFactoryImpl(device); + factory.enterThreadCriticalZone(); + try { + return initProfilesForDeviceImpl(device); + } finally { + factory.leaveThreadCriticalZone(); + } + } + private static synchronized boolean initProfilesForDeviceImpl(AbstractGraphicsDevice device) { boolean isSet = GLContext.getAvailableGLVersionsSet(device); if(DEBUG) { |