Backed out changesets ddf965a90c07 and 305e676779f8 (bug 1137203) for being the likely cause of bug 1137952.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2015-03-02 12:34:39 -05:00
parent 0b64c06add
commit 1a0dab6850
6 changed files with 62 additions and 79 deletions

View File

@ -309,16 +309,6 @@ public:
return EventRegions();
}
bool HasTransformAnimation() const
{
MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->HasTransformAnimation();
}
return false;
}
RefLayer* AsRefLayer() const
{
MOZ_ASSERT(IsValid());

View File

@ -762,17 +762,6 @@ Layer::GetLocalTransform()
return transform;
}
bool
Layer::HasTransformAnimation() const
{
for (uint32_t i = 0; i < mAnimations.Length(); i++) {
if (mAnimations[i].property() == eCSSProperty_transform) {
return true;
}
}
return false;
}
void
Layer::ApplyPendingUpdatesForThisTransaction()
{

View File

@ -1284,8 +1284,6 @@ public:
uint64_t GetAnimationGeneration() { return mAnimationGeneration; }
void SetAnimationGeneration(uint64_t aCount) { mAnimationGeneration = aCount; }
bool HasTransformAnimation() const;
/**
* Returns the local transform for this layer: either mTransform or,
* for shadow layers, GetShadowTransform()

View File

@ -91,14 +91,11 @@ GetTransformToAncestorsParentLayer(Layer* aStart, const LayerMetricsWrapper& aAn
void
ClientTiledPaintedLayer::GetAncestorLayers(LayerMetricsWrapper* aOutScrollAncestor,
LayerMetricsWrapper* aOutDisplayPortAncestor,
bool* aOutHasTransformAnimation)
LayerMetricsWrapper* aOutDisplayPortAncestor)
{
LayerMetricsWrapper scrollAncestor;
LayerMetricsWrapper displayPortAncestor;
bool hasTransformAnimation = false;
for (LayerMetricsWrapper ancestor(this, LayerMetricsWrapper::StartAt::BOTTOM); ancestor; ancestor = ancestor.GetParent()) {
hasTransformAnimation |= ancestor.HasTransformAnimation();
const FrameMetrics& metrics = ancestor.Metrics();
if (!scrollAncestor && metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
scrollAncestor = ancestor;
@ -116,9 +113,6 @@ ClientTiledPaintedLayer::GetAncestorLayers(LayerMetricsWrapper* aOutScrollAncest
if (aOutDisplayPortAncestor) {
*aOutDisplayPortAncestor = displayPortAncestor;
}
if (aOutHasTransformAnimation) {
*aOutHasTransformAnimation = hasTransformAnimation;
}
}
void
@ -140,8 +134,7 @@ ClientTiledPaintedLayer::BeginPaint()
// with a displayport.
LayerMetricsWrapper scrollAncestor;
LayerMetricsWrapper displayPortAncestor;
bool hasTransformAnimation;
GetAncestorLayers(&scrollAncestor, &displayPortAncestor, &hasTransformAnimation);
GetAncestorLayers(&scrollAncestor, &displayPortAncestor);
if (!displayPortAncestor || !scrollAncestor) {
// No displayport or scroll ancestor, so we can't do progressive rendering.
@ -153,8 +146,8 @@ ClientTiledPaintedLayer::BeginPaint()
return;
}
TILING_LOG("TILING %p: Found scrollAncestor %p, displayPortAncestor %p, transform %d\n", this,
scrollAncestor.GetLayer(), displayPortAncestor.GetLayer(), hasTransformAnimation);
TILING_LOG("TILING %p: Found scrollAncestor %p and displayPortAncestor %p\n", this,
scrollAncestor.GetLayer(), displayPortAncestor.GetLayer());
const FrameMetrics& scrollMetrics = scrollAncestor.Metrics();
const FrameMetrics& displayportMetrics = displayPortAncestor.Metrics();
@ -166,17 +159,12 @@ ClientTiledPaintedLayer::BeginPaint()
transformDisplayPortToLayer.Invert();
// Compute the critical display port that applies to this layer in the
// LayoutDevice space of this layer, but only if there is no OMT animation
// on this layer. If there is an OMT animation then we need to draw the whole
// visible region of this layer as determined by layout, because we don't know
// what parts of it might move into view in the compositor.
if (!hasTransformAnimation) {
ParentLayerRect criticalDisplayPort =
(displayportMetrics.GetCriticalDisplayPort() * displayportMetrics.GetZoom())
+ displayportMetrics.mCompositionBounds.TopLeft();
mPaintData.mCriticalDisplayPort = RoundedOut(
ApplyParentLayerToLayerTransform(transformDisplayPortToLayer, criticalDisplayPort));
}
// LayoutDevice space of this layer.
ParentLayerRect criticalDisplayPort =
(displayportMetrics.GetCriticalDisplayPort() * displayportMetrics.GetZoom())
+ displayportMetrics.mCompositionBounds.TopLeft();
mPaintData.mCriticalDisplayPort = RoundedOut(
ApplyParentLayerToLayerTransform(transformDisplayPortToLayer, criticalDisplayPort));
TILING_LOG("TILING %p: Critical displayport %s\n", this, Stringify(mPaintData.mCriticalDisplayPort).c_str());
// Store the resolution from the displayport ancestor layer. Because this is Gecko-side,
@ -228,49 +216,52 @@ ClientTiledPaintedLayer::IsScrollingOnCompositor(const FrameMetrics& aParentMetr
COORDINATE_EPSILON);
}
bool
ClientTiledPaintedLayer::UseFastPath()
{
// The fast path doesn't allow rendering at low resolution. It will draw the low-res
// area at full resolution and cause OOM.
if (gfxPrefs::UseLowPrecisionBuffer()) {
return false;
}
LayerMetricsWrapper scrollAncestor;
GetAncestorLayers(&scrollAncestor, nullptr);
if (!scrollAncestor) {
return true;
}
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
bool multipleTransactionsNeeded = gfxPlatform::GetPlatform()->UseProgressivePaint()
|| !parentMetrics.GetCriticalDisplayPort().IsEmpty();
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
bool isScrollable = parentMetrics.IsScrollable();
return !multipleTransactionsNeeded || isFixed || !isScrollable;
}
bool
ClientTiledPaintedLayer::UseProgressiveDraw() {
if (!gfxPlatform::GetPlatform()->UseProgressivePaint()) {
// pref is disabled, so never do progressive
return false;
}
if (ClientManager()->HasShadowTarget()) {
// This condition is true when we are in a reftest scenario. We don't want
// to draw progressively here because it can cause intermittent reftest
// failures because the harness won't wait for all the tiles to be drawn.
return false;
}
if (mPaintData.mCriticalDisplayPort.IsEmpty()) {
// This catches three scenarios:
// 1) This layer doesn't have a scrolling ancestor
// 2) This layer is subject to OMTA transforms
// 3) Low-precision painting is disabled
// In all of these cases, we don't want to draw this layer progressively.
return false;
}
if (GetIsFixedPosition() || GetParent()->GetIsFixedPosition()) {
// This layer is fixed-position and so even if it does have a scrolling
// ancestor it will likely be entirely on-screen all the time, so we
// should draw it all at once
// Don't draw progressively in a reftest scenario (that's what the HasShadowTarget() check is for).
if (!gfxPlatform::GetPlatform()->UseProgressivePaint() || ClientManager()->HasShadowTarget()) {
return false;
}
// XXX We probably want to disable progressive drawing for non active APZ layers in the future
// but we should wait for a proper test case before making this change.
#if 0 //!defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ)
LayerMetricsWrapper scrollAncestor;
GetAncestorLayers(&scrollAncestor, nullptr, nullptr);
MOZ_ASSERT(scrollAncestor); // because mPaintData.mCriticalDisplayPort is non-empty
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
if (!IsScrollingOnCompositor(parentMetrics)) {
return false;
GetAncestorLayers(&scrollAncestor, nullptr);
if (!scrollAncestor) {
return true;
}
#endif
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
return !IsScrollingOnCompositor(parentMetrics);
#else
return true;
#endif
}
bool
@ -450,6 +441,16 @@ ClientTiledPaintedLayer::RenderLayer()
ToClientLayer(GetMaskLayer())->RenderLayer();
}
// In some cases we can take a fast path and just be done with it.
if (UseFastPath()) {
TILING_LOG("TILING %p: Taking fast-path\n", this);
mValidRegion = neededRegion;
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, callback, data);
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
return;
}
// For more complex cases we need to calculate a bunch of metrics before we
// can do the paint.
BeginPaint();

View File

@ -81,8 +81,7 @@ public:
* which hold the return values; the values passed in may be null.
*/
void GetAncestorLayers(LayerMetricsWrapper* aOutScrollAncestor,
LayerMetricsWrapper* aOutDisplayPortAncestor,
bool* aOutHasTransformAnimation);
LayerMetricsWrapper* aOutDisplayPortAncestor);
private:
ClientLayerManager* ClientManager()
@ -96,6 +95,12 @@ private:
*/
void BeginPaint();
/**
* Determine if we can use a fast path to just do a single high-precision,
* non-progressive paint.
*/
bool UseFastPath();
/**
* Check if the layer is being scrolled by APZ on the compositor.
*/

View File

@ -1360,7 +1360,7 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
TILING_LOG("TILING %p: Progressive update stale region %s\n", mPaintedLayer, Stringify(staleRegion).c_str());
LayerMetricsWrapper scrollAncestor;
mPaintedLayer->GetAncestorLayers(&scrollAncestor, nullptr, nullptr);
mPaintedLayer->GetAncestorLayers(&scrollAncestor, nullptr);
// Find out the current view transform to determine which tiles to draw
// first, and see if we should just abort this paint. Aborting is usually