From ab65d99c4e00faa7d5b5785a24d783885fc269c1 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 14 Mar 2016 15:02:43 -0400 Subject: [PATCH] Bug 1254273 - Align the displayport to a max of 256 pixels even if the layer is larger. r=BenWa MozReview-Commit-ID: CLghUMWkJU8 --- layout/base/nsLayoutUtils.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index ba5eb5619f49..d7d258fc38fa 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -953,8 +953,11 @@ GetDisplayPortFromMarginsData(nsIContent* aContent, if (APZCCallbackHelper::IsDisplayportSuppressed()) { alignment = ScreenSize(1, 1); } else if (gfxPrefs::LayersTilesEnabled()) { - alignment = ScreenSize(gfxPlatform::GetPlatform()->GetTileWidth(), - gfxPlatform::GetPlatform()->GetTileHeight()); + // Don't align to tiles if they are too large, because we could expand + // the displayport by a lot which can take more paint time. It's a tradeoff + // though because if we don't align to tiles we have more waste on upload. + alignment = ScreenSize(std::min(256, gfxPlatform::GetPlatform()->GetTileWidth()), + std::min(256, gfxPlatform::GetPlatform()->GetTileHeight())); } else { // If we're not drawing with tiles then we need to be careful about not // hitting the max texture size and we only need 1 draw call per layer