From 9ea218a5990b908e04235c407c0951c60df6ffba Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 7 Dec 2014 03:40:07 +0100 Subject: Bug 1068, 1096: Unify EGL surface related code in EGLSurface; Add notion of 'Surfaceless Upstream Surface' Preparation for Bug 1068: GLContext creation and makeCurrent without default framebuffer - Unify EGL surface related code in EGLSurface - EGLWrappedSurface -> EGLSurface, which utilizes a more straight forward foreign upstream surface (X11, GDI, ..) to EGL mapping. This also addresses Bug 1096, i.e. EGL Cleanup. - Add notion of 'Surfaceless Upstream Surface' - Add surfaceless 'fake' upstream surface hooks: - EGLUpstreamSurfacelessHook - X11UpstreamSurfacelessHook Utilizing the ProxySurface option bit 'OPT_UPSTREAM_SURFACELESS' signaling usage of 'no surface'. - Add GLDrawableFactoryImpl.createSurfacelessImpl(..) --- .../jogamp/nativewindow/egl/EGLGraphicsDevice.java | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/nativewindow/classes/com/jogamp') diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java index d21994ea5..a38a48b85 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java @@ -34,11 +34,14 @@ package com.jogamp.nativewindow.egl; import javax.media.nativewindow.*; +import com.jogamp.common.util.VersionNumber; + /** Encapsulates a graphics device on EGL platforms. */ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneable { - final long[] nativeDisplayID = new long[1]; - /* final */ EGLDisplayLifecycleCallback eglLifecycleCallback; + private final long[] nativeDisplayID = new long[1]; + private /* final */ EGLDisplayLifecycleCallback eglLifecycleCallback; + private VersionNumber eglVersion = VersionNumber.zeroVersion; /** * Hack to allow inject a EGL termination call. @@ -52,9 +55,11 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * Implementation should issue an EGL.eglGetDisplay(nativeDisplayID) * inclusive EGL.eglInitialize(eglDisplayHandle, ..) call. * @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle + * @param major out array for EGL major version + * @param minor out array for EGL minor version * @return the initialized EGL display ID, or 0 if not successful */ - public long eglGetAndInitDisplay(long[] nativeDisplayID); + public long eglGetAndInitDisplay(final long[] nativeDisplayID, final int[] major, final int[] minor); /** * Implementation should issue an EGL.eglTerminate(eglDisplayHandle) call. @@ -79,6 +84,9 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl this.eglLifecycleCallback = eglLifecycleCallback; } + /** EGL server version as returned by {@code eglInitialize(..)}. Only valid after {@link #open()}. */ + public VersionNumber getEGLVersion() { return eglVersion; } + public long getNativeDisplayID() { return nativeDisplayID[0]; } @Override @@ -98,11 +106,16 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl if(DEBUG) { System.err.println(Thread.currentThread().getName() + " - EGLGraphicsDevice.open(): "+this); } - handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID); + final int[] major = { 0 }; + final int[] minor = { 0 }; + handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID, major, minor); if(0 == handle) { + eglVersion = VersionNumber.zeroVersion; throw new NativeWindowException("EGLGraphicsDevice.open() failed: "+this); + } else { + eglVersion = new VersionNumber(major[0], minor[0], 0); + return true; } - return true; } return false; } @@ -142,5 +155,10 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl eglLifecycleCallback = (EGLDisplayLifecycleCallback) newOwnership; return oldOwnership; } + + @Override + public String toString() { + return getClass().getSimpleName()+"[type "+getType()+", v"+eglVersion+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]"; + } } -- cgit v1.2.3