Bug 1404181 - Part 27: Add some retained-dl debugging tools. r=mstange

MozReview-Commit-ID: EQO1lAbUnpY

--HG--
extra : rebase_source : a11bfd8055bd83e9215211a4e48d43735d7010ba
This commit is contained in:
Matt Woodrow ext:(%2C%20Miko%20Mynttinen%20%3Cmikokm%40gmail.com%3E%2C%20Timothy%20Nikkel%20%3Ctnikkel%40gmail.com%3E) 2017-10-21 16:54:24 +13:00
parent f3e6b5eb98
commit e97adfa0ce
8 changed files with 65 additions and 2 deletions

View File

@ -41,6 +41,7 @@ void
Diagnostics::RecordPaintTimes(const PaintTiming& aPaintTimes)
{
mDlbMs.Add(aPaintTimes.dlMs());
mDlb2Ms.Add(aPaintTimes.dl2Ms());
mFlbMs.Add(aPaintTimes.flbMs());
mRasterMs.Add(aPaintTimes.rasterMs());
mSerializeMs.Add(aPaintTimes.serializeMs());
@ -87,10 +88,19 @@ Diagnostics::GetFrameOverlayString(const GPUStats& aStats)
gpuTimeString.c_str(),
pixelFillRatio,
screenFillRatio);
nsPrintfCString line3("[Content] DL: %0.1fms FLB: %0.1fms Raster: %0.1fms",
nsCString line3;
if (mDlb2Ms.Average() != 0.0f) {
line3 += nsPrintfCString("[Content] DL: %0.1f/%0.1fms FLB: %0.1fms Raster: %0.1fms",
mDlb2Ms.Average(),
mDlbMs.Average(),
mFlbMs.Average(),
mRasterMs.Average());
} else {
line3 += nsPrintfCString("[Content] DL: %0.1fms FLB: %0.1fms Raster: %0.1fms",
mDlbMs.Average(),
mFlbMs.Average(),
mRasterMs.Average());
}
nsPrintfCString line4("[IPDL] Build: %0.1fms Send: %0.1fms Update: %0.1fms",
mSerializeMs.Average(),
mSendMs.Average(),

View File

@ -101,6 +101,7 @@ private:
FPSCounter mCompositeFps;
FPSCounter mTransactionFps;
TimedMetric mDlbMs;
TimedMetric mDlb2Ms;
TimedMetric mFlbMs;
TimedMetric mRasterMs;
TimedMetric mSerializeMs;

View File

@ -555,6 +555,7 @@ struct PaintTiming {
float serializeMs;
float sendMs;
float dlMs;
float dl2Ms;
float flbMs;
float rasterMs;
};

View File

@ -662,10 +662,13 @@ private:
DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-sensitivity", ScrollSnapPredictionSensitivity, float, 0.750f);
DECL_GFX_PREF(Live, "layout.css.scroll-snap.proximity-threshold", ScrollSnapProximityThreshold, int32_t, 200);
DECL_GFX_PREF(Live, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.build-twice", LayoutDisplayListBuildTwice, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.retain", LayoutRetainDisplayList, bool, true);
DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.dump-content", LayoutDumpDisplayListContent, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.dump-parent", LayoutDumpDisplayListParent, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.show-rebuild-area", LayoutDisplayListShowArea, bool, false);
DECL_GFX_PREF(Live, "layout.event-regions.enabled", LayoutEventRegionsEnabledDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Once, "layout.frame_rate", LayoutFrameRate, int32_t, -1);
DECL_GFX_PREF(Live, "layout.min-active-layer-size", LayoutMinActiveLayerSize, int, 64);

View File

@ -3815,6 +3815,18 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
merged = retainedBuilder->AttemptPartialUpdate(aBackstop);
}
if (merged && gfxPrefs::LayoutDisplayListBuildTwice()) {
merged = false;
if (gfxPrefs::LayersDrawFPS()) {
if (RefPtr<LayerManager> lm = builder.GetWidgetLayerManager()) {
if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(lm)) {
pt->dl2Ms() = (TimeStamp::Now() - dlStart).ToMilliseconds();
}
}
}
dlStart = TimeStamp::Now();
}
if (!merged) {
list.DeleteAll(&builder);
builder.EnterPresShell(aFrame);

View File

@ -2837,6 +2837,15 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
set.Outlines()->DeleteAll(aBuilder);
}
if (hasOverrideDirtyRect && gfxPrefs::LayoutDisplayListShowArea()) {
nsDisplaySolidColor* color =
new (aBuilder) nsDisplaySolidColor(aBuilder, this,
dirtyRect + aBuilder->GetCurrentFrameOffsetToReferenceFrame(),
NS_RGBA(255, 0, 0, 64), false);
color->SetOverrideZIndex(INT32_MAX);
set.PositionedDescendants()->AppendNewToTop(color);
}
// Sort PositionedDescendants() in CSS 'z-order' order. The list is already
// in content document order and SortByZOrder is a stable sort which
// guarantees that boxes produced by the same element are placed together

View File

@ -3558,6 +3558,15 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
building(aBuilder, mOuter, visibleRect, dirtyRect, aBuilder->IsAtRootOfPseudoStackingContext());
mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, scrolledContent);
if (dirtyRectHasBeenOverriden && gfxPrefs::LayoutDisplayListShowArea()) {
nsDisplaySolidColor* color =
new (aBuilder) nsDisplaySolidColor(aBuilder, mOuter,
dirtyRect + aBuilder->GetCurrentFrameOffsetToReferenceFrame(),
NS_RGBA(0, 0, 255, 64), false);
color->SetOverrideZIndex(INT32_MAX);
scrolledContent.PositionedDescendants()->AppendNewToTop(color);
}
}
if (extraContentBoxClipForNonCaretContent) {

View File

@ -3484,8 +3484,9 @@ protected:
class nsDisplaySolidColor : public nsDisplaySolidColorBase {
public:
nsDisplaySolidColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aBounds, nscolor aColor)
const nsRect& aBounds, nscolor aColor, bool aCanBeReused = true)
: nsDisplaySolidColorBase(aBuilder, aFrame, aColor), mBounds(aBounds)
, mCanBeReused(aCanBeReused)
{
NS_ASSERTION(NS_GET_A(aColor) > 0, "Don't create invisible nsDisplaySolidColors!");
MOZ_COUNT_CTOR(nsDisplaySolidColor);
@ -3518,8 +3519,25 @@ public:
NS_DISPLAY_DECL_NAME("SolidColor", TYPE_SOLID_COLOR)
virtual bool CanBeReused() const override { return mCanBeReused; }
int32_t ZIndex() const override
{
if (mOverrideZIndex) {
return mOverrideZIndex.value();
}
return nsDisplaySolidColorBase::ZIndex();
}
void SetOverrideZIndex(int32_t aZIndex)
{
mOverrideZIndex = mozilla::Some(aZIndex);
}
private:
nsRect mBounds;
bool mCanBeReused;
mozilla::Maybe<int32_t> mOverrideZIndex;
};
/**