Bug 1008412 - Account for low-precision resolution in the texture size check. r=tn

This commit is contained in:
Kartikaya Gupta 2014-05-12 05:19:00 -04:00
parent 4364268b5e
commit edbb778ead

View File

@ -2388,7 +2388,7 @@ ClipListsExceptCaret(nsDisplayListCollection* aLists,
}
static bool
DisplayportExceedsMaxTextureSize(nsPresContext* aPresContext, const nsRect& aDisplayPort)
DisplayportExceedsMaxTextureSize(nsPresContext* aPresContext, const nsRect& aDisplayPort, bool aLowPrecision)
{
#ifdef MOZ_WIDGET_GONK
// On B2G we actively run into max texture size limits because the displayport-sizing code
@ -2402,6 +2402,10 @@ DisplayportExceedsMaxTextureSize(nsPresContext* aPresContext, const nsRect& aDis
// will kill this child process to prevent OOMs (see the patch that landed as part of bug
// 965945 for details).
gfxSize resolution = aPresContext->PresShell()->GetCumulativeResolution();
if (aLowPrecision) {
resolution.width *= gfxPrefs::LowPrecisionResolution();
resolution.height *= gfxPrefs::LowPrecisionResolution();
}
return (aPresContext->AppUnitsToDevPixels(aDisplayPort.width) * resolution.width > 4096) ||
(aPresContext->AppUnitsToDevPixels(aDisplayPort.height) * resolution.height > 4096);
#else
@ -2523,9 +2527,18 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
usingDisplayport = nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &displayPort);
}
if (usingDisplayport && DisplayportExceedsMaxTextureSize(mOuter->PresContext(), displayPort)) {
bool usingLowPrecision = gfxPrefs::UseLowPrecisionBuffer();
if (usingDisplayport && DisplayportExceedsMaxTextureSize(mOuter->PresContext(), displayPort, usingLowPrecision)) {
usingDisplayport = false;
}
if (usingDisplayport && usingLowPrecision) {
// If we have low-res painting enabled we should check the critical displayport too
nsRect critDp;
bool usingCritDp = nsLayoutUtils::GetCriticalDisplayPort(mOuter->GetContent(), &critDp);
if (usingCritDp && !critDp.IsEmpty() && DisplayportExceedsMaxTextureSize(mOuter->PresContext(), critDp, false)) {
usingDisplayport = false;
}
}
// Override the dirty rectangle if the displayport has been set.
if (usingDisplayport) {