From 976e89ff24da3b2cdf206e8ef8f222f54fb467de Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 23 Nov 2019 17:22:39 +0100 Subject: Bug 1156: GBM: Bring up incl GL rendering (TODO: GBM working page flip / sync) - EGLSurface: Factor out 'eglCreate[Platform]WindowSurface' NEWT egl.gbm.WindowDriver -- Properly use GBM fourcc format and use as visualID for GBM surface creation and EGL config selection -- Create eglSurface within this class -- Hook up GBM/DRM page flip (not working yet, no visible artifacts - no swap) - ProxySurfaceImpl.surfaceSwap() call upstreamSurface's implementation if available TODO: 'Permission denied' calling: - drmSetMaster (optional) - drmModeSetCrtc - drmModePageFlip --- src/jogl/classes/jogamp/opengl/egl/EGLSurface.java | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/egl/EGLSurface.java') diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java index 20e067eac..367f83295 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java @@ -36,7 +36,6 @@ 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; @@ -93,6 +92,23 @@ public class EGLSurface extends WrappedSurface { } } + /** + * Entry point to C language function: + *
EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint * attrib_list)
Part of EGL_VERSION_1_0
+ *
or
+ *

+ * EGLSurface eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLAttrib * attrib_list)
Part of EGL_VERSION_1_5, EGL_EXT_platform_base
Alias for: eglCreatePlatformWindowSurfaceEXT + *

+ */ + public static long eglCreateWindowSurface(final long dpy, final long config, final long win) { + final int eglPlatform = EGLDisplayUtil.getEGLPlatformType(true); + if( 0 != eglPlatform ) { + return EGL.eglCreatePlatformWindowSurface(dpy, config, win, null); + } else { + return EGL.eglCreateWindowSurface(dpy, config, win, null); + } + } + public void setEGLSurfaceHandle() throws GLException { setSurfaceHandle( createEGLSurface() ); } @@ -138,24 +154,15 @@ public class EGLSurface extends WrappedSurface { if( isPBuffer ) { return EGLDrawableFactory.createPBufferSurfaceImpl(config, getSurfaceWidth(), getSurfaceHeight(), false); } else { - final int eglPlatform = EGLDisplayUtil.getEGLPlatformType(true); final long eglNativeWin = useNativeSurface ? nativeSurface.getSurfaceHandle() : ((NativeWindow)nativeSurface).getWindowHandle(); - final long eglSurface; - if( 0 != eglPlatform ) { - eglSurface = EGL.eglCreatePlatformWindowSurface(config.getScreen().getDevice().getHandle(), - config.getNativeConfig(), - eglNativeWin, null); - } else { - eglSurface = EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), - config.getNativeConfig(), - eglNativeWin, null); - } + final long eglSurface = eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), config.getNativeConfig(), eglNativeWin); if(DEBUG) { + final int eglPlatform = EGLDisplayUtil.getEGLPlatformType(true); System.err.println("EGLSurface.createEGLSurface.X: useNativeSurface "+useNativeSurface+ ", nativeWin "+EGLContext.toHexString(eglNativeWin)+") @ "+ eglPlatform+"/"+NativeWindowFactory.getNativeWindowType(true)+": "+ EGLContext.toHexString(eglSurface)+ - ", "+((EGL.EGL_NO_SURFACE != eglSurface)?"OK":"Failed")); + ", "+((EGL.EGL_NO_SURFACE != eglSurface)?"OK":"Failed")+" - with config "+config); } return eglSurface; } -- cgit v1.2.3