diff options
author | Kenneth Russel <[email protected]> | 2006-11-24 01:33:35 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-11-24 01:33:35 +0000 |
commit | c5ba57aa77b4dbd49d2d2ee78e4520a3c8ceb3a0 (patch) | |
tree | b92d3a70ba1ad909e2478eede2442ce57a5db371 /src/classes/com/sun/opengl/impl | |
parent | 9d656e00cf460803e9de78d1fa73479df8616940 (diff) |
Removed native code for DRIHack and replaced it with code using the
GlueGen runtime library (specifically the NativeLibrary class).
Updated the build.xml, in particular the dist targets, to no longer
build or copy this native library. Updated the NativeLibrary class to
allow specification of the full path to the library. Removed the
GlueGen runtime classes from jogl.jar; these are now expected to
reside in gluegen-rt.jar and it is expected that developers will have
this on their CLASSPATH. Updated the dist target to include the
gluegen-rt native library and jar file. Updated the JOGLAppletLauncher
to download and unpack the gluegen-rt-natives jar as well as the
jogl-natives jar. Updated the HowToBuild, user guide, and
JOGLAppletLauncher documentation for this restructuring. Fixed bug in
gluegen-cpptasks.xml in detection of Solaris/SPARCv9 and refactored
targets further. Tested on Solaris/x86 so far; further testing and
debugging of the nightly builds and applet launcher, and update of the
JOGL applet test, to follow.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@993 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl')
-rw-r--r-- | src/classes/com/sun/opengl/impl/NativeLibLoader.java | 11 | ||||
-rw-r--r-- | src/classes/com/sun/opengl/impl/x11/DRIHack.java | 39 |
2 files changed, 16 insertions, 34 deletions
diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java index 25c52e594..aa5c4e236 100644 --- a/src/classes/com/sun/opengl/impl/NativeLibLoader.java +++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java @@ -133,17 +133,6 @@ public class NativeLibLoader { }); } - // See DRIHack.java in com/sun/opengl/impl/x11/ for description of - // why this is needed - public static void loadDRIHack() { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - loadLibrary("jogl_drihack", null, false, false); - return null; - } - }); - } - public static void loadCgImpl() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { diff --git a/src/classes/com/sun/opengl/impl/x11/DRIHack.java b/src/classes/com/sun/opengl/impl/x11/DRIHack.java index 18bf3d5e8..f6579238e 100644 --- a/src/classes/com/sun/opengl/impl/x11/DRIHack.java +++ b/src/classes/com/sun/opengl/impl/x11/DRIHack.java @@ -41,6 +41,7 @@ package com.sun.opengl.impl.x11; import java.io.*; import java.security.*; +import com.sun.gluegen.runtime.*; import com.sun.opengl.impl.*; /** @@ -70,19 +71,15 @@ import com.sun.opengl.impl.*; * necessary in any other situation than with the DRI drivers. Another * solution is to force the first load of libGL.so.1.2 to be done * dynamically with RTLD_GLOBAL before libjogl.so is loaded and causes - * libGL.so.1.2 to be loaded again. This requires the C APIs dlopen - * and dlclose to be made available before libjogl.so is loaded. This - * is the solution currently chosen and is called the "DRI hack" - * because again it is needed only in this situation. + * libGL.so.1.2 to be loaded again. The NativeLibrary class in the + * GlueGen runtime has this property, and we use it to implement this + * workaround. */ public class DRIHack { - public static native long dlopen(String name); - public static native int dlclose(long handle); - private static final boolean DEBUG = Debug.debug("DRIHack"); private static boolean driHackNeeded; - private static long libGLHandle; + private static NativeLibrary oglLib; public static void begin() { AccessController.doPrivileged(new PrivilegedAction() { @@ -102,34 +99,30 @@ public class DRIHack { System.err.println("Beginning DRI hack"); } - NativeLibLoader.loadDRIHack(); // Try a few different variants for best robustness // In theory probably only the first is necessary - libGLHandle = dlopen("libGL.so.1"); - if (DEBUG && libGLHandle != 0) System.err.println(" Found libGL.so.1"); - if (libGLHandle == 0) { - libGLHandle = dlopen("libGL.so.1.2"); - if (DEBUG && libGLHandle != 0) System.err.println(" Found libGL.so.1.2"); - } + oglLib = NativeLibrary.open("GL", null); + if (DEBUG && oglLib != null) System.err.println(" Found libGL.so"); // Allow ATI's fglrx to supersede version in /usr/lib - if (libGLHandle == 0) { - libGLHandle = dlopen("/usr/lib/ati-fglrx/libGL.so.1.2"); - if (DEBUG && libGLHandle != 0) System.err.println(" Found /usr/lib/ati-fglrx/libGL.so.1.2"); + if (oglLib == null) { + oglLib = NativeLibrary.open("/usr/lib/ati-fglrx/libGL.so.1.2", null); + if (DEBUG && oglLib != null) System.err.println(" Found /usr/lib/ati-fglrx/libGL.so.1.2"); } - if (libGLHandle == 0) { - libGLHandle = dlopen("/usr/lib/libGL.so.1"); - if (DEBUG && libGLHandle != 0) System.err.println(" Found /usr/lib/libGL.so.1"); + if (oglLib == null) { + oglLib = NativeLibrary.open("/usr/lib/libGL.so.1", null); + if (DEBUG && oglLib != null) System.err.println(" Found /usr/lib/libGL.so.1"); } } } public static void end() { - if (libGLHandle != 0) { + if (oglLib != null) { if (DEBUG) { System.err.println("Ending DRI hack"); } - dlclose(libGLHandle); + oglLib.close(); + oglLib = null; } } } |