Bug 736123 - short-term fix: blacklist adreno using the global GLContext to get renderer info - r=bgirard

It really works, but it's not future-proof as it relies on the global GL context that's going away soon. But it probably won't go away in Aurora 14, so this should at least allow us to ship Fennec 14.

Longer term, we need to do some message passing so we can get the LayerManager's OpenGL context's renderer id, from the OMTC thread.
This commit is contained in:
Benoit Jacob 2012-05-08 15:55:52 -04:00
parent 17aafdc748
commit 725ba8f732
2 changed files with 35 additions and 14 deletions

View File

@ -501,6 +501,41 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
}
#endif
#ifdef ANDROID
// bug 736123, blacklist WebGL on Adreno
//
// The Adreno driver in WebGL context creation, specifically in the first MakeCurrent
// call on the newly created OpenGL context.
//
// Notice that we can't rely on GfxInfo for this blacklisting,
// as GfxInfo on Android currently doesn't know the GL strings, which are,
// AFAIK, the only way to identify Adreno GPUs.
//
// Somehow, the Layers' OpenGL context creation doesn't crash, and neither does
// the global GL context creation. So we currently use the Renderer() id from the
// global context. This is not future-proof, as the plan is to get rid of the global
// context soon with OMTC. We need to replace this by getting the renderer id from
// the Layers' GL context, but as with OMTC the LayerManager lives on a different
// thread, this will have to involve some message-passing.
if (!forceEnabled) {
GLContext *globalContext = GLContextProvider::GetGlobalContext();
if (!globalContext) {
// make sure that we don't forget to update this code once the globalContext
// is removed
NS_RUNTIMEABORT("No global context anymore? Then you need to update "
"this code, or force-enable WebGL.");
}
int renderer = globalContext->Renderer();
if (renderer == gl::GLContext::RendererAdreno200 ||
renderer == gl::GLContext::RendererAdreno205)
{
LogMessage("WebGL blocked on this Adreno driver!");
return NS_ERROR_FAILURE;
}
}
#endif
// if we're forcing osmesa, do it first
if (forceOSMesa) {
gl = gl::GLContextProviderOSMesa::CreateOffscreen(gfxIntSize(width, height), format);

View File

@ -632,20 +632,6 @@ WebGLContext::InitAndValidateGL()
return false;
}
#ifdef ANDROID
// bug 736123, blacklist WebGL on Adreno because they do not implement
// glTexSubImage2D in a way that is safe to expose to WebGL </euphemism>
// We don't rely on GfxInfo for this blacklisting, because GfxInfo on Android doesn't know
// about GL strings and GL strings are the only way I know to detect Adreno (EGL Vendor only
// says 'Android'), and it is not convenient to have to create a GL context before GfxInfo::Init()
// is first called.
if (gl->Renderer() == gl::GLContext::RendererAdreno200 ||
gl->Renderer() == gl::GLContext::RendererAdreno205)
{
return false;
}
#endif
mMinCapability = Preferences::GetBool("webgl.min_capability_mode", false);
mDisableExtensions = Preferences::GetBool("webgl.disable-extensions", false);