Bug 1356119 - Skip Flush to old context after device reset; r?dvander
MozReview-Commit-ID: 1ogI2m9hTp6
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -413,17 +413,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
@@ -1364,17 +1364,17 @@ LayerManagerComposite::AutoAddMaskEffect
mCompositable->RemoveMaskEffect();
}
void
LayerManagerComposite::ChangeCompositor(Compositor* aNewCompositor)
{
if (mCompositor) {
- mCompositor->CancelFrame();
+ mCompositor->CancelFrame(false);
}
mCompositor = aNewCompositor;
mTwoPassTmpTarget = nullptr;
}
LayerComposite::LayerComposite(LayerManagerComposite *aManager)
: HostLayer(aManager)
, mCompositeManager(aManager)
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -1529,22 +1529,24 @@ CompositorD3D11::Present()
} else {
mBackBufferInvalid.SetEmpty();
}
mDisableSequenceForNextFrame = false;
}
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
@@ -114,17 +114,17 @@ public:
void NormalDrawingDone() 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);