From 3e19c2267500c0c459e7dce8d2087387a56f3296 Mon Sep 17 00:00:00 2001 From: Sven Gothel <sgothel@jausoft.com> Date: Thu, 28 Nov 2019 02:00:29 +0100 Subject: Bug 1156 - Implement DRM/GBM Support for JOGL(EGL) and NEWT Adding new classes DRMLib (gluegen of drm + gbm), DRMUtil and DRMMode GBMDummyUpstreamSurfaceHook to new package jogamp.nativewindow.drm, allowing full awareness of DRM + GBM within NativeWindow for JOGL + NEWT. DRMMode replaces the previous native code of collecting drmMode* attributes: active connector, used mode, encoder etc and also supports multiple active connectors. DRMUtil handles the global static drmFd (file descriptor), currently only the GNU/Linux DRM device is supported. GBMDummyUpstreamSurfaceHook provides a simple dummy GBM surface. NativeWindow provides the new nativewindow_drm.so and nativewindow-os-drm.jar, which are included in most 'all' jar packages. build property: setup.addNativeEGLGBM -> setup.addNativeDRMGBM Changes NativeWindowFactory: - TYPE_EGL_GBM -> TYPE_DRM_GBM while keeping the package ID of '.egl.gbm' for NEWT (using EGL) - Initializing DRMUtil at initialization Changes EGLDrawableFactory: - Using native GBM device for the default EGL display creation instead of EGL_DEFAULT_DISPLAY. This resolves issues as seen in Bug 1402, as well in cases w/o surfaceless support. - GL profile mapping uses surfaceless when available for GBM, otherwise uses createDummySurfaceImpl (dummy GBM surface via GBMDummyUpstreamSurfaceHook) - createDummySurfaceImpl uses a dummy GBM surface via GBMDummyUpstreamSurfaceHook - DesktopGL not available with GBM, see Bug 1401 NEWT's DRM + GBM + EGL Driver - Using DRMLib, DRMUtil and DRMMode, removed most native code but WindowDriver swapBuffer - ScreenDriver uses DRMMode, however currently only first connected CRT. - WindowDriver aligns position and size to screen, positions other than 0/0 causes DRM failure - WindowDriver reconfigure n/a NEWT TODO: - DRM Cursor support (mouse pointer) - Pointer event handling --- .../nativewindow/GraphicsConfigurationFactory.java | 18 ++++++++++++++++++ .../com/jogamp/nativewindow/NativeWindowFactory.java | 11 ++++++++--- .../com/jogamp/nativewindow/VisualIDHolder.java | 8 ++++---- 3 files changed, 30 insertions(+), 7 deletions(-) (limited to 'src/nativewindow/classes/com/jogamp') diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/GraphicsConfigurationFactory.java index 929af054e..5214dbf3d 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/GraphicsConfigurationFactory.java @@ -427,6 +427,24 @@ public abstract class GraphicsConfigurationFactory { } } + /** + * Called by {@link #chooseGraphicsConfiguration(CapabilitiesImmutable, CapabilitiesImmutable, CapabilitiesChooser, AbstractGraphicsScreen, int)} + * post argument validation within {@link AbstractGraphicsDevice#lock()}ed segment. + * + * @param capsChosen the intermediate chosen capabilities to be refined by this implementation, may be equal to capsRequested + * @param capsRequested the original requested capabilities + * @param chooser the choosing implementation + * @param screen the referring Screen + * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system. + * @return the complete GraphicsConfiguration + * + * @throws IllegalArgumentException if the data type of the passed + * AbstractGraphicsDevice is not supported by this + * NativeWindowFactory. + * @throws NativeWindowException if any window system-specific errors caused + * the selection of the graphics configuration to fail. + * @see #chooseGraphicsConfiguration(CapabilitiesImmutable, CapabilitiesImmutable, CapabilitiesChooser, AbstractGraphicsScreen, int) + */ protected abstract AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen screen, int nativeVisualID) diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java index a41e9c349..d4249d404 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java @@ -86,8 +86,8 @@ public abstract class NativeWindowFactory { /** Wayland/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ public static final String TYPE_WAYLAND = ".wayland"; - /** GBM/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ - public static final String TYPE_EGL_GBM = ".egl.gbm"; + /** DRM/GBM type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ + public static final String TYPE_DRM_GBM = ".egl.gbm"; // We leave the sub-package name as .egl.gbm for NEWT as it uses EGL /** OpenKODE/EGL type, as retrieved with {@link #getNativeWindowType(boolean)}. String is canonical via {@link String#intern()}.*/ public static final String TYPE_EGL = ".egl"; @@ -128,6 +128,8 @@ public abstract class NativeWindowFactory { private static final String JAWTUtilClassName = "jogamp.nativewindow.jawt.JAWTUtil" ; /** {@link jogamp.nativewindow.x11.X11Util} implements {@link ToolkitProperties}. */ private static final String X11UtilClassName = "jogamp.nativewindow.x11.X11Util"; + /** {@link jogamp.nativewindow.drm.DRMUtil} implements {@link ToolkitProperties}. */ + private static final String DRMUtilClassName = "jogamp.nativewindow.drm.DRMUtil"; /** {@link jogamp.nativewindow.macosx.OSXUtil} implements {@link ToolkitProperties}. */ private static final String OSXUtilClassName = "jogamp.nativewindow.macosx.OSXUtil"; /** {@link jogamp.nativewindow.ios.IOSUtil} implements {@link ToolkitProperties}. */ @@ -181,7 +183,7 @@ public abstract class NativeWindowFactory { return TYPE_WAYLAND; } if( guessGBM(false) ) { - return TYPE_EGL_GBM; + return TYPE_DRM_GBM; } if( BcmVCArtifacts.guessVCIVUsed(false) ) { return TYPE_BCM_VC_IV; @@ -259,6 +261,9 @@ public abstract class NativeWindowFactory { case TYPE_X11: clazzName = X11UtilClassName; break; + case TYPE_DRM_GBM: + clazzName = DRMUtilClassName; + break; case TYPE_WINDOWS: clazzName = GDIClassName; break; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/com/jogamp/nativewindow/VisualIDHolder.java index 69bfe50f8..62b73d230 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/VisualIDHolder.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/VisualIDHolder.java @@ -40,13 +40,13 @@ import java.util.Comparator; public interface VisualIDHolder { public enum VIDType { - // Generic Values + /** Generic Values */ INTRINSIC(0), NATIVE(1), - // EGL Values + /** EGL Values */ EGL_CONFIG(10), - // X11 Values + /** X11 Values */ X11_XVISUAL(20), X11_FBCONFIG(21), - // Windows Values + /** Windows Values */ WIN32_PFD(30); public final int id; -- cgit v1.2.3