From 50d4fd0210a417ba0fcbf73a90e50a86ef076cad Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sat, 29 Aug 2015 16:35:35 +0200
Subject: Bug 1203: Refine DEBUG output

---
 src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

(limited to 'src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java')

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;
                         }
-- 
cgit v1.2.3