Bug 1021248 - Update the low-res tiles even when not in risk of checkerboarding. r=Cwiiis
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -121,18 +121,16 @@ TiledContentClient::UseTiledLayerBuffer(
// TiledLayerBufferComposite.
buffer->ReadLock();
mForwarder->UseTiledLayerBuffer(this, buffer->GetSurfaceDescriptorTiles());
buffer->ClearPaintedRegion();
}
SharedFrameMetricsHelper::SharedFrameMetricsHelper()
- : mLastProgressiveUpdateWasLowPrecision(false)
- , mProgressiveUpdateWasInDanger(false)
{
MOZ_COUNT_CTOR(SharedFrameMetricsHelper);
}
SharedFrameMetricsHelper::~SharedFrameMetricsHelper()
{
MOZ_COUNT_DTOR(SharedFrameMetricsHelper);
}
@@ -170,27 +168,16 @@ SharedFrameMetricsHelper::UpdateFromComp
compositorMetrics)) {
FindFallbackContentFrameMetrics(aLayer, aCompositionBounds, aZoom);
return false;
}
aCompositionBounds = ParentLayerRect(compositorMetrics.mCompositionBounds);
aZoom = compositorMetrics.GetZoomToParent();
- // Reset the checkerboard risk flag when switching to low precision
- // rendering.
- if (aLowPrecision && !mLastProgressiveUpdateWasLowPrecision) {
- // Skip low precision rendering until we're at risk of checkerboarding.
- if (!mProgressiveUpdateWasInDanger) {
- return true;
- }
- mProgressiveUpdateWasInDanger = false;
- }
- mLastProgressiveUpdateWasLowPrecision = aLowPrecision;
-
// Always abort updates if the resolution has changed. There's no use
// in drawing at the incorrect resolution.
if (!FuzzyEquals(compositorMetrics.GetZoom().scale, contentMetrics.GetZoom().scale)) {
return true;
}
// Never abort drawing if we can't be sure we've sent a more recent
// display-port. If we abort updating when we shouldn't, we can end up
@@ -200,33 +187,30 @@ SharedFrameMetricsHelper::UpdateFromComp
fabsf(contentMetrics.GetScrollOffset().y - compositorMetrics.GetScrollOffset().y) <= 2 &&
fabsf(contentMetrics.mDisplayPort.x - compositorMetrics.mDisplayPort.x) <= 2 &&
fabsf(contentMetrics.mDisplayPort.y - compositorMetrics.mDisplayPort.y) <= 2 &&
fabsf(contentMetrics.mDisplayPort.width - compositorMetrics.mDisplayPort.width) <= 2 &&
fabsf(contentMetrics.mDisplayPort.height - compositorMetrics.mDisplayPort.height)) {
return false;
}
- // When not a low precision pass and the page is in danger of checker boarding
- // abort update.
- if (!aLowPrecision && !mProgressiveUpdateWasInDanger) {
- bool scrollUpdatePending = contentMetrics.GetScrollOffsetUpdated() &&
- contentMetrics.GetScrollGeneration() != compositorMetrics.GetScrollGeneration();
- // If scrollUpdatePending is true, then that means the content-side
- // metrics has a new scroll offset that is going to be forced into the
- // compositor but it hasn't gotten there yet.
- // Even though right now comparing the metrics might indicate we're
- // about to checkerboard (and that's true), the checkerboarding will
- // disappear as soon as the new scroll offset update is processed
- // on the compositor side. To avoid leaving things in a low-precision
- // paint, we need to detect and handle this case (bug 1026756).
- if (!scrollUpdatePending && AboutToCheckerboard(contentMetrics, compositorMetrics)) {
- mProgressiveUpdateWasInDanger = true;
- return true;
- }
+ bool scrollUpdatePending = contentMetrics.GetScrollOffsetUpdated() &&
+ contentMetrics.GetScrollGeneration() != compositorMetrics.GetScrollGeneration();
+ // If scrollUpdatePending is true, then that means the content-side
+ // metrics has a new scroll offset that is going to be forced into the
+ // compositor but it hasn't gotten there yet.
+ // Even though right now comparing the metrics might indicate we're
+ // about to checkerboard (and that's true), the checkerboarding will
+ // disappear as soon as the new scroll offset update is processed
+ // on the compositor side. To avoid leaving things in a low-precision
+ // paint, we need to detect and handle this case (bug 1026756).
+ if (!aLowPrecision && !scrollUpdatePending && AboutToCheckerboard(contentMetrics, compositorMetrics)) {
+ TILING_PRLOG_OBJ(("TILING: Checkerboard abort content %s\n", tmpstr.get()), contentMetrics);
+ TILING_PRLOG_OBJ(("TILING: Checkerboard abort compositor %s\n", tmpstr.get()), compositorMetrics);
+ return true;
}
// Abort drawing stale low-precision content if there's a more recent
// display-port in the pipeline.
if (aLowPrecision && !aHasPendingNewThebesContent) {
return true;
}
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -331,19 +331,16 @@ public:
* Determines if the compositor's upcoming composition bounds has fallen
* outside of the contents display port. If it has then the compositor
* will start to checker board. Checker boarding is when the compositor
* tries to composite a tile and it is not available. Historically
* a tile with a checker board pattern was used. Now a blank tile is used.
*/
bool AboutToCheckerboard(const FrameMetrics& aContentMetrics,
const FrameMetrics& aCompositorMetrics);
-private:
- bool mLastProgressiveUpdateWasLowPrecision;
- bool mProgressiveUpdateWasInDanger;
};
/**
* Provide an instance of TiledLayerBuffer backed by drawable TextureClients.
* This buffer provides an implementation of ValidateTile using a
* thebes callback and can support painting using a single paint buffer.
* Whether a single paint buffer is used is controlled by
* gfxPrefs::PerTileDrawing().