Index: ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLContextImpl.java =================================================================== --- ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLContextImpl.java (revision 913c6e25a6c6bea256f6c23943956563427cc1b4) +++ ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLContextImpl.java (revision ) @@ -105,6 +105,8 @@ protected static final HashMap mappedGLProcAddress; protected static final HashMap mappedGLXProcAddress; + private boolean surfaceLocking = true; + static { mappedContextTypeObjectLock = new Object(); mappedExtensionAvailabilityCache = new HashMap(); @@ -222,7 +224,15 @@ } lock.lock(); } - + + public boolean isSurfaceLocking() { + return surfaceLocking; + } + + public void setSurfaceLocking( boolean aSurfaceLocking ) { + surfaceLocking = aSurfaceLocking; + } + public abstract Object getPlatformGLExtensions(); // Note: the surface is locked within [makeCurrent .. swap .. release] @@ -432,7 +442,12 @@ // Note: the surface is locked within [makeCurrent .. swap .. release] protected final int makeCurrentLocking() throws GLException { boolean exceptionOccurred = false; - int lockRes = drawable.lockSurface(); + int lockRes = 0; + if ( surfaceLocking ) { + lockRes = drawable.lockSurface(); + }else{ + lockRes = NativeSurface.LOCK_SUCCESS; + } try { if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) { return CONTEXT_NOT_CURRENT; @@ -469,10 +484,12 @@ } } finally { if (exceptionOccurred) { + if ( surfaceLocking ) { - drawable.unlockSurface(); - } - } - } + drawable.unlockSurface(); + } + } + } + } protected abstract void makeCurrentImpl(boolean newCreatedContext) throws GLException; protected abstract boolean createImpl() throws GLException ; Index: ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java =================================================================== --- ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java (revision 913c6e25a6c6bea256f6c23943956563427cc1b4) +++ ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java (revision ) @@ -83,6 +83,7 @@ this.pbufferDrawable = pbufferDrawable; context = (GLContextImpl) pbufferDrawable.createContext(parentContext); context.setSynchronized(true); + context.setSurfaceLocking( false ); } public GLContext createContext(GLContext shareWith) { Index: ../../Applications/JOGLGIT/jogl/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java =================================================================== --- ../../Applications/JOGLGIT/jogl/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java (revision 913c6e25a6c6bea256f6c23943956563427cc1b4) +++ ../../Applications/JOGLGIT/jogl/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java (revision ) @@ -37,15 +37,17 @@ import jogamp.nativewindow.Debug; import jogamp.nativewindow.NWJNILibLoader; -import javax.media.nativewindow.*; - +import javax.media.nativewindow.AbstractGraphicsDevice; +import javax.media.nativewindow.NativeWindowException; +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.nativewindow.ToolkitLock; +import javax.media.nativewindow.util.Point; import java.nio.Buffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; import java.security.AccessController; import java.util.ArrayList; import java.util.List; -import javax.media.nativewindow.util.Point; /** * Contains a thread safe X11 utility to retrieve display connections. @@ -496,14 +498,18 @@ } } - public static int XSync(long display, boolean discard) { + public static int XSync( long display, boolean discard, boolean lock ) { + if ( lock ) { lockDefaultToolkit(display); + } - try { + try { return X11Lib.XSync(display, discard); } finally { + if ( lock ) { - unlockDefaultToolkit(display); + unlockDefaultToolkit(display); } - } + } + } public static void XSynchronize(long display, boolean onoff) { lockDefaultToolkit(display); Index: ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java =================================================================== --- ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java (revision 913c6e25a6c6bea256f6c23943956563427cc1b4) +++ ../../Applications/JOGLGIT/jogl/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java (revision ) @@ -40,20 +40,29 @@ package jogamp.opengl.x11.glx; -import java.nio.*; -import java.util.*; - -import javax.media.opengl.*; -import javax.media.nativewindow.*; -import javax.media.nativewindow.x11.X11GraphicsDevice; - import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.VersionNumber; -import jogamp.opengl.*; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; import jogamp.nativewindow.x11.X11Util; +import jogamp.opengl.GLContextImpl; +import jogamp.opengl.GLContextShareSet; +import jogamp.opengl.GLDrawableFactoryImpl; +import jogamp.opengl.GLDrawableImpl; +import javax.media.nativewindow.AbstractGraphicsConfiguration; +import javax.media.nativewindow.AbstractGraphicsDevice; +import javax.media.nativewindow.NativeSurface; +import javax.media.nativewindow.x11.X11GraphicsDevice; +import javax.media.opengl.GLCapabilitiesImmutable; +import javax.media.opengl.GLContext; +import javax.media.opengl.GLException; +import javax.media.opengl.GLProfile; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.util.HashMap; +import java.util.Map; + public abstract class X11GLXContext extends GLContextImpl { protected static final boolean TRACE_CONTEXT_CURRENT = false; // true; @@ -246,9 +255,9 @@ try { // critical path, a remote display might not support this command, // hence we need to catch the X11 Error within this block. - X11Util.XSync(display, false); + X11Util.XSync(display, false, isSurfaceLocking() ); ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs); - X11Util.XSync(display, false); + X11Util.XSync(display, false, isSurfaceLocking() ); } catch (RuntimeException re) { if(DEBUG) { Throwable t = new Throwable("Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re);