Bug 1009961 - Remove code to drop displayport if it exceeds B2G max texture size. r=tn

This code is no longer needed because tiling is enabled on all
scrollable layers on B2G, and so we only draw tile-sized chunks
of the displayport. Therefore the textures created will never
exceed the max texture size. On non-B2G platforms this code is
not used anyway so there is no effect. Going forward we should
always be enabling tiling before enabling APZ on new platforms
so it is unlikely that we will need this code.
This commit is contained in:
Kartikaya Gupta 2014-09-17 02:20:06 -04:00
parent 21a0c1c1de
commit b3b0b1e26c

View File

@ -2727,32 +2727,6 @@ ClipListsExceptCaret(nsDisplayListCollection* aLists,
::ClipItemsExceptCaret(aLists->Content(), aBuilder, aClipFrame, aClip);
}
static bool
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
// in the AsyncPanZoomController code is slightly busted (bug 957668 will fix it properly).
// We sometimes end up requesting displayports for which the corresponding layer will be
// larger than the max GL texture size (which we assume to be 4096 here).
// If we run into this case, we should just not use the displayport at all and fall back to
// just making a ScrollInfoLayer so that we use the APZC's synchronous scrolling fallback
// mechanism.
// Note also that if we don't do this here, it is quite likely that the parent B2G process
// 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
return false;
#endif
}
void
ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
@ -2852,16 +2826,10 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
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;
}
nsLayoutUtils::GetCriticalDisplayPort(mOuter->GetContent(), &critDp);
}
// Override the dirty rectangle if the displayport has been set.