Bug 1356119 - Skip Flush to old context after device reset. r=dvander, a=jcristau
authorKevin Chen <kechen@mozilla.com>
Wed, 19 Apr 2017 20:11:00 -0400
changeset 396037 e20007000f8e56cefca0a93788be3ac05f0823fc
parent 396036 f14e5d09f00da2751b6ed35a8b566c7f134f4559
child 396038 fef685f5d26a19db910b77b1fd2b280832c68ac1
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander, jcristau
bugs1356119
milestone54.0
Bug 1356119 - Skip Flush to old context after device reset. r=dvander, a=jcristau MozReview-Commit-ID: KlSpXMm1aMc
gfx/layers/Compositor.h
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/CompositorD3D11.h
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -427,17 +427,17 @@ public:
 
   /**
    * Flush the current frame to the screen and tidy up.
    *
    * Derived class overriding this should call Compositor::EndFrame.
    */
   virtual void EndFrame();
 
-  virtual void CancelFrame() { ReadUnlockTextures(); }
+  virtual void CancelFrame(bool aNeedFlush = true) { ReadUnlockTextures(); }
 
   virtual void SetDispAcquireFence(Layer* aLayer);
 
   /**
    * Whether textures created by this compositor can receive partial updates.
    */
   virtual bool SupportsPartialTextureUpdate() = 0;
 
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -1333,17 +1333,17 @@ LayerManagerComposite::AutoAddMaskEffect
 
   mCompositable->RemoveMaskEffect();
 }
 
 void
 LayerManagerComposite::ChangeCompositor(Compositor* aNewCompositor)
 {
   if (mCompositor) {
-    mCompositor->CancelFrame();
+    mCompositor->CancelFrame(false);
   }
   mCompositor = aNewCompositor;
   mTextRenderer = new TextRenderer(aNewCompositor);
   mTwoPassTmpTarget = nullptr;
 }
 
 LayerComposite::LayerComposite(LayerManagerComposite *aManager)
   : HostLayer(aManager)
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -1179,22 +1179,24 @@ CompositorD3D11::EndFrame()
   mQuery = query;
 
   Compositor::EndFrame();
 
   mCurrentRT = nullptr;
 }
 
 void
-CompositorD3D11::CancelFrame()
+CompositorD3D11::CancelFrame(bool aNeedFlush)
 {
   ReadUnlockTextures();
   // Flush the context, otherwise the driver might hold some resources alive
   // until the next flush or present.
-  mContext->Flush();
+  if (aNeedFlush) {
+    mContext->Flush();
+  }
 }
 
 void
 CompositorD3D11::PrepareViewport(const gfx::IntSize& aSize)
 {
   // This view matrix translates coordinates from 0..width and 0..height to
   // -1..1 on the X axis, and -1..1 on the Y axis (flips the Y coordinate)
   Matrix viewMatrix = Matrix::Translation(-1.0, 1.0);
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -110,17 +110,17 @@ public:
                           gfx::IntRect *aClipRectOut = nullptr,
                           gfx::IntRect *aRenderBoundsOut = nullptr) override;
 
   /**
    * Flush the current frame to the screen.
    */
   virtual void EndFrame() override;
 
-  virtual void CancelFrame() override;
+  virtual void CancelFrame(bool aNeedFlush = true) override;
 
   /**
    * Setup the viewport and projection matrix for rendering
    * to a window of the given dimensions.
    */
   virtual void PrepareViewport(const gfx::IntSize& aSize);
   virtual void PrepareViewport(const gfx::IntSize& aSize, const gfx::Matrix4x4& aProjection,
                                float aZNear, float aZFar);