Backed out 8 changesets (bug 1023882) for b2g mochitest-4 orange on a CLOSED TREE

Backed out changeset 501167f9e525 (bug 1023882)
Backed out changeset 811d536995cf (bug 1023882)
Backed out changeset c38a0cb1e00c (bug 1023882)
Backed out changeset 4ba2f2a98114 (bug 1023882)
Backed out changeset 42e44e1eb363 (bug 1023882)
Backed out changeset a92435f75f89 (bug 1023882)
Backed out changeset 039cfd09fa32 (bug 1023882)
Backed out changeset 05e8c4ee536d (bug 1023882)
This commit is contained in:
Wes Kocher 2014-06-11 16:39:01 -07:00
Родитель a8e9a7e70c
Коммит 9e0ebb2b1e
3 изменённых файлов: 190 добавлений и 230 удалений

Просмотреть файл

@ -86,6 +86,10 @@ GetTransformToAncestorsParentLayer(Layer* aStart, Layer* aAncestor)
void
ClientTiledThebesLayer::BeginPaint()
{
if (ClientManager()->IsRepeatTransaction()) {
return;
}
mPaintData.mLowPrecisionPaintCount = 0;
mPaintData.mPaintFinished = false;
mPaintData.mCompositionBounds.SetEmpty();
@ -179,123 +183,13 @@ ClientTiledThebesLayer::BeginPaint()
TILING_PRLOG_OBJ(("TILING 0x%p: Scroll offset %s\n", this, tmpstr.get()), mPaintData.mScrollOffset);
}
bool
ClientTiledThebesLayer::UseFastPath()
{
const FrameMetrics& parentMetrics = GetParent()->GetFrameMetrics();
bool multipleTransactionsNeeded = gfxPrefs::UseProgressiveTilePainting()
|| gfxPrefs::UseLowPrecisionBuffer()
|| !parentMetrics.mCriticalDisplayPort.IsEmpty();
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
return !multipleTransactionsNeeded || isFixed || parentMetrics.mDisplayPort.IsEmpty();
}
bool
ClientTiledThebesLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData)
{
// If we have no high-precision stuff to draw, or we have started drawing low-precision
// already, then we shouldn't do anything there.
if (aInvalidRegion.IsEmpty() || mPaintData.mLowPrecisionPaintCount != 0) {
return false;
}
// Only draw progressively when the resolution is unchanged.
if (gfxPrefs::UseProgressiveTilePainting() &&
!ClientManager()->HasShadowTarget() &&
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
// Store the old valid region, then clear it before painting.
// We clip the old valid region to the visible region, as it only gets
// used to decide stale content (currently valid and previously visible)
nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
oldValidRegion.And(oldValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update with old valid region %s\n", this, tmpstr.get()), oldValidRegion);
return mContentClient->mTiledBuffer.ProgressiveUpdate(mValidRegion, aInvalidRegion,
oldValidRegion, &mPaintData, aCallback, aCallbackData);
}
// Otherwise do a non-progressive paint
mValidRegion = mVisibleRegion;
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
TILING_PRLOG_OBJ(("TILING 0x%p: Non-progressive paint invalid region %s\n", this, tmpstr.get()), aInvalidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: Non-progressive paint new valid region %s\n", this, tmpstr.get()), mValidRegion);
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, aInvalidRegion, aCallback, aCallbackData);
return true;
}
bool
ClientTiledThebesLayer::RenderLowPrecision(nsIntRegion& aInvalidRegion,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData)
{
// Render the low precision buffer, if the visible region is larger than the
// critical display port.
if (!nsIntRegion(LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)).Contains(mVisibleRegion)) {
nsIntRegion oldValidRegion = mContentClient->mLowPrecisionTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion);
bool updatedBuffer = false;
// If the frame resolution or format have changed, invalidate the buffer
if (mContentClient->mLowPrecisionTiledBuffer.GetFrameResolution() != mPaintData.mResolution ||
mContentClient->mLowPrecisionTiledBuffer.HasFormatChanged()) {
if (!mLowPrecisionValidRegion.IsEmpty()) {
updatedBuffer = true;
}
oldValidRegion.SetEmpty();
mLowPrecisionValidRegion.SetEmpty();
mContentClient->mLowPrecisionTiledBuffer.SetFrameResolution(mPaintData.mResolution);
aInvalidRegion = mVisibleRegion;
}
// Invalidate previously valid content that is no longer visible
if (mPaintData.mLowPrecisionPaintCount == 1) {
mLowPrecisionValidRegion.And(mLowPrecisionValidRegion, mVisibleRegion);
}
mPaintData.mLowPrecisionPaintCount++;
// Remove the valid high-precision region from the invalid low-precision
// region. We don't want to spend time drawing things twice.
aInvalidRegion.Sub(aInvalidRegion, mValidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive paint: low-precision invalid region is %s\n", this, tmpstr.get()), aInvalidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive paint: low-precision new valid region is %s\n", this, tmpstr.get()), mLowPrecisionValidRegion);
if (!aInvalidRegion.IsEmpty()) {
updatedBuffer = mContentClient->mLowPrecisionTiledBuffer.ProgressiveUpdate(
mLowPrecisionValidRegion, aInvalidRegion, oldValidRegion,
&mPaintData, aCallback, aCallbackData);
}
return updatedBuffer;
}
if (!mLowPrecisionValidRegion.IsEmpty()) {
TILING_PRLOG(("TILING 0x%p: Clearing low-precision buffer\n", this));
// Clear the low precision tiled buffer.
mLowPrecisionValidRegion.SetEmpty();
mContentClient->mLowPrecisionTiledBuffer.ResetPaintedAndValidState();
// Return true here so we send a Painted callback after clearing the valid
// region of the low precision buffer. This allows the shadow buffer's valid
// region to be updated and the associated resources to be freed.
return true;
}
return false;
}
void
ClientTiledThebesLayer::EndPaint()
ClientTiledThebesLayer::EndPaint(bool aFinish)
{
if (!aFinish && !mPaintData.mPaintFinished) {
return;
}
mPaintData.mLastScrollOffset = mPaintData.mScrollOffset;
mPaintData.mPaintFinished = true;
mPaintData.mFirstPaint = false;
@ -327,112 +221,196 @@ ClientTiledThebesLayer::RenderLayer()
TILING_PRLOG_OBJ(("TILING 0x%p: Initial visible region %s\n", this, tmpstr.get()), mVisibleRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: Initial valid region %s\n", this, tmpstr.get()), mValidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: Initial low-precision valid region %s\n", this, tmpstr.get()), mLowPrecisionValidRegion);
nsIntRegion invalidRegion;
invalidRegion.Sub(mVisibleRegion, mValidRegion);
nsIntRegion invalidRegion = mVisibleRegion;
invalidRegion.Sub(invalidRegion, mValidRegion);
if (invalidRegion.IsEmpty()) {
EndPaint();
EndPaint(true);
return;
}
if (!ClientManager()->IsRepeatTransaction()) {
// Only paint the mask layer on the first transaction.
if (GetMaskLayer()) {
ToClientLayer(GetMaskLayer())->RenderLayer();
}
// In some cases we can take a fast path and just be done with it.
if (UseFastPath()) {
TILING_PRLOG(("TILING 0x%p: Taking fast-path\n"));
mValidRegion = mVisibleRegion;
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();
if (mPaintData.mPaintFinished) {
return;
}
// Make sure that tiles that fall outside of the visible region or outside of the
// critical displayport are discarded on the first update. Also make sure that we
// only draw stuff inside the critical displayport on the first update.
mValidRegion.And(mValidRegion, mVisibleRegion);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
TILING_PRLOG_OBJ(("TILING 0x%p: First-transaction valid region %s\n", this, tmpstr.get()), mValidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: First-transaction invalid region %s\n", this, tmpstr.get()), invalidRegion);
} else {
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
TILING_PRLOG_OBJ(("TILING 0x%p: Repeat-transaction invalid region %s\n", this, tmpstr.get()), invalidRegion);
// Only paint the mask layer on the first transaction.
if (GetMaskLayer() && !ClientManager()->IsRepeatTransaction()) {
ToClientLayer(GetMaskLayer())->RenderLayer();
}
bool updatedHighPrecision = RenderHighPrecision(invalidRegion, callback, data);
if (updatedHighPrecision) {
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
// Fast path for no progressive updates, no low-precision updates and no
// critical display-port set, or no display-port set, or this is a fixed
// position layer/contained in a fixed position layer
const FrameMetrics& parentMetrics = GetParent()->GetFrameMetrics();
if ((!gfxPrefs::UseProgressiveTilePainting() &&
!gfxPrefs::UseLowPrecisionBuffer() &&
parentMetrics.mCriticalDisplayPort.IsEmpty()) ||
parentMetrics.mDisplayPort.IsEmpty() ||
isFixed) {
mValidRegion = mVisibleRegion;
NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
callback, data);
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
if (!mPaintData.mPaintFinished) {
// There is still more high-res stuff to paint, so we're not
// done yet. A subsequent transaction will take care of this.
ClientManager()->SetRepeatTransaction();
return;
return;
}
// Calculate everything we need to perform the paint.
BeginPaint();
if (mPaintData.mPaintFinished) {
return;
}
TILING_PRLOG_OBJ(("TILING 0x%p: Valid region %s\n", this, tmpstr.get()), mValidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: Visible region %s\n", this, tmpstr.get()), mVisibleRegion);
// Make sure that tiles that fall outside of the visible region are
// discarded on the first update.
if (!ClientManager()->IsRepeatTransaction()) {
mValidRegion.And(mValidRegion, mVisibleRegion);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
// Make sure that tiles that fall outside of the critical displayport are
// discarded on the first update.
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
}
nsIntRegion lowPrecisionInvalidRegion;
if (gfxPrefs::UseLowPrecisionBuffer()) {
// Calculate the invalid region for the low precision buffer. Make sure
// to remove the valid high-precision area so we don't double-paint it.
lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion);
lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion);
}
TILING_PRLOG_OBJ(("TILING 0x%p: Low-precision invalid region %s\n", this, tmpstr.get()), lowPrecisionInvalidRegion);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
if (gfxPrefs::UseLowPrecisionBuffer()) {
// Calculate the invalid region for the low precision buffer
lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion);
// If there is nothing to draw in low-precision, then we're done.
if (lowPrecisionInvalidRegion.IsEmpty()) {
EndPaint();
return;
}
// Remove the valid region from the low precision valid region (we don't
// validate this part of the low precision buffer).
lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion);
}
if (updatedHighPrecision) {
// If there are low precision updates, but we just did some high-precision
// updates, then mark the paint as unfinished and request a repeat transaction.
// This is so that we don't perform low-precision updates in the same transaction
// as high-precision updates.
TILING_PRLOG(("TILING 0x%p: Scheduling repeat transaction for low-precision painting\n", this));
ClientManager()->SetRepeatTransaction();
mPaintData.mLowPrecisionPaintCount = 1;
mPaintData.mPaintFinished = false;
return;
}
bool updatedLowPrecision = RenderLowPrecision(lowPrecisionInvalidRegion, callback, data);
if (updatedLowPrecision) {
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer(TiledContentClient::LOW_PRECISION_TILED_BUFFER);
if (!mPaintData.mPaintFinished) {
// There is still more low-res stuff to paint, so we're not
// done yet. A subsequent transaction will take care of this.
ClientManager()->SetRepeatTransaction();
// Clip the invalid region to the critical display-port
invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
EndPaint(true);
return;
}
}
// If we get here, we've done all the high- and low-precision
// paints we wanted to do, so we can finish the paint and chill.
EndPaint();
TILING_PRLOG_OBJ(("TILING 0x%p: Invalid region %s\n", this, tmpstr.get()), invalidRegion);
if (!invalidRegion.IsEmpty() && mPaintData.mLowPrecisionPaintCount == 0) {
bool updatedBuffer = false;
// Only draw progressively when the resolution is unchanged.
if (gfxPrefs::UseProgressiveTilePainting() &&
!ClientManager()->HasShadowTarget() &&
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
// Store the old valid region, then clear it before painting.
// We clip the old valid region to the visible region, as it only gets
// used to decide stale content (currently valid and previously visible)
nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
oldValidRegion.And(oldValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update with old valid region %s\n", this, tmpstr.get()), oldValidRegion);
updatedBuffer =
mContentClient->mTiledBuffer.ProgressiveUpdate(mValidRegion, invalidRegion,
oldValidRegion, &mPaintData,
callback, data);
} else {
updatedBuffer = true;
mValidRegion = mVisibleRegion;
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
TILING_PRLOG_OBJ(("TILING 0x%p: Painting: valid region %s\n", this, tmpstr.get()), mValidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: and invalid region %s\n", this, tmpstr.get()), invalidRegion);
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
callback, data);
}
if (updatedBuffer) {
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
// If there are low precision updates, mark the paint as unfinished and
// request a repeat transaction.
if (!lowPrecisionInvalidRegion.IsEmpty() && mPaintData.mPaintFinished) {
ClientManager()->SetRepeatTransaction();
mPaintData.mLowPrecisionPaintCount = 1;
mPaintData.mPaintFinished = false;
}
// Return so that low precision updates aren't performed in the same
// transaction as high-precision updates.
EndPaint(false);
return;
}
}
TILING_PRLOG_OBJ(("TILING 0x%p: Low-precision valid region is %s\n", this, tmpstr.get()), mLowPrecisionValidRegion);
TILING_PRLOG_OBJ(("TILING 0x%p: Low-precision invalid region is %s\n", this, tmpstr.get()), lowPrecisionInvalidRegion);
// Render the low precision buffer, if there's area to invalidate and the
// visible region is larger than the critical display port.
bool updatedLowPrecision = false;
if (!lowPrecisionInvalidRegion.IsEmpty() &&
!nsIntRegion(LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)).Contains(mVisibleRegion)) {
nsIntRegion oldValidRegion =
mContentClient->mLowPrecisionTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion);
// If the frame resolution or format have changed, invalidate the buffer
if (mContentClient->mLowPrecisionTiledBuffer.GetFrameResolution() != mPaintData.mResolution ||
mContentClient->mLowPrecisionTiledBuffer.HasFormatChanged()) {
if (!mLowPrecisionValidRegion.IsEmpty()) {
updatedLowPrecision = true;
}
oldValidRegion.SetEmpty();
mLowPrecisionValidRegion.SetEmpty();
mContentClient->mLowPrecisionTiledBuffer.SetFrameResolution(mPaintData.mResolution);
lowPrecisionInvalidRegion = mVisibleRegion;
}
// Invalidate previously valid content that is no longer visible
if (mPaintData.mLowPrecisionPaintCount == 1) {
mLowPrecisionValidRegion.And(mLowPrecisionValidRegion, mVisibleRegion);
}
mPaintData.mLowPrecisionPaintCount++;
// Remove the valid high-precision region from the invalid low-precision
// region. We don't want to spend time drawing things twice.
lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion);
if (!lowPrecisionInvalidRegion.IsEmpty()) {
updatedLowPrecision = mContentClient->mLowPrecisionTiledBuffer
.ProgressiveUpdate(mLowPrecisionValidRegion,
lowPrecisionInvalidRegion,
oldValidRegion, &mPaintData,
callback, data);
}
} else if (!mLowPrecisionValidRegion.IsEmpty()) {
// Clear the low precision tiled buffer
updatedLowPrecision = true;
mLowPrecisionValidRegion.SetEmpty();
mContentClient->mLowPrecisionTiledBuffer.ResetPaintedAndValidState();
}
// We send a Painted callback if we clear the valid region of the low
// precision buffer, so that the shadow buffer's valid region can be updated
// and the associated resources can be freed.
if (updatedLowPrecision) {
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer(TiledContentClient::LOW_PRECISION_TILED_BUFFER);
}
EndPaint(false);
}
} // mozilla

