summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java37
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java13
3 files changed, 13 insertions, 40 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
index ce2e824f5..0a603ab8a 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
@@ -71,10 +71,9 @@ public class EGLDisplayUtil {
Thread.dumpStack();
}
if( eglDisplayCounter.size() > 0) {
- EGLDisplayUtil.dumpOpenDisplayConnections();
+ dumpOpenDisplayConnections();
}
}
-
return eglDisplayCounter.size();
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index e1e25be67..bdccc1047 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -172,7 +172,6 @@ public abstract class X11GLXContext extends GLContextImpl {
glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, ctx);
}
-
private static final int ctx_arb_attribs_idx_major = 0;
private static final int ctx_arb_attribs_idx_minor = 2;
private static final int ctx_arb_attribs_idx_flags = 6;
@@ -228,14 +227,14 @@ public abstract class X11GLXContext extends GLContextImpl {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
- long display = device.getHandle();
+ final long display = device.getHandle();
try {
// critical path, a remote display might not support this command,
// hence we need to catch the X11 Error within this block.
- X11Lib.XSync(display, false);
+ X11Util.setX11ErrorHandler(true, DEBUG ? false : true); // make sure X11 error handler is set
ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs);
- X11Lib.XSync(display, false);
+ if(DEBUG) { X11Lib.XSync(display, false); }
} catch (RuntimeException re) {
if(DEBUG) {
Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re);
@@ -263,16 +262,6 @@ public abstract class X11GLXContext extends GLContextImpl {
@Override
protected boolean createImpl(GLContextImpl shareWith) {
- // covers the whole context creation loop incl createContextARBImpl and destroyContextARBImpl
- X11Util.setX11ErrorHandler(true, DEBUG ? false : true);
- try {
- return createImplRaw(shareWith);
- } finally {
- X11Util.setX11ErrorHandler(false, false);
- }
- }
-
- private boolean createImplRaw(GLContextImpl shareWith) {
boolean direct = true; // try direct always
isDirect = false; // fall back
@@ -401,14 +390,9 @@ public abstract class X11GLXContext extends GLContextImpl {
protected void makeCurrentImpl() throws GLException {
long dpy = drawable.getNativeSurface().getDisplayHandle();
- if (GLX.glXGetCurrentContext() != contextHandle) {
- X11Util.setX11ErrorHandler(true, DEBUG ? false : true);
- try {
- if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException(getThreadName()+": Error making context current: "+this);
- }
- } finally {
- X11Util.setX11ErrorHandler(false, false);
+ if (GLX.glXGetCurrentContext() != contextHandle) {
+ if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
+ throw new GLException(getThreadName()+": Error making context current: "+this);
}
}
}
@@ -416,13 +400,8 @@ public abstract class X11GLXContext extends GLContextImpl {
@Override
protected void releaseImpl() throws GLException {
long display = drawable.getNativeSurface().getDisplayHandle();
- X11Util.setX11ErrorHandler(true, DEBUG ? false : true);
- try {
- if (!glXMakeContextCurrent(display, 0, 0, 0)) {
- throw new GLException(getThreadName()+": Error freeing OpenGL context");
- }
- } finally {
- X11Util.setX11ErrorHandler(false, false);
+ if (!glXMakeContextCurrent(display, 0, 0, 0)) {
+ throw new GLException(getThreadName()+": Error freeing OpenGL context");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index ca5cd424b..03c661565 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -47,7 +47,6 @@ import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.AbstractGraphicsScreen;
import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
import javax.media.nativewindow.ProxySurface;
import javax.media.nativewindow.UpstreamSurfaceHook;
import javax.media.nativewindow.VisualIDHolder;
@@ -230,11 +229,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
@Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
- final X11GraphicsDevice sharedDevice =
- new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT,
- true); // own non-shared display connection, w/ locking
- // new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT,
- // NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, w/o locking
+ final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true);
sharedDevice.lock();
try {
final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, sharedDevice.getDefaultScreen());
@@ -509,8 +504,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) {
final X11GraphicsDevice device;
if(createNewDevice) {
- // Null X11 locking, due to private non-shared Display handle
- device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), NativeWindowFactory.getNullToolkitLock(), true);
+ // Null X11 resource locking, due to private non-shared Display handle
+ device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true);
} else {
device = (X11GraphicsDevice)deviceReq;
}
@@ -531,7 +526,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
@Override
protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) {
- final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), NativeWindowFactory.getNullToolkitLock(), true);
+ final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true);
final X11GraphicsScreen screen = new X11GraphicsScreen(device, screenIdx);
final int xvisualID = X11Lib.GetVisualIDFromWindow(device.getHandle(), windowHandle);
if(VisualIDHolder.VID_UNDEFINED == xvisualID) {