Bug 138

Summary: applications should be abled to decide whether ATI workaround is used
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED WONTFIX    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: all   
Type: FEATURE SCM Refs:
Workaround: ---

Description Sven Gothel 2010-03-24 07:47:26 CET


---- Reported by s_koehler 2005-02-11 20:11:02 ----

An application should be abled to override the ATI-workaround setting specified
by a systemproperty or detected by JOGL.

Here is a patch, how the problem may be solved:


package net.java.games.jogl.impl;

public class SingleThreadedWorkaround
{
	private static final Boolean sysPrep;

	private static boolean shouldValue = false;
	private static Boolean appValue = null;

	private static volatile boolean actualValue;

	static
	{
		String workaround;
		workaround = System.getProperty("ATI_WORKAROUND", "");
		workaround = System.getProperty("JOGL_SINGLE_THREADED_WORKAROUND", workaround);
		workaround = workaround.trim();

		sysPrep = (workaround.length() > 0) ? Boolean.valueOf(workaround) : null;

		calcActualValue();
	}

	static synchronized void shouldDoWorkaround()
	{
		shouldValue = true;
		calcActualValue();
	}

	public static synchronized void overrideWorkaround(Boolean ovr)
	{
		appValue = ovr;
		calcActualValue();
	}

	private static synchronized void calcActualValue()
	{
		if (appValue != null)
		{
			actualValue = appValue.booleanValue();
		}
		else if (sysPrep != null)
		{
			actualValue = sysPrep.booleanValue();
		}
		else
		{
			actualValue = shouldValue;
		}
	}

	public static boolean doWorkaround()
	{
		return actualValue;
	}
}



---- Additional Comments From kbr 2005-02-12 11:39:35 ----

I'm reluctant to add additional complexity to something which is an artifact of
some vendors' OpenGL driver instability. Why can't the application simply set
the system property JOGL_SINGLE_THREADED_WORKAROUND in main()? Please help me
understand why additional code is needed here.




---- Additional Comments From s_koehler 2005-02-12 12:31:20 ----

I was just to stupid to see that i can set the system property, and therefor
override the value for the ATI workaround. You can either mark this Issue as
INVALID or use the patch supplied. I'm fine with both sollutions.



---- Additional Comments From kbr 2005-02-12 14:29:01 ----

Don't worry about it -- it is a valid issue for applications running in the
sandbox because they typically do not have permission to call
System.setProperty(). However, Java Web Start lets applications set system
properties in the JNLP file, which I think is an acceptable solution and which
has been used in all of the JOGL demos, at least for the sun.java2d.noddraw
property. I'm going to mark this as "won't fix", but if it becomes an issue
again please either reopen this bug or file a new one.




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:47 EDT  ---

This bug was previously known as _bug_ 138 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=138