Просмотреть файл

@ -81,32 +81,11 @@ private:
void BeginPaint();
/**
* Determine if we can use a fast path to just do a single high-precision,
* non-progressive paint.
* When a paint ends, updates any data necessary to persist until the next
* paint. If aFinish is true, this will cause the paint to be marked as
* finished.
*/
bool UseFastPath();
/**
* Helper function to do the high-precision paint.
* This function returns true if it updated the paint buffer.
*/
bool RenderHighPrecision(nsIntRegion& aInvalidRegion,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData);
/**
* Helper function to do the low-precision paint.
* This function returns true if it updated the paint buffer.
*/
bool RenderLowPrecision(nsIntRegion& aInvalidRegion,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData);
/**
* This causes the paint to be marked as finished, and updates any data
* necessary to persist until the next paint.
*/
void EndPaint();
void EndPaint(bool aFinish);
RefPtr<TiledContentClient> mContentClient;
nsIntRegion mLowPrecisionValidRegion;

Просмотреть файл

@ -1064,10 +1064,13 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
// sure it happens in the same transaction by requesting this work be
// repeated immediately.
// If this is unnecessary, the remaining work will be done tile-by-tile in
// subsequent transactions. The caller code is responsible for scheduling
// the subsequent transactions as long as we don't set the mPaintFinished
// flag to true.
return (!drawingLowPrecision && paintInSingleTransaction);
// subsequent transactions.
if (!drawingLowPrecision && paintInSingleTransaction) {
return true;
}
mManager->SetRepeatTransaction();
return false;
}
// We're not repeating painting and we've not requested a repeat transaction,