Jogamp
Fix: Locking/Threading; Common IntIntHashMap and Buffers; Fix: glMap*Buffer*; GLX...
authorSven Gothel <sgothel@jausoft.com>
Thu, 10 Jun 2010 07:35:06 +0000 (09:35 +0200)
committerSven Gothel <sgothel@jausoft.com>
Thu, 10 Jun 2010 07:35:06 +0000 (09:35 +0200)
commit1d333a771ce0bc7c8594e21d031703f698f06a46
tree933d470582896320855fa1d98c1a917edc412c24
parent4512900ddcb9ce9a498411d257b1b6d6010ec006
Fix: Locking/Threading; Common IntIntHashMap and Buffers; Fix: glMap*Buffer*; GLX/WGL/CgGL: All runtime dynamic; Misc ..

TODO: Compile and test on MacOSX ..

Fix:
=====

Multithreading/Locking:
    See jogl/doc/Implementation/MultiThreading.txt

    - Locking layer is not platform agnostic, ie GLContextImpl, GLDrawableImpl, ..
      and NEWT: Window/Display
    - No more use of JAWT global lock necessary, removed.
    - No need for X11 Display lock, on the contrary,
      this made the NV driver hang.
    - Use common window/surface lock
    - All NativeWindow surfaceLock's are recursive now

glMapBuffer: If size is 0, don't do cont with the native call.
glMapBufferRange: Fix capacity.
glNamedBufferDataEXT: Track the size.
glMapNamedBufferEXT: Manual impl. - use the tracked size

glXGetVisualFromFBConfig, glXChooseFBConfig, glXChooseVisual: Instead of
ignoring and implement a renamed version (*Copied), we just use ManualImplementation
for the proper copy-result code.

DesktopGLDynamicLookupHelper: Initialize _hasGLBinding* attributes
in the determing loadGLJNILibrary() method, which is called by super().
Otherwise static init will overwrite them after the super() call.

X11GLXDrawableFactory: Don't release anything at shutdown (removed sharedContext.destroy()),
since this caused a freeze/SEGV sometimes.

Fixed NEWT's reparentWindow() functionality incl NewtCanvasAWT usage.
    - Native: if not visible, don't focus, etc
    - NewtCanvasAWT: Use the container size to start with
    - Run the command on the EDT

Using GlueGen's new DynamicLibraryBundle utility:
  - X11, Windows and MacOSX OpenGL adapted to DynamicLibraryBundleInfo.
  - X11GLXDynamicLookupHelper -> X11GLXDynamicLibraryBundleInfo
    - Remove all path from lib names.
    - GL order:  libGL.so.1, libGL.so, GL
    - shallLinkGlobal: true -> to server some 'old' DRI systems
        -> http://dri.sourceforge.net/doc/DRIuserguide.html
    - shallLookupGlobal: false
    - Try both : glXGetProcAddressARB and glXGetProcAddress
    - Using bootstrap: GLX.glXGetProcAddress(long glxGetProcAddressHandle, String glFuncName)

Found the issue with LIBGL_DRIVERS_PATH, ie if not set
no valid GL instance can be found (ie ATI fglrx/DRI).
This may happen if using a differen user than the desktop user
for whom the env var is set within some /etc/X11/Xsession.d/ script.

Enhancements:
=============

GLBufferSizeTracker: Use IntIntHashMap and add DirectState size tracking.
GLBufferStateTracker: Use IntIntHashMap.
GLStateTracker: Use IntIntHashMap.

GLDynamicLookupHelper: More generic (global loading/lookup and GetProcAddress function name list),
                       remove redundant code.
   FIXME:
    MacOSXCGLDynamicLookupHelper:
        - Not tested
        - Not using NSImage lookup anymore as recommended by OSX API Doc,
          so dlsym is used always (to be tested)

    WindowsWGLDynamicLookupHelper:
        - Not tested

GLX/WGL/CgGL is all runtime-dynamic as now, ie loaded and looked-up at runtime,
no compile time dependencies to GL anymore, nor a need to specify CgGL.

Split up WGL in GDI and WGL, to allow proper dynamic runtime linkage of OpenGL32
while using static binding to GDI32

NEWT events generated by native code are enqueued and not send directly.
This should ease locking mechanisms .. if any are necessary.

NEWT: More platform specific code moved to *Impl method,
simplifying the generic code of the superclass and impl protocol.

Cleanup:
=========

Replace all InternalBufferUtil's with com.jogamp.common.nio.Buffers

Removed all InternalBufferUtil's from repository

