<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>722</bug_id>
          
          <creation_ts>2013-04-18 23:50:50 +0200</creation_ts>
          <short_desc>GLEventListenerState doesn&apos;t track AbstractGraphicsDevice&apos;s Toolkit Lock. It also shall lock the GLAutoDrawable&apos;s NativeSurface while operating.</short_desc>
          <delta_ts>2013-04-23 22:45:40 +0200</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>2</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>sgothel</cc>
          
          <cf_type>DEFECT</cf_type>
          <cf_scm_refs>0f7412855c118cb501d8a001df7a7487354b5029</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2501</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-04-18 23:50:50 +0200</bug_when>
    <thetext>[junit] Thread-9-null: ** screenshot: TestGLContextDrawableSwitch21Newt2AWT.test11GLWindow2GLCanvasOnScrnGL2ES2_-n0000-GL2ES2-hw-onscreen-Bdbl-Frgb__Irgba8880-D24-St00-Sa00_default-0256x0256.png
    [junit] Exception in thread &quot;AWT-EventQueue-0&quot; java.lang.RuntimeException: &lt;AWT-EventQueue-0&gt;: Not locked: &lt;f35f44e, 1f3a34af&gt;[count 0, qsz 0, owner &lt;NULL&gt;]
    [junit]     at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.validateLocked(RecursiveLockImpl01Unfairish.java:180)
    [junit]     at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.unlock(RecursiveLockImpl01Unfairish.java:275)
    [junit]     at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.unlock(RecursiveLockImpl01Unfairish.java:268)
    [junit]     at jogamp.nativewindow.ResourceToolkitLock.unlock(ResourceToolkitLock.java:63)
    [junit]     at javax.media.nativewindow.DefaultGraphicsDevice.unlock(DefaultGraphicsDevice.java:155)
    [junit]     at com.jogamp.nativewindow.awt.JAWTWindow.unlockSurface(JAWTWindow.java:422)
    [junit]     at jogamp.opengl.GLDrawableImpl.setRealized(GLDrawableImpl.java:203)
    [junit]     at javax.media.opengl.awt.GLCanvas.setRealizedImpl(GLCanvas.java:441)
    [junit]     at javax.media.opengl.awt.GLCanvas.access$000(GLCanvas.java:153)
    [junit]     at javax.media.opengl.awt.GLCanvas$2.run(GLCanvas.java:449)
    [junit]     at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:88)
    [junit]     at javax.media.opengl.awt.GLCanvas.setRealized(GLCanvas.java:455)
    [junit]     at javax.media.opengl.awt.GLCanvas.validateGLDrawable(GLCanvas.java:631)
    [junit]     at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:476)
    [junit]     at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:537)
    [junit]     at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
    [junit]     at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:56)
    [junit]     at sun.awt.RepaintArea.paint(RepaintArea.java:224)
    [junit]     at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:695)
    [junit]     at java.awt.Component.dispatchEventImpl(Component.java:4727)
    [junit]     at java.awt.Component.dispatchEvent(Component.java:4481)
    [junit]     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
    [junit]     at java.awt.EventQueue.access$000(EventQueue.java:84)
    [junit]     at java.awt.EventQueue$1.run(EventQueue.java:602)
    [junit]     at java.awt.EventQueue$1.run(EventQueue.java:600)
    [junit]     at java.security.AccessController.doPrivileged(Native Method)
    [junit]     at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    [junit]     at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    [junit]     at java.awt.EventQueue$2.run(EventQueue.java:616)
    [junit]     at java.awt.EventQueue$2.run(EventQueue.java:614)
    [junit]     at java.security.AccessController.doPrivileged(Native Method)
    [junit]     at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    [junit]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
    [junit]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    [junit]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    [junit]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    [junit]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    [junit]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    [junit]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2502</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-04-19 02:19:03 +0200</bug_when>
    <thetext>Bug appeared after updating NV driver to 313.30.

After updating OpenIndiana itself, I could not reproduce this behavior
within 5 test runs, including one jenkins build.

Keeping an eye on it, and can be marked invalid if it doesn&apos;t happen again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2503</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-04-19 02:32:38 +0200</bug_when>
    <thetext>Reproduced on GNU/Linux w/ AMD GPU within same unit test, i.e. 
   TestGLContextDrawableSwitch21Newt2AWT - test11GLWindow2GLCanvasOnScrnGL2ES2

Seems that the aDevice can become unlocked by a previous 
drawable/context switch operation. 

Rarely reproducible, needs to analyze code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2505</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-04-19 18:06:39 +0200</bug_when>
    <thetext>Root cause found, see new title:

GLEventListenerState doesn&apos;t track AbstractGraphicsDevice&apos;s Toolkit Lock. It also shall lock the GLAutoDrawable&apos;s NativeSurface while operating.

GLEventListenerState swaps the AbstractGraphicsDevice to preserve the device handle
being used for GL context was creation.
It&apos;s ToolkitLock was kept, hence the confusion.

On another thought .. it may be far easier to move the the device handle value itself
if compatible (X11/EGL).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2509</commentid>
    <comment_count>4</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2013-04-23 22:45:40 +0200</bug_when>
    <thetext>Make GLEventListenerState &apos;transaction&apos; safe Animator.pause[ surface.lock[ modify ] ]
    
GLEventListenerState:
  New model for GLEventListenerState&apos;s transaction safety:
   - Z Decorate-1: Animator.pause [ X ]  Animator.resume
   - X Decorate-2: Surface.lock [ Y ] Surface.unlock
    
  - Instead of setting AbstractGraphicsDevice, just swap the handle and ownership.
    
  - Issuing setRealized(..) only if required, i.e. having an upstream-surface (EGL..) depending on used device
    
  - Utilizing setRealized(..) on the GLAD&apos;s delegated &apos;real&apos; drawable, avoiding optional GLAD locking.
    
  - Cleanup and above changes shall render impl. easier to read.
    
GLEventListenerState Unit Tests:
  - If swapping/moving from AWT -&gt; NEWT, use a NEWT dedicated Display
    avoiding ATI driver XCB crash - read comment.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>