Skip to content

Commit

Permalink
JOGL: Reenable Applet/Webstart/RCP support for JOGL + AWT + X11
Browse files Browse the repository at this point in the history
Changed GLProfile/NativeWindowFactory/.. initialization methodology:

    GLProfile:
        public static synchronized void initSingleton(final boolean firstUIActionOnProcess);

    NativeWindowFactory:
        public static synchronized void initSingleton(final boolean firstUIActionOnProcess);

+++

Introducing NativeWindow ToolkitLock, implementations are
    NullToolkitLock
    JAWTToolkitLock
    X11JAWTToolkitLock
    X11ToolkitLock

AbstractGraphicsDevice provides generic global toolkit locking methods,
implemented by the ToolkitLock interface.

ToolkitLock's are aggregated in NativeWindow's DefaultGraphicsDevice
to implement it's superclass lock()/unlock() methods.

This enables a device specific locking strategy, ie on X11/AWT utilizing
JAWT && X11 locking, and maybe none for others (NEWT).

No locking is required for X11 / AWT, in case the above mentioned
initialization happened as a 'firstUIActionOnProcess'.

The ToolkitLock factory is currently a hardcoded part of NativeWindowFactory.
We may have to allow 3rd party NativeWindow implementations
to register custom ones.

+++

com.jogamp.opengl.impl.GLDrawableImpl cleanup:
  Dealing with all locking code, providing all public methods. Exceptions are commented.
  Specializations x11/windows/.. only contains platform code.
  Pulled down access qualifiers if possible public -> protected.

com.jogamp.nativewindow.impl.x11.X11Util
  Wrapping all X11Lib method with the new locking code.

com.jogamp.nativewindow.impl.jawt.JAWTUtil
  Utilize global SunToolkit.awtLock() is available,
  the fallback to global JAWT.lock().
  The latter just invokes the first.

javax.media.nativewindow.awt.AWTGraphicsDevice
    setHandle(long handle) -> setSubType(String type, long handle)
    which also resets the ToolkitLock respecting the new type.
    This ensures correct locking after the sub type has been determined,
    ie AWT using an X11 peer.

+++

Misc Changes done on the way ..

GLCanvas:
    Fixed inversed this.drawableHelper.isExternalAnimatorAnimating() condition,
    which disabled normal repaint.

GLJPanel:
    Removed drawableHelper.isExternalAnimatorAnimating() condition,
    which disabled painting, since the animation thread just updates the source image.

NEWT WindowImpl:
    When reparenting back to parent and 'refit' child if it's size exceeds it's parent.
    More 'Fix: Memory consumption' commit 6ced17f.

NEWTEvent:
    Removed code to evaluate the 'system event' attribute, need to find a better approach.
  • Loading branch information
sgothel committed Oct 14, 2010
1 parent d7faeb8 commit 7741385
Show file tree
Hide file tree
Showing 107 changed files with 1,827 additions and 834 deletions.
39 changes: 33 additions & 6 deletions doc/Implementation/runtime-properties.txt
@@ -1,4 +1,23 @@
../doc/Implementation/properties/jogl.debug.all.txt
../doc/Implementation/runtime-properties-temp/gluegen-rt.debug.txt
----------------------------------------
jogamp.debug.JNILibLoader
jogamp.debug.JVMUtil
jogamp.debug.Lock
jogamp.debug.ReflectionUtil



../doc/Implementation/runtime-properties-temp/gluegen-rt.ipd.debug.txt
----------------------------------------
jnlp.launcher.class
jogamp.common.utils.locks.Lock.timeout
jogamp.debug.Lock.TraceLock
sun.boot.library.path
sun.jnlp.applet.launcher



../doc/Implementation/runtime-properties-temp/jogl.debug.all.txt
----------------------------------------
jogl.debug.Animator
jogl.debug.BuildMipmap
Expand All @@ -22,23 +41,26 @@



../doc/Implementation/properties/jogl.ipd.debug.txt
../doc/Implementation/runtime-properties-temp/jogl.ipd.debug.txt
----------------------------------------
jogl.1thread
jogl.debug.ExtensionAvailabilityCache
jogl.debug.GLDrawable.profiling
jogl.debug.GLSLCode
jogl.debug.GLSLState
jogl.debug.TextRenderer
jogl.glcontext.forcetracking
jogl.gldrawablefactory.class.name
jogl.gljpanel.nohw
jogl.gljpanel.noogl
jogl.gljpanel.nosw
jogl.screenchange.action
jogl.texture.nonpot
jogl.texture.notexrect



../doc/Implementation/properties/nativewindow.debug.txt
../doc/Implementation/runtime-properties-temp/nativewindow.debug.txt
----------------------------------------
nativewindow.debug.DefaultCapabilitiesChooser
nativewindow.debug.GraphicsConfiguration
Expand All @@ -48,12 +70,14 @@



