Bug 1288446 - Call glCheckFramebufferStatus after glFramebufferTexture2D to avoid driver crash; r=jrmuizel

Some PowerVR SGX540 devices running Android 4.0 were crashing when
uploading texture data with glTexSubImage2D. This was unearthed by a
Skia upgrade which removed what should have been an unnecessary OpenGL
call. This reinstates the OpenGL call which prevents the crash, but at a
GLContext level rather than in Skia.

MozReview-Commit-ID: Dub8VSs2Dzd

--HG--
extra : rebase_source : 7584b2a71656c78055d1a3cd1410c2a1bd8e70b3
This commit is contained in:
Jamie Nicol 2016-09-08 15:29:44 +01:00
Родитель 78964259b9
Коммит 363f957b1f
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -471,6 +471,7 @@ GLContext::GLContext(CreateContextFlags flags, const SurfaceCaps& caps,
mNeedsTextureSizeChecks(false),
mNeedsFlushBeforeDeleteFB(false),
mTextureAllocCrashesOnMapFailure(false),
mNeedsCheckAfterAttachTextureToFb(false),
mWorkAroundDriverBugs(true),
mHeavyGLCallsSinceLastFlush(false)
{
@ -1063,6 +1064,17 @@ GLContext::InitWithPrefixImpl(const char* prefix, bool trygl)
mTextureAllocCrashesOnMapFailure = true;
}
#endif
#if MOZ_WIDGET_ANDROID
if (mWorkAroundDriverBugs &&
Renderer() == GLRenderer::SGX540 &&
AndroidBridge::Bridge()->GetAPIVersion() <= 15) {
// Bug 1288446. Driver sometimes crashes when uploading data to a
// texture if the render target has changed since the texture was
// rendered from. Calling glCheckFramebufferStatus after
// glFramebufferTexture2D prevents the crash.
mNeedsCheckAfterAttachTextureToFb = true;
}
#endif
mMaxTextureImageSize = mMaxTextureSize;

Просмотреть файл

@ -1967,6 +1967,9 @@ public:
BEFORE_GL_CALL;
mSymbols.fFramebufferTexture2D(target, attachmentPoint, textureTarget, texture, level);
AFTER_GL_CALL;
if (mNeedsCheckAfterAttachTextureToFb) {
fCheckFramebufferStatus(target);
}
}
void fFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) {
@ -3531,6 +3534,7 @@ protected:
bool mNeedsTextureSizeChecks;
bool mNeedsFlushBeforeDeleteFB;
bool mTextureAllocCrashesOnMapFailure;
bool mNeedsCheckAfterAttachTextureToFb;
bool mWorkAroundDriverBugs;
bool IsTextureSizeSafeToPassToDriver(GLenum target, GLsizei width, GLsizei height) const {