From d88ca606f67e16c144b36f8fd1f188fdf8531ee0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 5 Mar 2020 20:04:17 +0100 Subject: Bug 1398: Ensure CGLContext lock will be acquired before leaving user makeCurrent() call Command SetNSViewCmd sets NSOpenGLContext's NSView via [NSOpenGLContext setView:] on the main-thread as enforced since XCode 11 using SDK macosx10.15, see Bug 1398. This command is injected into OSX's main-thread @ NSOpenGLImpl.makeCurrent(long) only if required, i.e. issued only for a newly bound NSView and skipped for surface-less or offscreen 'surfaces'. This operation must be performed w/o blocking other tasks locking the NativeSurface on main-thread to complete. Since [NSOpenGLContext setView:] acquires the CGLContext lock on the main-thread, it can't be locked by the calling thread until this task has been completed. Command issuer NSOpenGLImpl.makeCurrent(long) will not acquire the CGLContext lock if this command is pending. contextMadeCurrent(true) cures the potential unlocked CGLContext by issuing a whole GLContext.release() and GLContext.makeCurrent() cycle while waiting for this command to be completed in-between. This GLContext cycle also ensures an unlocked NativeSurface.getLock() in-between, allowing potentially blocked other tasks on the main-thread to complete and hence this queued command to execute. Notable test provoking critical multithreading issues is com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT. Notable test exposing issues with an unlocked CGLContext is com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT. --- make/scripts/tests.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'make/scripts') diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index aa9b9a3f9..a84f7dd8d 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -469,7 +469,7 @@ function testawtswt() { # # HiDPI # -testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2SimpleNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* @@ -945,13 +945,12 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testawt com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot $* # # OSX Bug 1398 -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT1 $* -#testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT10 $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* -# -#testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 $* -#testawt com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot $* +#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT $* # +# to re-test: +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug658NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 $* # Linux DRM/GBM # -- cgit v1.2.3