Skip to content

Commit

Permalink
GLRendererQuirks: Add GLSharedContextBuggy ('Mesa Intel 9.2.1' and 'H…
Browse files Browse the repository at this point in the history
…isilicon Immersion.16')

Note: Even though Mesa Intel driver crashes w/ heavy multithreading (Bug 873),
it works well w/ our multithreaded GLMediaPlayer.
  • Loading branch information
sgothel committed Nov 1, 2013
1 parent f4574bf commit 3ed74ab
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 8 deletions.
43 changes: 40 additions & 3 deletions src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
Expand Up @@ -192,21 +192,58 @@ public class GLRendererQuirks {
public static final int GLSLNonCompliant = 12;

/**
* GL4 context needs to be requested via GL3
* GL4 context needs to be requested via GL3 profile attribute
* <ul>
* <li>OSX >= 10.9.0 - kCGLOGLPVersion_GL4_Core may not produce hw-accel context. Bug 867 @ https://jogamp.org/bugzilla/.</li>
* </ul>
*/
public static final int GL4NeedsGL3Request = 13;

/**
* Buggy shared OpenGL context support within a multithreaded use-case, not suitable for stable usage.
* <p>
* <i>X11 Mesa DRI Intel(R) driver >= 9.2.1</i> cannot handle multithreaded shared GLContext usage
* with non-blocking exclusive X11 display connections.
* References:
* <ul>
* <li>Bug 873: https://jogamp.org/bugzilla/show_bug.cgi?id=873</li>
* <li>https://bugs.freedesktop.org/show_bug.cgi?id=41736#c8</li>
* </ul>
* <p>
* However, not all multithreaded use-cases are broken, e.g. our GLMediaPlayer does work.
* </p>
* The above has been confirmed for the following Mesa 9.* strings:
* <ul>
* <li>GL_VENDOR Intel Open Source Technology Center</li>
* <li>GL_RENDERER Mesa DRI Intel(R) Sandybridge Desktop</li>
* <li>GL_RENDERER Mesa DRI Intel(R) Ivybridge Mobile</li>
* <li>GL_VERSION 3.1 (Core Profile) Mesa 9.2.1</li>
* </ul>
* </p>
* <p>
* On Android 4.*, <i>Huawei's Ascend G615 w/ Immersion.16</i> could not make a shared context
* current, which uses a pbuffer drawable:
* <ul>
* <li>Android 4.*</li>
* <li>GL_VENDOR Hisilicon Technologies</li>
* <li>GL_RENDERER Immersion.16</li>
* <li>GL_VERSION OpenGL ES 2.0</li>
* </ul>
* </p>
* <p>
* </p>
*/
public static final int GLSharedContextBuggy = 14;

/** Number of quirks known. */
public static final int COUNT = 14;
public static final int COUNT = 15;

private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval",
"NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard",
"GLNonCompliant", "GLFlushBeforeRelease", "DontCloseX11Display",
"NeedCurrCtx4ARBPixFmtQueries", "NeedCurrCtx4ARBCreateContext",
"NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request"
"NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request",
"GLSharedContextBuggy"
};

private static final IdentityHashMap<String, GLRendererQuirks> stickyDeviceQuirks = new IdentityHashMap<String, GLRendererQuirks>();
Expand Down
28 changes: 23 additions & 5 deletions src/jogl/classes/jogamp/opengl/GLContextImpl.java
Expand Up @@ -1638,9 +1638,11 @@ private final void setRendererQuirks(final AbstractGraphicsDevice adevice,

final String MesaSP = "Mesa ";
// final String MesaRendererAMDsp = " AMD ";
// final String MesaRendererIntelsp = "Intel(R)";
final String MesaRendererIntelsp = "Intel(R)";
final boolean hwAccel = 0 == ( ctp & GLContext.CTX_IMPL_ACCEL_SOFT );
final boolean compatCtx = 0 != ( ctp & GLContext.CTX_PROFILE_COMPAT );
final boolean isX11 = NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true);
final boolean isWindows = Platform.getOSType() == Platform.OSType.WINDOWS;
final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ");
final boolean isDriverATICatalyst = !isDriverMesa && ( glVendor.contains("ATI Technologies") || glRenderer.startsWith("ATI ") );
final boolean isDriverNVIDIAGeForce = !isDriverMesa && ( glVendor.contains("NVIDIA Corporation") || glRenderer.contains("NVIDIA ") );
Expand Down Expand Up @@ -1687,7 +1689,7 @@ private final void setRendererQuirks(final AbstractGraphicsDevice adevice,
quirks[i++] = quirk;
}
}
} else if( Platform.getOSType() == Platform.OSType.WINDOWS ) {
} else if( isWindows ) {
//
// WINDOWS
//
Expand Down Expand Up @@ -1731,12 +1733,19 @@ private final void setRendererQuirks(final AbstractGraphicsDevice adevice,
}
quirks[i++] = quirk;
}
if( glRenderer.contains("Immersion.16") ) {
final int quirk = GLRendererQuirks.GLSharedContextBuggy;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType() + " / Renderer " + glRenderer);
}
quirks[i++] = quirk;
}
}

//
// Windowing Toolkit related quirks
//
if( NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) {
if( isX11 ) {
//
// X11
//
Expand Down Expand Up @@ -1775,6 +1784,8 @@ private final void setRendererQuirks(final AbstractGraphicsDevice adevice,
// RENDERER related quirks
//
if( isDriverMesa ) {
final VersionNumber mesaIntelBuggySharedCtx921 = new VersionNumber(9, 2, 1);

{
final int quirk = GLRendererQuirks.NoSetSwapIntervalPostRetarget;
if(DEBUG) {
Expand All @@ -1798,8 +1809,15 @@ private final void setRendererQuirks(final AbstractGraphicsDevice adevice,
}
quirks[i++] = quirk;
}
if( Platform.getOSType() == Platform.OSType.WINDOWS && glRenderer.contains("SVGA3D") )
{
if( glRenderer.contains( MesaRendererIntelsp ) &&
vendorVersion.compareTo(mesaIntelBuggySharedCtx921) >= 0 && isX11 ) {
final int quirk = GLRendererQuirks.GLSharedContextBuggy;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 / Renderer " + glRenderer + " / Mesa-Version "+vendorVersion);
}
quirks[i++] = quirk;
}
if( isWindows && glRenderer.contains("SVGA3D") ) {
final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0);
if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero()
final int quirk = GLRendererQuirks.NoFullFBOSupport;
Expand Down

0 comments on commit 3ed74ab

Please sign in to comment.