Skip to content
The Jenkins Controller is preparing for shutdown. No new builds can be started.
Unstable

Changes

Summary

  1. OSX/CALayer: Revise CALayer 'RunOnMainThread' utilization, avoiding (details)
  2. OSX/CALayer: Simplify FixCALayerLayout()/layoutSurfaceLayer() call, no (details)
  3. Fix NEWT WindowImpl reparent-recreate w/ GLEventListenerState: Bug (details)
  4. Remodel OSX/CALayer Threading (commit (details)
  5. Adapt to GlueGen commit b1eb7ca6b9d7dec7ff62c1f1e8ef0a0545724d2f: (details)
  6. NativeWindow OSXUtil RunOnMainThread: Use daemon attachment and do not (details)
  7. OSX CGL: Don't issue [NSOpenGLContext clearDrawable] for (details)
  8. MyNSOpenGLContext::dealloc: Avoid 'invalid context' (details)
  9. OSX/CALayer: OSX/CALayer Threading Part3 - Run CALayer ops in a (details)
  10. OSX/NEWT: Following CALayer streaming design, i.e. issue NSWindow/NSView (details)
  11. GLJPanel: No need to utilize AWT Component's default ImageObserver code (details)
Commit 896e8b021b39e9415040a57a1d540d7d24b02db1 by Sven Gothel
OSX/CALayer: Revise CALayer 'RunOnMainThread' utilization, avoiding deadlocks

RunOnMainThread(waitUntilDone:=true,..) can deadlock the main-thread if called from AWT-EDT,
since the main-thread may call back to AWT-EDT while injecting a new main-thread task.

This patch revises all RunOnMainThread CALayer usage, resulting in only one required left:
  - OSXUtil.AddCASublayer() w/ waitUntilDone:=false

Hence the CALayer code has no more potential to deadlock main-thread/AWT-EDT.

OSXUtil.AddCASublayer() must be performed on main-thread, otherwise the
CALayer attachment will fail - no visible rendering result.

+++

Note: A good trigger to test this deadlock is to magnify/zoom
      the OSX desktop (click background + ctrl-mouse_wheel)
      before running some unit tests.

      TestGLCanvasAWTActionDeadlock01AWT and TestAddRemove02GLWindowNewtCanvasAWT
      also have the potential to trigger the mentioned deadlock.
The file was modified make/config/jogl/cgl-macosx-CustomJavaCode.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java (diff)
The file was modified src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m (diff)
The file was modified src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java (diff)
The file was modified src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java (diff)
The file was modified src/nativewindow/native/macosx/OSXmisc.m (diff)
Commit dd705f1eb14b87b207e375ea0d71e00155a9933f by Sven Gothel
OSX/CALayer: Simplify FixCALayerLayout()/layoutSurfaceLayer() call, no more need for explicit call

- OffscreenLayerSurface.layoutSurfaceLayer() removed, no more required

- JAWTWindow adds a ComponentListener, which issues FixCALayerLayout() at resized, moved and shown.

- MyNSOpenGLLayer no more requires fix*Size() methods

- MyNSOpenGLLayer::setDedicatedSize() need no explicit CATransaction, performed by caller.
The file was modified src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java (diff)
The file was modified src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m (diff)
The file was modified src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java (diff)
The file was modified src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java (diff)
The file was modified src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java (diff)
The file was modified src/jogl/classes/javax/media/opengl/awt/GLCanvas.java (diff)
Commit 538a41849192cc09da36eeaa5fa9ae10973d85b7 by Sven Gothel
Fix NEWT WindowImpl reparent-recreate w/ GLEventListenerState: Bug introduced w/ commit e2506d7663b752f00f0a98f793ebad52e65bd1e3

In case a reparent action takes place w/ recreate,
only preserve the GLEventListenerState if the window is valid and will become visible again (wasVisible).

Also add proper DEBUG log prefix to GLEventListenerState.
The file was modified src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java (diff)
The file was modified src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java (diff)
The file was modified src/newt/classes/jogamp/newt/WindowImpl.java (diff)
Commit 28c6472335b924080d638b33a28f8f4eedb459b1 by Sven Gothel
Remodel OSX/CALayer Threading (commit 896e8b021b39e9415040a57a1d540d7d24b02db1): Run on main-thread w/o blocking ; Misc Changes

Commit 896e8b021b39e9415040a57a1d540d7d24b02db1 moved all native CALayer calls to the current thread
to avoid deadlocks.

Even though this seemed to be fine at least resource GC (release/dealloc calls) were issued
very late in time, probably due to multithreading synchronization of JAWT and/or OSX API.

Example: Our 'TestAddRemove01GLCanvasSwingAWT' test didn't freed CALayer resources incl. GL ctx
         when destroying the objects (AWT Frame, GLCanvas, ..), leading to resource starvation .. eventually.

Remedy is a compromise of behavior before commit 896e8b021b39e9415040a57a1d540d7d24b02db1
and that commit, i.e. to run CALayer lifecycle methods on main-thread, but do not block!

The careful part within MacOSXCGLContext.associateDrawable(..) performs the following block on main-thread:
  - lock the context
  - create NSOpenGLLayer (incl. it's own shared GL context and the DisplayLink)
  - attach NSOpenGLLayer to root CALayer
  - unlock the context

Due to the GL ctx locking, this async offthread operation is safe within our course of operations.

Details:
  - NSOpenGLContext
    - Context and CVDisplayLink creation at init
    - Call [ctx update] if texture/frame size changed
    - 'waitUntilRenderSignal' uses default TO value if given TO is 0 to avoid deadlocks

+++

Misc Changes:
  - Fix object type detection: isMemberOfClass -> isKindOfClass
    - OSXUtil_isNSView0
      OSXUtil_isNSWindow0,
      CGL_isNSOpenGLPixelBuffer

  - MacOSXCGLDrawable/MacOSXPbufferCGLDrawable: remove getNSViewHandle() method.
    MacOSXCGLContext uses common code to detect nature of the drawable handle.

  - MacOSXCGLContext/CALayer: Use safe screenVSyncTimeout values, never 0 to avoid deadlock!

  - JAWTWindow.invalidate: Call detachSurfaceLayer() if not done yet
The file was modified src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java (diff)
The file was modified src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java (diff)
The file was modified src/jogl/native/macosx/MacOSXWindowSystemInterface.m (diff)
The file was modified src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java (diff)
The file was modified src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java (diff)
The file was modified src/nativewindow/native/macosx/OSXmisc.m (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java (diff)
The file was modified src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m (diff)
The file was modified src/jogl/classes/javax/media/opengl/awt/GLCanvas.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java (diff)
Commit ed911109d40e0fca3b2263a4617f35d475612549 by Sven Gothel
Adapt to GlueGen commit b1eb7ca6b9d7dec7ff62c1f1e8ef0a0545724d2f: Function- RunnableTask adds PrintStream 'exceptionOut' argument in ctor.
The file was modified src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java (diff)
The file was modified src/newt/classes/jogamp/newt/DefaultEDTUtil.java (diff)
The file was modified src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java (diff)
Commit 3f2da22cfb682d0eb4fedec98b088f95371f8ef4 by Sven Gothel
NativeWindow OSXUtil RunOnMainThread: Use daemon attachment and do not detach; Add RunLater0(..)
The file was modified src/nativewindow/native/x11/Xmisc.c (diff)
The file was modified src/nativewindow/native/macosx/OSXmisc.m (diff)
The file was modified src/nativewindow/native/NativewindowCommon.c (diff)
The file was modified src/nativewindow/native/NativewindowCommon.h (diff)
Commit 4457b343fe8eba3f2da096a72e38b1aac978ffd5 by Sven Gothel
OSX CGL: Don't issue [NSOpenGLContext clearDrawable] for [NSOpenGLContext setView: view] which breaks pbuffer; Add [NSOpenGLContext clearDrawable].
The file was modified make/stub_includes/opengl/macosx-window-system.h (diff)
The file was modified src/jogl/native/macosx/MacOSXWindowSystemInterface.m (diff)
Commit 12e868f79938f44eba6f50313f977be76d8ea2bb by Sven Gothel
MyNSOpenGLContext::dealloc: Avoid 'invalid context'
The file was modified src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m (diff)
The file was modified src/nativewindow/native/macosx/OSXmisc.m (diff)
Commit f354fb204d8973453c538dda78a2c82c87be61dc by Sven Gothel
OSX/CALayer: OSX/CALayer Threading Part3 - Run CALayer ops in a streaming design on main-thread w/o [infinitive] blocking

History:
  Part1   commit 896e8b021b39e9415040a57a1d540d7d24b02db1 (Run CALayer Ops on current thread to avoid blocking)
  Part2   commit 28c6472335b924080d638b33a28f8f4eedb459b1 (Run CALayer Ops on main-thread w/o blocking)

Dependency:
  GlueGen commit 4becdfa125b07ff969d6540e1112735b53cd15eb (Fix RecursiveLockImpl* Timeout corner case)

Part2 misses essential locking of the OpenGL context (and it's surface upfront) while creating the
NSOpenGLLayer instance. The latter instantiates a OpenGL context shared w/ JOGL's, hence it cannot be locked.

Encapsulating NSOpenGLLayer creation/attachment and it's detachment/release in sub-classes
AttachNSOpenGLLayer and DetachNSOpenGLLayer, where instances will be streamed on main-thread.

Both tasks are triggered at associateDrawable(boolean bound).

The mentioned GL context locking requires disturbs the 'streaming' design considerably in AttachNSOpenGLLayer.
It is solved by attempt to acquire the recursive lock of the surface and the context via 'tryLock(maxwait)'
w/ screen-vSync-period/2. If the locks could not be acquired completly, the AttachNSOpenGLLayer instance
will be re-queued to the main-thread for later execution.

Before DetachNSOpenGLLayer is being streamed, it is validated whether AttachNSOpenGLLayer did run.
A recursive situation does happen w/ resizing an offscreen pbuffer drawable! Hence extra care is being taken.
The file was modified src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java (diff)
The file was modified src/jogl/classes/jogamp/opengl/GLContextImpl.java (diff)
The file was modified src/jogl/classes/jogamp/opengl/GLDrawableHelper.java (diff)
The file was modified src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java (diff)
The file was modified src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java (diff)
The file was modified src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java (diff)
The file was modified src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java (diff)
The file was modified src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java (diff)
Commit 81cbcdc8469143587b2044661dd613c798ae02ba by Sven Gothel
OSX/NEWT: Following CALayer streaming design, i.e. issue NSWindow/NSView Ops on main-thread w/o blocking; NEWT/WindowImpl: Volatile multithreaded mutable values

Similar to commits:
  28c6472335b924080d638b33a28f8f4eedb459b1
  f354fb204d8973453c538dda78a2c82c87be61dc

main-thread operations cannot block main-thread.

Luckily we are able to create the NSWindow and NSView instance uninitialized (deferred) on the current thread,
while issuing their initialization on the main-thread w/o blocking.

Further more a size glitch is fixed, which didn't take the title bar into account.

+++

NEWT/WindowImpl: Volatile multithreaded mutable values

Since position, size and other attributes might get changes off-thread, these fields needs to be volatile.
The file was modified src/newt/native/MacWindow.m (diff)
The file was modified src/newt/classes/jogamp/newt/DefaultEDTUtil.java (diff)
The file was modified src/newt/classes/jogamp/newt/WindowImpl.java (diff)
The file was modified src/newt/native/NewtMacWindow.m (diff)
The file was modified make/scripts/tests.sh (diff)
The file was modified src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java (diff)
The file was modified src/newt/native/NewtMacWindow.h (diff)
Commit 8e56bd80ab17970e2a45039a44d15e36514c4d50 by Sven Gothel
GLJPanel: No need to utilize AWT Component's default ImageObserver code - pixel data is ready when invoked.
The file was modified src/jogl/classes/javax/media/opengl/awt/GLJPanel.java (diff)