Bug 1298285 - Add Logs to diagnose GL context lost caused by swap failure; r?jgilbert draft
authorChih-Yi Leu <cleu@mozilla.com>
Mon, 19 Jun 2017 12:54:32 +0800
changeset 597283 ff9557f05ed1a111a9d0fd0586c4ab2c4a4271b0
parent 597026 416c3c8c4b3db9ba96a103ce7820c9a140a3051d
child 634192 ecef385d7f9de8d3c372670590efa21a6e2c5c1e
push id64890
push userbmo:cleu@mozilla.com
push dateTue, 20 Jun 2017 10:32:47 +0000
reviewersjgilbert
bugs1298285
milestone56.0a1
Bug 1298285 - Add Logs to diagnose GL context lost caused by swap failure; r?jgilbert MozReview-Commit-ID: C1tZNN0JAIz
dom/canvas/WebGLContext.cpp
gfx/gl/GLScreenBuffer.cpp
--- 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;