diff options
author | Sven Gothel <[email protected]> | 2019-12-25 02:07:50 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-12-25 02:07:50 +0100 |
commit | b91c680fb93a03720ff9fcb39cf052cfe8d40e76 (patch) | |
tree | fb2b4bbd5817ca9523404984940f48c7a774cc35 /src/newt | |
parent | 07de253dae77b39da944a946381bd6efec0066ba (diff) |
Bug 1156: Seperate DRM/GBM NEWT native library from main head NEWT native library
DRM/GBM is enabled for Linux in general.
Nativewindow's 'nativewindow_drm' DRM/GBM native library is already seperated.
NEWT get its 'newt_drm' DRM/GBM native library.
NEWT's main head native library is renamed from 'newt' -> 'newt_head'
and is earmarked for further seperation similar to Nativewindow's.
At least a 'newt_wayland' will probably followup when support is added.
Goal is to remove DRM/GBM dependency for Linux X11 operation
as well as removing X11 dependency for Linux DRM/GBM operation.
Diffstat (limited to 'src/newt')
12 files changed, 33 insertions, 13 deletions
diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java index 05df63794..9372de26c 100644 --- a/src/newt/classes/com/jogamp/newt/util/MainThread.java +++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java @@ -104,7 +104,7 @@ public class MainThread { static { NativeWindowFactory.initSingleton(); - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() || PropertyAccess.getBooleanProperty("newt.MainThread.force", true); osType = Platform.getOSType(); diff --git a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java index 84e2167ee..fde3de222 100644 --- a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java +++ b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java @@ -47,12 +47,32 @@ import com.jogamp.common.os.Platform; import com.jogamp.common.util.cache.TempJarCache; public class NEWTJNILibLoader extends JNILibLoaderBase { - public static boolean loadNEWT() { + /** + * Loads the NEWT native library for the main head display, + * i.e. X11 for Unix, GDI for Windows .. and so forth. + */ + public static boolean loadNEWTHead() { return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { Platform.initSingleton(); - final String libName = "newt"; + final String libName = "newt_head"; + if( TempJarCache.isInitialized(true) && null == TempJarCache.findLibrary(libName) ) { + JNILibLoaderBase.addNativeJarLibsJoglCfg(new Class<?>[] { jogamp.nativewindow.Debug.class, jogamp.newt.Debug.class }); + } + return Boolean.valueOf(loadLibrary(libName, false, NEWTJNILibLoader.class.getClassLoader())); + } + }).booleanValue(); + } + /** + * Loads the NEWT native library for the drm/gbm display. + */ + public static boolean loadNEWTDrmGbm() { + return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + @Override + public Boolean run() { + Platform.initSingleton(); + final String libName = "newt_drm"; if( TempJarCache.isInitialized(true) && null == TempJarCache.findLibrary(libName) ) { JNILibLoaderBase.addNativeJarLibsJoglCfg(new Class<?>[] { jogamp.nativewindow.Debug.class, jogamp.newt.Debug.class }); } diff --git a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java index 216dccb2b..91a8d4dfe 100644 --- a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java @@ -37,7 +37,7 @@ import com.jogamp.opengl.egl.EGL; public class DisplayDriver extends jogamp.newt.DisplayImpl { static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); if (!WindowDriver.initIDs0()) { throw new NativeWindowException("Failed to initialize Android NEWT Windowing library"); diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java index cd801e59a..a65bd1e4c 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java @@ -45,7 +45,7 @@ import com.jogamp.opengl.egl.EGL; public class DisplayDriver extends jogamp.newt.DisplayImpl { static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); if (!WindowDriver.initIDs()) { throw new NativeWindowException("Failed to initialize BCEGL Window jmethodIDs"); diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java index 5e1e61407..8a29f96f6 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java @@ -52,7 +52,7 @@ public class DisplayDriver extends DisplayImpl { static final PNGPixelRect defaultPointerIconImage; static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); GLProfile.initSingleton(); if (!DisplayDriver.initIDs()) { diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java index ea42c27af..19e44b830 100644 --- a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java @@ -50,7 +50,7 @@ import jogamp.opengl.egl.EGLDisplayUtil; public class DisplayDriver extends DisplayImpl { static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTDrmGbm(); GLProfile.initSingleton(); if (!DisplayDriver.initIDs()) { diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java index 33712e35d..b92c355ef 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java @@ -41,7 +41,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl { static int initCounter = 0; static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); if (!ScreenDriver.initIDs()) { throw new NativeWindowException("Failed to initialize GDL Screen jmethodIDs"); diff --git a/src/newt/classes/jogamp/newt/driver/ios/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/ios/DisplayDriver.java index d2bb6de02..e5572f6f6 100644 --- a/src/newt/classes/jogamp/newt/driver/ios/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/ios/DisplayDriver.java @@ -39,7 +39,7 @@ import jogamp.newt.NEWTJNILibLoader; public class DisplayDriver extends DisplayImpl { static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); if(!initUIApplication0()) { throw new NativeWindowException("Failed to initialize native Application hook"); diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java index 6b28e94df..b704f8d40 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java @@ -45,7 +45,7 @@ import jogamp.opengl.egl.EGLDisplayUtil; public class DisplayDriver extends DisplayImpl { static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); if (!WindowDriver.initIDs()) { throw new NativeWindowException("Failed to initialize kd.Window jmethodIDs"); diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java index 94001f440..59d3f0e40 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java @@ -59,7 +59,7 @@ public class DisplayDriver extends DisplayImpl { private static final boolean USE_APPKIT_EDTUTIL; static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); if(!initNSApplication0()) { throw new NativeWindowException("Failed to initialize native Application hook"); diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java index 0bd7c5b2a..e9581772a 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java @@ -60,7 +60,7 @@ public class DisplayDriver extends DisplayImpl { private static RegisteredClassFactory sharedClassFactory; static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); { final long[] _defaultIconHandle = { 0, 0 }; if( DisplayImpl.isPNGUtilAvailable() ) { diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java index 9d89ba085..e0fd20e2b 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java @@ -50,7 +50,7 @@ import jogamp.newt.NEWTJNILibLoader; public class DisplayDriver extends DisplayImpl { static { - NEWTJNILibLoader.loadNEWT(); + NEWTJNILibLoader.loadNEWTHead(); if ( !initIDs0(X11Util.XERROR_STACKDUMP) ) { throw new NativeWindowException("Failed to initialize X11Display jmethodIDs"); |