Bug 1298285 - Add Logs to diagnose GL context lost caused by swap failure; r?jgilbert
MozReview-Commit-ID: C1tZNN0JAIz
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -1603,16 +1603,17 @@ WebGLContext::PresentScreenBuffer()
MOZ_ASSERT(!mBackbufferNeedsClear);
gl->MakeCurrent();
GLScreenBuffer* screen = gl->Screen();
MOZ_ASSERT(screen);
if (!screen->PublishFrame(screen->Size())) {
+ gfxCriticalNote << "Context lost because of a swap failure.\n";
ForceLoseContext();
return false;
}
if (!mOptions.preserveDrawingBuffer) {
mBackbufferNeedsClear = true;
}
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -552,26 +552,29 @@ GLScreenBuffer::Attach(SharedSurface* su
return true;
}
bool
GLScreenBuffer::Swap(const gfx::IntSize& size)
{
RefPtr<SharedSurfaceTextureClient> newBack = mFactory->NewTexClient(size);
- if (!newBack)
+ if (!newBack) {
+ gfxCriticalNote << "Cannot allocate new Back Buffer.\n";
return false;
+ }
// In the case of DXGL interop, the new surface needs to be acquired before
// it is attached so that the interop surface is locked, which populates
// the GL renderbuffer. This results in the renderbuffer being ready and
// attachment to framebuffer succeeds in Attach() call.
newBack->Surf()->ProducerAcquire();
if (!Attach(newBack->Surf(), size)) {
+ gfxCriticalNote << "Unable to attach Back Buffer surface.\n";
newBack->Surf()->ProducerRelease();
return false;
}
// Attach was successful.
mFront = mBack;
mBack = newBack;