From f043a48504b79409df4e674a15c87faa3f47c03f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 3 Oct 2009 13:47:44 -0700 Subject: EGL debug fixes .. --- .../com/sun/opengl/impl/egl/EGLDrawable.java | 5 ++++ .../opengl/impl/egl/EGLGraphicsConfiguration.java | 2 +- .../impl/egl/EGLGraphicsConfigurationFactory.java | 29 +++++++++++++++------- .../media/opengl/DefaultGLCapabilitiesChooser.java | 3 ++- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java index 4265ee8fb..bb341ec52 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -83,6 +83,11 @@ public abstract class EGLDrawable extends GLDrawableImpl { if(EGL.EGL_NO_SURFACE!=eglSurface) { EGL.eglDestroySurface(eglDisplay, eglSurface); } + + if(DEBUG) { + System.err.println("createSurface using eglDisplay 0x"+Long.toHexString(eglDisplay)+", "+eglConfig); + } + eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig()); if(DEBUG) { diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java index 7d9ab5b9d..cde826c1b 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java @@ -266,7 +266,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple } public String toString() { - return getClass().toString()+"["+getScreen()+", eglConfigID "+configID+ + return getClass().toString()+"["+getScreen()+", eglConfigID 0x"+Integer.toHexString(configID)+ ",\n\trequested " + getRequestedCapabilities()+ ",\n\tchosen " + getChosenCapabilities()+ "]"; diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java index 2b91edfec..e2cbc5bab 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java @@ -127,6 +127,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0], caps2.isOnscreen(), caps2.isPBuffer()); if(DEBUG) { + System.err.println("EGL Get Configs: "+numConfigs[0]+", Caps "+caps.length); printCaps("eglGetConfigs", caps, System.err); } int chosen = -1; @@ -137,7 +138,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor throw new GLException("Graphics configuration chooser failed"); } if(DEBUG) { - System.err.println("Choosen "+caps[chosen]); + System.err.println("Chosen "+caps[chosen]); } res = eglChooseConfig(eglDisplay, caps[chosen], capabilities, chooser, absScreen, eglSurfaceType); if(null!=res) { @@ -147,15 +148,15 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor System.err.println("eglChooseConfig failed with eglGetConfig/choosen capabilities surfaceType 0x"+Integer.toHexString(eglSurfaceType)); } - // Last try .. add a fixed embedded profile [ATI, Nokia, ..] + // Last try .. add a fixed embedded profile [ATI, Nokia, Intel, ..] GLCapabilities fixedCaps = new GLCapabilities(glp); /** fixedCaps.setRedBits(5); fixedCaps.setGreenBits(6); - fixedCaps.setBlueBits(5); + fixedCaps.setBlueBits(5); */ fixedCaps.setDepthBits(16); fixedCaps.setSampleBuffers(true); - fixedCaps.setNumSamples(4); */ + fixedCaps.setNumSamples(4); if(DEBUG) { System.err.println("trying fixed caps: "+fixedCaps); } @@ -168,7 +169,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor throw new GLException("Graphics configuration chooser fixed failed"); } if(DEBUG) { - System.err.println("Choosen fixed "+caps[chosen]); + System.err.println("Chosen fixed "+caps[chosen]); } res = eglChooseConfig(eglDisplay, caps[chosen], capabilities, chooser, absScreen, eglSurfaceType); if(null==res) { @@ -182,7 +183,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor AbstractGraphicsScreen absScreen, int eglSurfaceType) { GLProfile glp = capsChosen0.getGLProfile(); int[] attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen0, eglSurfaceType); - _EGLConfig[] configs = new _EGLConfig[10]; + _EGLConfig[] configs = new _EGLConfig[1]; int[] numConfigs = new int[1]; if (!EGL.eglChooseConfig(eglDisplay, attrs, 0, @@ -194,6 +195,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor if(DEBUG) { GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0], capsChosen0.isOnscreen(), capsChosen0.isPBuffer()); + System.err.println("EGL Choose Configs: "+numConfigs[0]+", Caps "+caps.length); printCaps("eglChooseConfig", caps, System.err); } int[] val = new int[1]; @@ -205,13 +207,22 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor } val[0]=0; } - GLCapabilities capsChoosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[0], + GLCapabilities capsChosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[0], capsChosen0.isOnscreen(), capsChosen0.isPBuffer()); if(DEBUG) { - System.err.println("eglChooseConfig found: surfaceType 0x"+Integer.toHexString(eglSurfaceType)+", "+capsChosen0+" -> "+capsChoosen1); + System.err.println("eglChooseConfig found: eglDisplay 0x"+Long.toHexString(eglDisplay)+ + ", surfaceType 0x"+Integer.toHexString(eglSurfaceType)+ + ", eglConfig ID 0x"+Integer.toHexString(val[0])+ + ", "+capsChosen0+" -> "+capsChosen1); } - return new EGLGraphicsConfiguration(absScreen, capsChoosen1, capsRequested, chooser, configs[0], val[0]); + return new EGLGraphicsConfiguration(absScreen, capsChosen1, capsRequested, chooser, configs[0], val[0]); + } else { + if(DEBUG) { + System.err.println("EGL Choose Configs: None using eglDisplay 0x"+Long.toHexString(eglDisplay)+ + ", surfaceType 0x"+Integer.toHexString(eglSurfaceType)+ + ", "+capsChosen0); + } } return null; } diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java index cc7afaa95..5450e400b 100644 --- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java @@ -41,6 +41,7 @@ package javax.media.opengl; import javax.media.nativewindow.Capabilities; import javax.media.nativewindow.NativeWindowException; +import com.sun.opengl.impl.Debug; /**

The default implementation of the {@link GLCapabilitiesChooser} interface, which provides consistent visual @@ -81,7 +82,7 @@ import javax.media.nativewindow.NativeWindowException; */ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { - private static final boolean DEBUG = true; // FIXME: Debug.debug("DefaultGLCapabilitiesChooser"); + private static final boolean DEBUG = Debug.debug("CapabilitiesChooser"); public int chooseCapabilities(Capabilities desired, Capabilities[] available, -- cgit v1.2.3