../doc/Implementation/properties/nativewindow.ipd.debug.txt
../doc/Implementation/runtime-properties-temp/nativewindow.ipd.debug.txt
----------------------------------------
java.awt.headless
nativewindow.ws.name



../doc/Implementation/properties/newt.debug.txt
../doc/Implementation/runtime-properties-temp/newt.debug.txt
----------------------------------------
newt.debug.Display
newt.debug.EDT
Expand All @@ -65,10 +89,13 @@



../doc/Implementation/properties/newt.ipd.debug.txt
../doc/Implementation/runtime-properties-temp/newt.ipd.debug.txt
----------------------------------------
newt.MainThread.force
newt.test.EDTMainThread
newt.test.Window.reparent.incompatible
newt.ws.sheight
newt.ws.swidth



11 changes: 9 additions & 2 deletions make/build-junit.xml
Expand Up @@ -99,9 +99,12 @@
<condition property="jvmarg.newt" value="-Djava.awt.headless=true"><not><isset property="isOSX"/></not></condition>

<!-- Test*CORE* -->
<junit forkmode="once" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
<junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
<env key="${system.env.library.path}" path="${obj.all.paths}"/>
<jvmarg value="-Djava.library.path=${obj.all.paths}"/>
<!--
<jvmarg value="-Dnewt.debug.EDT"/>
-->

<formatter usefile="false" type="plain"/>
<formatter usefile="true" type="xml"/>
Expand Down Expand Up @@ -153,6 +156,9 @@
<env key="CLASSPATH" value="${junit_jogl_newt.run.jars}"/>
<arg value="-Djava.library.path=${obj.all.paths}"/>
<arg line="${jvmarg.newt}"/>
<!--
<arg line="-Dnewt.debug.EDT"/>
-->
<arg line="com.jogamp.newt.util.MainThread"/>
<arg line="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner"/>
<srcfile/>
Expand All @@ -174,11 +180,12 @@
</for>

<!-- Test*AWT* -->
<junit forkmode="once" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
<junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
<env key="${system.env.library.path}" path="${obj.all.paths}"/>
<jvmarg value="-Djava.library.path=${obj.all.paths}"/>

<!--
<jvmarg value="-Dnewt.debug.EDT"/>
<jvmarg value="-Djogl.debug=all"/>
<jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
<jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
Expand Down
3 changes: 0 additions & 3 deletions make/config/nativewindow/x11-CustomJavaCode.java
@@ -1,6 +1,3 @@
static {
X11Util.initSingleton(); // ensure it's loaded and setup
}

/** Interface to C language function: <br> <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */
public static XVisualInfo[] XGetVisualInfo(long arg0, long arg1, XVisualInfo arg2, int[] arg3, int arg3_offset)
Expand Down
6 changes: 4 additions & 2 deletions make/scripts/java-run-all.sh
Expand Up @@ -43,12 +43,14 @@ uname -a | grep -i Darwin && MOSX=1
# D_ARGS="-Dnativewindow.debug.X11Util=true"
# D_ARGS="-Dnewt.debug=all -Dnativewindow.debug=all"
# D_ARGS="-Djogl.debug=all -Dnewt.debug=all -Dnativewindow.debug=all"
# D_ARGS="-Dnewt.debug=all -Dnativewindow.debug=all -Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
# D_ARGS="-Dnewt.debug=all -Dnativewindow.debug=all -Djogamp.common.utils.locks.Lock.timeout=600000"
# D_ARGS="-Dnewt.debug=all"
# D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT"
# D_ARGS="-Dnewt.debug.EDT -Dnewt.debug.Window"
# D_ARGS="-Dsun.awt.disableMixing=true -Dnewt.debug.EDT"
# D_ARGS="-Dnewt.debug.EDT"
# D_ARGS="-Dnativewindow.debug.TraceLock"
D_ARGS="-Dnewt.debug.EDT -Dnativewindow.TraceLock"
# D_ARGS="-Djogamp.debug.TraceLock"
# D_ARGS="-Dnewt.debug.Display"
# D_ARGS="-Djogl.debug.Animator -Dnewt.debug.Window -Dnewt.debug.Display"
# D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.test.Window.reparent.incompatible=true"
Expand Down
4 changes: 2 additions & 2 deletions make/scripts/java-win64-dbg.bat
Expand Up @@ -14,10 +14,10 @@ set CP_ALL=.;%BLD_DIR%\jogl\jogl.all.jar;%BLD_DIR%\nativewindow\nativewindow.all
echo CP_ALL %CP_ALL%

REM set D_ARGS="-Djogamp.debug.JNILibLoader=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true" "-Djogl.debug.GLProfile=true"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.Lock" "-Djogamp.debug.Lock.TraceLock"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnativewindow.debug.TraceLock"
REM set D_ARGS="-Dnativewindow.debug.TraceLock"
set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.test.Window.reparent.incompatible=true"

