Bug 1371114 - Add gecko profiler labels for WebRender, r=kats
MozReview-Commit-ID: 4TRZgV8X1Ml
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -4,16 +4,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/layers/WebRenderBridgeParent.h"
#include "apz/src/AsyncPanZoomController.h"
#include "CompositableHost.h"
#include "gfxPrefs.h"
+#include "GeckoProfiler.h"
#include "GLContext.h"
#include "GLContextProvider.h"
#include "mozilla/Range.h"
#include "mozilla/layers/AnimationHelper.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/Compositor.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorThread.h"
@@ -307,16 +308,17 @@ WebRenderBridgeParent::HandleDPEnd(const
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId,
const uint64_t& aTransactionId,
const WrSize& aContentSize,
const ByteBuffer& dl,
const WrBuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData)
{
+ GeckoProfilerTracingRAII tracer("Paint", "DPTransaction");
UpdateFwdTransactionId(aFwdTransactionId);
AutoClearReadLocks clearLocks(mReadLocks);
if (mDestroyed) {
for (const auto& op : aToDestroy) {
DestroyActor(op);
}
return;
@@ -831,16 +833,17 @@ WebRenderBridgeParent::SampleAnimations(
}
}
}
}
void
WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect)
{
+ GeckoProfilerTracingRAII tracer("Paint", "CompositeToTraget");
if (mPaused) {
return;
}
const uint32_t maxPendingFrameCount = 2;
if (!mForceRendering &&
wr::RenderThread::Get()->GetPendingFrameCount(mApi->GetId()) > maxPendingFrameCount) {
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -1,16 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebRenderLayerManager.h"
#include "gfxPrefs.h"
+#include "GeckoProfiler.h"
#include "LayersLogging.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/StackingContextHelper.h"
#include "mozilla/layers/TextureClient.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "WebRenderCanvasLayer.h"
#include "WebRenderColorLayer.h"
#include "WebRenderContainerLayer.h"
@@ -174,16 +175,17 @@ WebRenderLayerManager::EndTransaction(Dr
EndTransactionInternal(aCallback, aCallbackData, aFlags);
}
bool
WebRenderLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
void* aCallbackData,
EndTransactionFlags aFlags)
{
+ GeckoProfilerTracingRAII tracer("Paint", "RenderLayers");
mPaintedLayerCallback = aCallback;
mPaintedLayerCallbackData = aCallbackData;
mTransactionIncomplete = false;
if (gfxPrefs::LayersDump()) {
this->Dump();
}
@@ -221,17 +223,21 @@ WebRenderLayerManager::EndTransactionInt
if (mRoot) {
PopulateScrollData(scrollData, mRoot.get());
}
}
bool sync = mTarget != nullptr;
mLatestTransactionId = mTransactionIdAllocator->GetTransactionId();
- WrBridge()->DPEnd(builder, size.ToUnknownSize(), sync, mLatestTransactionId, scrollData);
+ {
+ GeckoProfilerTracingRAII
+ tracer("Paint", sync ? "ForwardDPTransactionSync":"ForwardDPTransaction");
+ WrBridge()->DPEnd(builder, size.ToUnknownSize(), sync, mLatestTransactionId, scrollData);
+ }
MakeSnapshotIfRequired(size);
mNeedsComposite = false;
ClearDisplayItemLayers();
// this may result in Layers being deleted, which results in
// PLayer::Send__delete__() and DeallocShmem()
--- a/gfx/webrender_bindings/RenderThread.cpp
+++ b/gfx/webrender_bindings/RenderThread.cpp
@@ -1,22 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#include "base/task.h"
+#include "GeckoProfiler.h"
#include "RenderThread.h"
#include "nsThreadUtils.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/webrender/RendererOGL.h"
#include "mozilla/webrender/RenderTextureHost.h"
#include "mozilla/widget/CompositorWidget.h"
-#include "base/task.h"
namespace mozilla {
namespace wr {
static StaticRefPtr<RenderThread> sRenderThread;
RenderThread::RenderThread(base::Thread* aThread)
: mThread(aThread)
@@ -173,16 +174,17 @@ NotifyDidRender(layers::CompositorBridge
aBridge->NotifyDidCompositeToPipeline(pipeline, epoch, aStart, aEnd);
}
wr_rendered_epochs_delete(aEpochs);
}
void
RenderThread::UpdateAndRender(wr::WindowId aWindowId)
{
+ GeckoProfilerTracingRAII tracer("Paint", "Composite");
MOZ_ASSERT(IsInRenderThread());
auto it = mRenderers.find(aWindowId);
MOZ_ASSERT(it != mRenderers.end());
if (it == mRenderers.end()) {
return;
}