mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1903553
- Add perf stats for frame building and fix corresponding glean probe. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D215626
This commit is contained in:
parent
3d1e7c742a
commit
0a68b380ae
@ -657,10 +657,12 @@ void RenderThread::HandleFrameOneDocInner(wr::WindowId aWindowId, bool aRender,
|
||||
SetFramePublishId(aWindowId, aPublishId.ref());
|
||||
}
|
||||
|
||||
RendererStats stats = {0};
|
||||
|
||||
UpdateAndRender(aWindowId, frame.mStartId, frame.mStartTime, render,
|
||||
/* aReadbackSize */ Nothing(),
|
||||
/* aReadbackFormat */ Nothing(),
|
||||
/* aReadbackBuffer */ Nothing());
|
||||
/* aReadbackBuffer */ Nothing(), &stats);
|
||||
|
||||
// The start time is from WebRenderBridgeParent::CompositeToTarget. From that
|
||||
// point until now (when the frame is finally pushed to the screen) is
|
||||
@ -669,6 +671,12 @@ void RenderThread::HandleFrameOneDocInner(wr::WindowId aWindowId, bool aRender,
|
||||
mozilla::glean::gfx::composite_time.AccumulateRawDuration(compositeDuration);
|
||||
PerfStats::RecordMeasurement(PerfStats::Metric::Compositing,
|
||||
compositeDuration);
|
||||
if (stats.frame_build_time > 0.0) {
|
||||
TimeDuration fbTime =
|
||||
TimeDuration::FromMilliseconds(stats.frame_build_time);
|
||||
mozilla::glean::wr::framebuild_time.AccumulateRawDuration(fbTime);
|
||||
PerfStats::RecordMeasurement(PerfStats::Metric::FrameBuilding, fbTime);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderThread::SetClearColor(wr::WindowId aWindowId, wr::ColorF aColor) {
|
||||
@ -780,7 +788,8 @@ void RenderThread::UpdateAndRender(
|
||||
const TimeStamp& aStartTime, bool aRender,
|
||||
const Maybe<gfx::IntSize>& aReadbackSize,
|
||||
const Maybe<wr::ImageFormat>& aReadbackFormat,
|
||||
const Maybe<Range<uint8_t>>& aReadbackBuffer, bool* aNeedsYFlip) {
|
||||
const Maybe<Range<uint8_t>>& aReadbackBuffer, RendererStats* aStats,
|
||||
bool* aNeedsYFlip) {
|
||||
AUTO_PROFILER_LABEL("RenderThread::UpdateAndRender", GRAPHICS);
|
||||
MOZ_ASSERT(IsInRenderThread());
|
||||
MOZ_ASSERT(aRender || aReadbackBuffer.isNothing());
|
||||
@ -811,10 +820,9 @@ void RenderThread::UpdateAndRender(
|
||||
renderer->GetCompositorBridge()));
|
||||
|
||||
wr::RenderedFrameId latestFrameId;
|
||||
RendererStats stats = {0};
|
||||
if (aRender) {
|
||||
latestFrameId = renderer->UpdateAndRender(
|
||||
aReadbackSize, aReadbackFormat, aReadbackBuffer, aNeedsYFlip, &stats);
|
||||
aReadbackSize, aReadbackFormat, aReadbackBuffer, aNeedsYFlip, aStats);
|
||||
} else {
|
||||
renderer->Update();
|
||||
}
|
||||
@ -829,7 +837,7 @@ void RenderThread::UpdateAndRender(
|
||||
layers::CompositorThread()->Dispatch(
|
||||
NewRunnableFunction("NotifyDidRenderRunnable", &NotifyDidRender,
|
||||
renderer->GetCompositorBridge(), info, aStartId,
|
||||
aStartTime, start, end, aRender, stats));
|
||||
aStartTime, start, end, aRender, *aStats));
|
||||
|
||||
ipc::FileDescriptor fenceFd;
|
||||
|
||||
|
@ -204,7 +204,7 @@ class RenderThread final {
|
||||
const Maybe<gfx::IntSize>& aReadbackSize,
|
||||
const Maybe<wr::ImageFormat>& aReadbackFormat,
|
||||
const Maybe<Range<uint8_t>>& aReadbackBuffer,
|
||||
bool* aNeedsYFlip = nullptr);
|
||||
RendererStats* aStats, bool* aNeedsYFlip = nullptr);
|
||||
|
||||
void Pause(wr::WindowId aWindowId);
|
||||
bool Resume(wr::WindowId aWindowId);
|
||||
|
@ -695,10 +695,11 @@ void WebRenderAPI::Readback(const TimeStamp& aStartTime, gfx::IntSize size,
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(Readback)
|
||||
|
||||
void Run(RenderThread& aRenderThread, WindowId aWindowId) override {
|
||||
RendererStats stats = {0};
|
||||
aRenderThread.UpdateAndRender(aWindowId, VsyncId(), mStartTime,
|
||||
/* aRender */ true, Some(mSize),
|
||||
wr::SurfaceFormatToImageFormat(mFormat),
|
||||
Some(mBuffer), mNeedsYFlip);
|
||||
Some(mBuffer), &stats, mNeedsYFlip);
|
||||
layers::AutoCompleteTask complete(mTask);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
MACRO(Rasterizing) \
|
||||
MACRO(WrDisplayListBuilding) \
|
||||
MACRO(LayerTransactions) \
|
||||
MACRO(FrameBuilding) \
|
||||
MACRO(Compositing) \
|
||||
MACRO(Reflowing) \
|
||||
MACRO(Styling) \
|
||||
|
Loading…
Reference in New Issue
Block a user