set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true"
Expand Down
1 change: 1 addition & 0 deletions make/scripts/make.jogl.all.linux-x86_64.sh
Expand Up @@ -55,6 +55,7 @@ echo LIBGL_DEBUG: $LIBGL_DEBUG 2>&1 | tee -a $LOGF
ant \
$CUSTOMLIBDIR \
-Dbuild.noarchives=true \
-Dc.compiler.debug=true \
-Djogl.cg=1 \
-Drootrel.build=build-x86_64 \
-DuseKD=true \
Expand Down
23 changes: 11 additions & 12 deletions make/scripts/tests.bat
@@ -1,19 +1,18 @@
REM #com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsNEWT -time 30000
REM #com.jogamp.test.junit.jogl.acore.TestGLProfile01CORE
REM #com.jogamp.test.junit.newt.TestParenting01AWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsNEWT -time 30000
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.acore.TestGLProfile01CORE
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestParenting01AWT

REM # ./scripts/java-run-all.sh ../build-x86_64

REM # ./scripts/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting01cAWT -time 50000
REM # ./scripts/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestDisplayLifecycle01NEWT
REM # ./scripts/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestListenerCom01AWT
REM # ./scripts/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.parenting.TestParenting01cAWT -time 50000
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestDisplayLifecycle01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestListenerCom01AWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.parenting.TestParenting01NEWT

REM # ./scripts/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestGLWindows01NEWT
REM # ./scripts/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestGLWindows02NEWTAnimated
scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestGLWindows01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestGLWindows02NEWTAnimated
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.parenting.TestParenting01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestFocus02SwingAWTRobot
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestFocus01SwingAWTRobot
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.nativewindow.TestRecursiveToolkitLockCORE
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.parenting.TestParenting03AWT

scripts\java-win32.bat com.jogamp.test.junit.newt.TestFocus02SwingAWTRobot
REM scripts\java-win32.bat com.jogamp.test.junit.newt.TestFocus02SwingAWTRobot
12 changes: 9 additions & 3 deletions make/scripts/tests.sh
Expand Up @@ -4,17 +4,20 @@ rm -f java-run.log

spath=`dirname $0`

#com.jogamp.test.junit.jogl.acore.TestGLProfile01CORE
#com.jogamp.test.junit.newt.TestParenting01AWT

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.jogl.acore.TestGLProfile01NEWT $*

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsAWT $*
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsNEWT $*
# $spath/java-run-all.sh ../build-x86_64 -Djava.awt.headless=true com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsNEWT $*

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestDisplayLifecycle01NEWT $*

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestListenerCom01AWT $*

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestGLWindows01NEWT $*
# $spath/java-run-all.sh ../build-x86_64 -Djava.awt.headless=true com.jogamp.test.junit.newt.TestGLWindows01NEWT $*
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestGLWindows02NEWTAnimated $*

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.jogl.offscreen.TestOffscreen01NEWT $*
Expand All @@ -26,12 +29,15 @@ spath=`dirname $0`
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting01bAWT $*
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting01cAWT $*
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting01cSwingAWT $*
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting02AWT $*
$spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting02AWT $*
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.parenting.TestParenting03AWT $*

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.jogl.awt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 $*
# $spath/java-run-all.sh ../build-x86_64 -Dnativewindow.TraceLock=true com.jogamp.test.junit.jogl.awt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 $*

# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestFocus01SwingAWTRobot $*
$spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestFocus02SwingAWTRobot $*
# $spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestFocus02SwingAWTRobot $*

$spath/java-run-all.sh ../build-x86_64 com.jogamp.test.junit.newt.TestEventSourceNotAWTBug $*

$spath/count-edt-start.sh java-run.log
4 changes: 2 additions & 2 deletions src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
Expand Up @@ -122,7 +122,7 @@ public GL setGL(GL gl) {
if(DEBUG) {
String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():"<null>";
String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():"<null>";
Exception e = new Exception("setGL (OpenGL "+getGLVersion()+"): "+Thread.currentThread()+", "+sgl1+" -> "+sgl2);
Exception e = new Exception("Info: setGL (OpenGL "+getGLVersion()+"): "+Thread.currentThread()+", "+sgl1+" -> "+sgl2);
e.printStackTrace();
}
this.gl = gl;
Expand Down Expand Up @@ -1053,7 +1053,7 @@ public Version(String versionString)
e.printStackTrace();
// FIXME: refactor desktop OpenGL dependencies and make this
// class work properly for OpenGL ES
System.err.println("ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.<init>: "+e);
System.err.println("Info: ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.<init>: "+e);
major = 1;
minor = 0;
/*
Expand Down

0 comments on commit 7741385

Please sign in to comment.