Removed GLContextImpl notion of 'optimized' surface locking,
where the surface gets unlocked during makeCurrent/release.
This just makes no sense and would impact multithreading in a horrible way.
168 files changed:
doc/Implementation/MultiThreading.txt [new file with mode: 0644]
make/build-jogl.xml
make/config/jogl/cg-common-CustomJavaCode.java
make/config/jogl/cg-common.cfg
make/config/jogl/cgl-macosx.cfg
make/config/jogl/egl.cfg
make/config/jogl/gdi-CustomCCode.c [moved from make/config/jogl/wgl-CustomCCode.c with 100% similarity]
make/config/jogl/gdi-win32.cfg [new file with mode: 0644]
make/config/jogl/gl-common.cfg
make/config/jogl/gl-desktop.cfg
make/config/jogl/gl-es1.cfg
make/config/jogl/gl-es2.cfg
make/config/jogl/gl-gl2es12.cfg
make/config/jogl/gl-gl4bc.cfg
make/config/jogl/gl-impl-CustomCCode-gl4bc.c
make/config/jogl/gl-impl-CustomJavaCode-gl2es12.java
make/config/jogl/gl-impl-CustomJavaCode-gl4.java [deleted file]
make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
make/config/jogl/gl-impl-CustomJavaCode-gles1.java
make/config/jogl/gl-impl-CustomJavaCode-gles2.java
make/config/jogl/gl3-desktop.cfg
make/config/jogl/glu-CustomJavaCode-base.java
make/config/jogl/glu-CustomJavaCode-gl2.java
make/config/jogl/glu-CustomJavaCode-gl2es1.java
make/config/jogl/glx-CustomCCode.c
make/config/jogl/glx-CustomJavaCode.java
make/config/jogl/glx-x11.cfg
make/config/jogl/glxext.cfg
make/config/jogl/wgl-win32.cfg
make/config/jogl/wglext.cfg
make/config/nativewindow/jawt-CustomJavaCode.java
make/config/nativewindow/x11-CustomJavaCode.java
make/jogl.compiler.xml
make/jogl.properties
make/nativewindow.compiler.xml
make/newt.compiler.xml
make/scripts/java-run-all.sh
make/scripts/java-run-newt.sh
make/scripts/make.jogl.all.linux-x86.sh
make/scripts/make.jogl.all.linux-x86_64.sh
make/scripts/make.jogl.all.win32.bat
make/scripts/make.jogl.all.win64.bat
make/stub_includes/egl/window-system1.c [moved from make/stub_includes/egl/window-system.c with 100% similarity]
make/stub_includes/macosx/window-system1.c [moved from make/stub_includes/macosx/window-system.c with 100% similarity]
make/stub_includes/win32/window-system0.c [moved from make/stub_includes/win32/window-system.c with 100% similarity]
make/stub_includes/win32/window-system1.c [new file with mode: 0644]
make/stub_includes/win32/windows.h
make/stub_includes/win32/wingdi.h
make/stub_includes/win32/winwgl.h [new file with mode: 0644]
make/stub_includes/x11/window-system1.c [moved from make/stub_includes/x11/window-system.c with 100% similarity]
src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java [new file with mode: 0644]
src/jogl/classes/com/jogamp/opengl/impl/DesktopGLDynamicLibraryBundleInfo.java [new file with mode: 0755]
src/jogl/classes/com/jogamp/opengl/impl/DesktopGLDynamicLookupHelper.java
src/jogl/classes/com/jogamp/opengl/impl/GLBufferSizeTracker.java
src/jogl/classes/com/jogamp/opengl/impl/GLBufferStateTracker.java
src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java
src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
src/jogl/classes/com/jogamp/opengl/impl/GLDynamicLibraryBundleInfo.java [new file with mode: 0755]
src/jogl/classes/com/jogamp/opengl/impl/GLDynamicLookupHelper.java
src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java
src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
src/jogl/classes/com/jogamp/opengl/impl/GLStateTracker.java
src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javame_cdc_fp [deleted file]
src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javase [deleted file]
src/jogl/classes/com/jogamp/opengl/impl/ProjectFloat.java
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java [moved from src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java with 50% similarity]
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java [moved from src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java with 71% similarity]
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java [moved from src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java with 71% similarity]
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java
src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/gl2/ProjectDouble.java
src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/BuildMipmap.java
src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java
src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ScaleInternal.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java [moved from src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDynamicLookupHelper.java with 57% similarity]
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java [new file with mode: 0644]
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/GLXUtil.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDynamicLibraryBundleInfo.java [moved from src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLookupHelper.java with 55% similarity]
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDynamicLookupHelper.java [deleted file]
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXContext.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
src/jogl/classes/com/jogamp/openmax/OMXInstance.java
src/jogl/classes/javax/media/opengl/GLContext.java
src/jogl/classes/javax/media/opengl/GLDrawable.java
src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
src/jogl/classes/javax/media/opengl/GLProfile.java
src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
src/junit/com/jogamp/test/junit/newt/TestParenting01AWT.java
src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java
src/junit/com/jogamp/test/junit/newt/TestParentingAWT.java [new file with mode: 0755]
src/nativewindow/classes/com/jogamp/nativewindow/impl/InternalBufferUtil.java [deleted file]
src/nativewindow/classes/com/jogamp/nativewindow/impl/LockingNativeWindowFactory.java [deleted file]
src/nativewindow/classes/com/jogamp/nativewindow/impl/NativeWindowFactoryImpl.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/NullWindow.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/RecursiveToolkitLock.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTWindow.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/awt/X11AWTNativeWindowFactory.java [deleted file]
src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java
src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java [deleted file]
src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java
src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java
src/nativewindow/native/x11/Xmisc.c
src/newt/classes/com/jogamp/newt/Display.java
src/newt/classes/com/jogamp/newt/Window.java
src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java
src/newt/classes/com/jogamp/newt/impl/intel/gdl/Window.java
src/newt/classes/com/jogamp/newt/impl/macosx/MacWindow.java
src/newt/classes/com/jogamp/newt/impl/opengl/kd/KDWindow.java
src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java
src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java
src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
src/newt/native/KDWindow.c
src/newt/native/NewtMacWindow.m
src/newt/native/WindowsWindow.c
src/newt/native/X11Window.c
http://JogAmp.org git info: FAQ, tutorial and man pages.