diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
5 files changed, 46 insertions, 12 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index 7bd2e25e5..fcd4f54eb 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -80,10 +80,17 @@ public class EGLDisplayUtil { static EGLDisplayRef getOrCreateOpened(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { final EGLDisplayRef o = (EGLDisplayRef) openEGLDisplays.get(eglDisplay); if( null == o ) { - if( EGL.eglInitialize(eglDisplay, major, minor) ) { + final boolean ok = EGL.eglInitialize(eglDisplay, major, minor); + if( DEBUG ) { + System.err.println("EGLDisplayUtil.EGL.eglInitialize 0x"+Long.toHexString(eglDisplay)+" -> "+ok); + } + if( ok ) { final EGLDisplayRef n = new EGLDisplayRef(eglDisplay); openEGLDisplays.put(eglDisplay, n); n.initRefCount++; + if( DEBUG ) { + System.err.println("EGLDisplayUtil.EGL.eglInitialize "+n); + } if( null == singletonEGLDisplay ) { singletonEGLDisplay = n; } @@ -113,7 +120,12 @@ public class EGLDisplayUtil { if( 0 < o.initRefCount ) { // no negative refCount o.initRefCount--; if( 0 == o.initRefCount ) { - res[0] = EGL.eglTerminate(eglDisplay); + final boolean ok = EGL.eglTerminate(eglDisplay); + if( DEBUG ) { + System.err.println("EGLDisplayUtil.EGL.eglTerminate 0x"+Long.toHexString(eglDisplay)+" -> "+ok); + System.err.println("EGLDisplayUtil.EGL.eglTerminate "+o); + } + res[0] = ok; if( o == singletonEGLDisplay ) { singletonEGLDisplay = null; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index e63a63634..ef3c96aeb 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -36,6 +36,7 @@ package jogamp.opengl.egl; +import com.jogamp.common.ExceptionUtils; import com.jogamp.nativewindow.ProxySurface; import com.jogamp.opengl.GLContext; import com.jogamp.opengl.GLException; @@ -82,7 +83,10 @@ public class EGLDrawable extends GLDrawableImpl { final EGLSurface eglSurf = (EGLSurface) surface; final long eglSurfHandle = eglSurf.getSurfaceHandle(); if(DEBUG) { - System.err.println(getThreadName() + ": destroyHandle of "+eglSurf); + System.err.println(getThreadName() + ": EGLDrawable: destroyHandle of "+toHexString(eglSurfHandle)); + ProxySurfaceImpl.dumpHierarchy(System.err, eglSurf); + System.err.println(getThreadName() + ": EGLSurface : "+eglSurf); + ExceptionUtils.dumpStack(System.err); } if( !eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) && EGL.EGL_NO_SURFACE == eglSurfHandle ) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 79ecb2dd7..853599ec2 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -127,7 +127,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { public EGLFeatures(final EGLGraphicsDevice device) { final long eglDisplay = device.getHandle(); vendor = EGL.eglQueryString(eglDisplay, EGL.EGL_VENDOR); - if(DEBUG) { + if(DEBUG_SHAREDCTX) { System.err.println("EGLFeatures on device "+device+", vendor "+vendor); } version = device.getEGLVersion(); @@ -143,8 +143,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } hasGLAPI = _hasGLAPI; - if(DEBUG) { - System.err.println(" Client APIs: "+eglClientAPIStr+"; has EGL 1.4 "+hasEGL_1_4+" -> has OpenGL "+hasGLAPI); + if(DEBUG_SHAREDCTX) { + System.err.println(" Client APIs: '"+eglClientAPIStr+"'; has EGL 1.4 "+hasEGL_1_4+" -> has OpenGL "+hasGLAPI); } } { @@ -162,7 +162,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } hasKHRSurfaceless = extensions.contains("EGL_KHR_surfaceless_context"); } - if(DEBUG) { + if(DEBUG_SHAREDCTX) { System.err.println(" Extensions: "+extensions); System.err.println(" KHR_create_context: "+hasKHRCreateContext); System.err.println(" KHR_surfaceless_context: "+hasKHRSurfaceless); @@ -395,7 +395,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { private void dumpMap() { synchronized(sharedResourceImplementation) { final Map<String /* uniqueId */, SharedResourceRunner.Resource> sharedMap = sharedResourceImplementation.getSharedMap(); - System.err.println("EGLDrawableFactory.map "+sharedMap.size()); + System.err.println("EGLDrawableFactory.MapGLVersion.map "+sharedMap.size()); int i=0; final Set<String> keys = sharedMap.keySet(); for(final Iterator<String> keyI = keys.iterator(); keyI.hasNext(); i++) { @@ -505,6 +505,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) { + if ( DEBUG_SHAREDCTX ) { + System.err.println("EGLDrawableFactory.MapGLVersions: device "+adevice); + } + final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; final GLRendererQuirks[] rendererQuirksGLn = new GLRendererQuirks[] { null }; @@ -595,7 +599,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if ( !GLProfile.isAvailable(adevice, profileString) ) { if ( DEBUG_SHAREDCTX ) { - System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" n/a on "+adevice); + System.err.println("EGLDrawableFactory.MapGLVersions: "+profileString+" n/a on "+adevice); } return false; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 6c11b3bdc..890dab8f7 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -1,5 +1,6 @@ package jogamp.opengl.egl; +import com.jogamp.common.ExceptionUtils; import com.jogamp.nativewindow.NativeSurface; import com.jogamp.nativewindow.ProxySurface; import com.jogamp.nativewindow.UpstreamSurfaceHook; @@ -8,6 +9,8 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.egl.EGL; +import jogamp.nativewindow.ProxySurfaceImpl; + /** Uses a PBuffer offscreen surface */ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { /** @@ -50,6 +53,11 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } eglDevice.lock(); try { + if( EGLDrawable.DEBUG ) { + System.err.println(EGLSurface.getThreadName()+": EGLDummyUpstreamSurfaceHook: EGL.eglDestroySurface: 0x"+Long.toHexString(s.getSurfaceHandle())); + ProxySurfaceImpl.dumpHierarchy(System.err, s); + ExceptionUtils.dumpStack(System.err); + } EGL.eglDestroySurface(eglDevice.getHandle(), s.getSurfaceHandle()); s.setSurfaceHandle(EGL.EGL_NO_SURFACE); s.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java index e4e692fb2..8956bcbd9 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java @@ -35,7 +35,7 @@ import com.jogamp.nativewindow.ProxySurface; import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.opengl.GLException; - +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.opengl.egl.EGL; @@ -101,16 +101,22 @@ public class EGLSurface extends WrappedSurface { final boolean isPBuffer = ((GLCapabilitiesImmutable) config.getChosenCapabilities()).isPBuffer(); long eglSurface = createEGLSurfaceHandle(isPBuffer, true /* useSurfaceHandle */, config, nativeSurface); + if( DEBUG ) { + System.err.println(getThreadName() + ": EGLSurface: EGL.eglCreateSurface.0: 0x"+Long.toHexString(eglSurface)); + ProxySurfaceImpl.dumpHierarchy(System.err, this); + } + if ( EGL.EGL_NO_SURFACE == eglSurface ) { final int eglError0 = EGL.eglGetError(); if( EGL.EGL_BAD_NATIVE_WINDOW == eglError0 && !isPBuffer ) { // Try window handle if available and differs (Windows HDC / HWND). // ANGLE impl. required HWND on Windows. if( hasUniqueNativeWindowHandle(nativeSurface) ) { - if(DEBUG) { + eglSurface = createEGLSurfaceHandle(isPBuffer, false /* useSurfaceHandle */, config, nativeSurface); + if( DEBUG ) { System.err.println(getThreadName() + ": Info: Creation of window surface w/ surface handle failed: "+config+", error "+GLDrawableImpl.toHexString(eglError0)+", retry w/ windowHandle"); + System.err.println(getThreadName() + ": EGLSurface: EGL.eglCreateSurface.1: 0x"+Long.toHexString(eglSurface)); } - eglSurface = createEGLSurfaceHandle(isPBuffer, false /* useSurfaceHandle */, config, nativeSurface); if (EGL.EGL_NO_SURFACE == eglSurface) { throw new GLException("Creation of window surface w/ window handle failed: "+config+", "+this+", error "+GLDrawableImpl.toHexString(EGL.eglGetError())); } |