From 27fe889023c7366e264647e5dc25053f22df0956 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 28 Sep 2012 18:59:11 +0200 Subject: Adding Mesa Quirk 'NoSetSwapIntervalPostRetarget': SIGSEGV on setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel) Analyzing 'TestGLContextDrawableSwitchNEWT' crash at setSwapInterval -> dri2SetSwapInterval after retargeting the context (new drawable association). Turns out Mesa's dri2SetSwapInterval may have a bug. +++ GLContext TRACE_SWITCH: Add drawable handle to debug/trace output. --- src/jogl/classes/javax/media/opengl/GLContext.java | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/jogl/classes/javax') diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 93b9bfe82..1cee0209c 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -162,6 +162,9 @@ public abstract class GLContext { private int currentSwapInterval; protected GLRendererQuirks glRendererQuirks; + /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */ + protected boolean drawableRetargeted; + protected void resetStates() { if (DEBUG) { System.err.println(getThreadName() + ": GLContext.resetStates()"); @@ -175,6 +178,7 @@ public abstract class GLContext { contextHandle=0; currentSwapInterval = -1; glRendererQuirks = null; + drawableRetargeted = false; } /** @@ -781,8 +785,8 @@ public abstract class GLContext { } /** - * Set the swap interval if the current context. - * @param interval Should be ≥ 0. 0 Disables the vertical synchronisation, + * Set the swap interval of the current context and attached drawable. + * @param interval Should be ≥ 0. 0 disables the vertical synchronization, * where ≥ 1 is the number of vertical refreshes before a swap buffer occurs. * A value < 0 is ignored. * @return true if the operation was successful, otherwise false @@ -792,9 +796,11 @@ public abstract class GLContext { public final boolean setSwapInterval(int interval) throws GLException { validateCurrent(); if(0<=interval) { - if( setSwapIntervalImpl(interval) ) { - currentSwapInterval = interval; - return true; + if( !drawableRetargeted || !hasRendererQuirk(GLRendererQuirks.NoSetSwapIntervalPostRetarget) ) { + if( setSwapIntervalImpl(interval) ) { + currentSwapInterval = interval; + return true; + } } } return false; @@ -808,15 +814,12 @@ public abstract class GLContext { * the default value -1 is returned. *

*

- * The default value for a valid context is 1 for - * an EGL based profile (ES1 or ES2) and -1 (undefined) - * for desktop. + * For a valid context the default value is 1 + * in case of an EGL based profile (ES1 or ES2) and -1 + * (undefined) for desktop. *

*/ public final int getSwapInterval() { - if(-1 == currentSwapInterval && this.isGLES()) { - currentSwapInterval = 1; - } return currentSwapInterval; } protected final void setDefaultSwapInterval() { -- cgit v1.2.3