From 2df3bea10859ee2f2c4b3622f3b610b17a5749d6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 13 Apr 2010 21:24:44 +0200 Subject: ATI (fglrx) PBuffer/X11Display bug workaround/cleanup - See https://bugzilla.mozilla.org/show_bug.cgi?id=486277 - Description: - To use PBuffer, a context must be current - X11Display cannot be switched while using the PBuffer [within one thread]. Hence we shall try harder to reuse _the_ user configured X11Display - whenever possible. This is actually a good thing, ie cleanup up our code again. - Changes to workaround/cleanup: - GLDrawableFactory* methods 'canCreate*()' are changed to 'canCreate*(AbstractGraphicsDevice)' to allow pipelining the X11Display. This reduces the overhead of using a local TLS X11Display. - WindowsDummyWGLDrawable cstr gets the GLProfile as a parameter now, this is done while adding X11DummyGLXDrawable - forseeing the usecase to query available GLProfiles at startup. - X11DummyGLXDrawable added, following the WindowsDummyWGLDrawable path to have a dummy GLContext current to fix the ATI bug. NativeWindow X11: - Add XIOErrorHandler to identify the fatal failure of closing a Display (-> ATI bug). Build: - Adding ant.jar and ant-junit.jar to the junit compile/run classpath - Misc: - Fix: CreateDummyWindow(..) returns a HWND, not a HDC - mapToRealGLFunctionName: Added mapping for X11/GLX. - X11GLXGraphicsConfigurationFactory: Uncommented dead code 'createDefaultGraphicsConfigurationFBConfig' Tests: Passed (Linux64bit: NVidia/ATI) Todo: More tests on ATI, especially multithreading/X11Display usage. --- src/jogl/classes/javax/media/opengl/GLDrawableFactory.java | 7 +++---- src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/jogl/classes/javax/media') diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index d61ceb1f4..71cb3cb3b 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -173,8 +173,7 @@ public abstract class GLDrawableFactory { destroy any GLContexts and GLDrawables that have been created and are still in use. No further OpenGL calls may be made after shutting down the GLDrawableFactory. */ - public void shutdown() { - } + public abstract void shutdown(); //---------------------------------------------------------------------- // Methods to create high-level objects @@ -218,7 +217,7 @@ public abstract class GLDrawableFactory { * Returns true if it is possible to create a GLPbuffer. Some older * graphics cards do not have this capability. */ - public abstract boolean canCreateGLPbuffer(); + public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device); /** * Creates a Pbuffer GLDrawable with the given capabilites and dimensions.

@@ -280,7 +279,7 @@ public abstract class GLDrawableFactory { * Returns true if it is possible to create an external GLDrawable * object via {@link #createExternalGLDrawable}. */ - public abstract boolean canCreateExternalGLDrawable(); + public abstract boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device); /** *

Creates a {@link GLDrawable} object representing an existing diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 43b2e1e1d..e8de00629 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -494,7 +494,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { backend = new J2DOGLBackend(); } else { if (!hardwareAccelerationDisabled && - factory.canCreateGLPbuffer()) { + factory.canCreateGLPbuffer(null)) { backend = new PbufferBackend(); } else { if (softwareRenderingDisabled) { @@ -1509,7 +1509,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { } } if (joglContext == null) { - if (factory.canCreateExternalGLDrawable()) { + AbstractGraphicsDevice device = j2dContext.getGLDrawable().getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice(); + if (factory.canCreateExternalGLDrawable(device)) { joglDrawable = factory.createExternalGLDrawable(); // FIXME: Need to share with j2d context, due to FBO resource .. // - ORIG: joglContext = joglDrawable.createContext(shareWith); @@ -1518,7 +1519,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { System.err.println("-- Created External Drawable: "+joglDrawable); System.err.println("-- Created Context: "+joglContext); } - } else if (factory.canCreateContextOnJava2DSurface()) { + } else if (factory.canCreateContextOnJava2DSurface(device)) { // Mac OS X code path // FIXME: Need to share with j2d context, due to FBO resource .. // - ORIG: joglContext = factory.createContextOnJava2DSurface(g, shareWith); -- cgit v1.2.3