summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-04-04 11:58:59 +0800
committerMoonchild <moonchild@palemoon.org>2022-10-23 21:43:46 +0000
commit362a84565c0154b71e6b8b581f7a94e2051385a7 (patch)
treee8215972776a036acaf8487af2ca9a0772977104 /gfx
parentd8ef6bf7af085c252027fd3cfc6106ca69c61df4 (diff)
downloaduxp-362a84565c0154b71e6b8b581f7a94e2051385a7.tar.gz
Issue #21 - Remove panning/tab animation performance measurements
Based on FranklinDM's follow-up for the issue. This would require browser FE changes, particularly removing the associated code in `tabbrowser.xml`, however, that was already done in Pale Moon previously. Other front-end applications may need to take note, though. Based on changes from the following bugs: * Bug 696398 - Need an api to analyze panning performance * Bug 800031 - Include paint time in tab switch telemetry * Bug 820167 - Enable performance measurement of tab animation * Bug 826383 - Improve Start/Stop FrameTimeRecording for telemetry usage
Diffstat (limited to 'gfx')
-rw-r--r--gfx/layers/Layers.cpp109
-rw-r--r--gfx/layers/Layers.h51
-rw-r--r--gfx/layers/basic/BasicLayerManager.cpp2
-rw-r--r--gfx/layers/client/ClientLayerManager.cpp22
-rw-r--r--gfx/layers/client/ClientLayerManager.h5
-rw-r--r--gfx/layers/composite/LayerManagerComposite.cpp2
-rw-r--r--gfx/layers/ipc/CompositorBridgeChild.cpp18
-rw-r--r--gfx/layers/ipc/CompositorBridgeChild.h2
-rw-r--r--gfx/layers/ipc/CompositorBridgeParent.cpp21
-rw-r--r--gfx/layers/ipc/CompositorBridgeParent.h2
-rw-r--r--gfx/layers/ipc/CrossProcessCompositorBridgeParent.h2
-rw-r--r--gfx/layers/ipc/PCompositorBridge.ipdl6
12 files changed, 0 insertions, 242 deletions
diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp
index 991e8ed2f0..724f2c7fdf 100644
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1545,115 +1545,6 @@ RefLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
aAttrs = RefLayerAttributes(GetReferentId(), mEventRegionsOverride);
}
-/**
- * StartFrameTimeRecording, together with StopFrameTimeRecording
- * enable recording of frame intervals.
- *
- * To allow concurrent consumers, a cyclic array is used which serves all
- * consumers, practically stateless with regard to consumers.
- *
- * To save resources, the buffer is allocated on first call to StartFrameTimeRecording
- * and recording is paused if no consumer which called StartFrameTimeRecording is able
- * to get valid results (because the cyclic buffer was overwritten since that call).
- *
- * To determine availability of the data upon StopFrameTimeRecording:
- * - mRecording.mNextIndex increases on each PostPresent, and never resets.
- * - Cyclic buffer position is realized as mNextIndex % bufferSize.
- * - StartFrameTimeRecording returns mNextIndex. When StopFrameTimeRecording is called,
- * the required start index is passed as an arg, and we're able to calculate the required
- * length. If this length is bigger than bufferSize, it means data was overwritten.
- * otherwise, we can return the entire sequence.
- * - To determine if we need to pause, mLatestStartIndex is updated to mNextIndex
- * on each call to StartFrameTimeRecording. If this index gets overwritten,
- * it means that all earlier start indices obtained via StartFrameTimeRecording
- * were also overwritten, hence, no point in recording, so pause.
- * - mCurrentRunStartIndex indicates the oldest index of the recording after which
- * the recording was not paused. If StopFrameTimeRecording is invoked with a start index
- * older than this, it means that some frames were not recorded, so data is invalid.
- */
-uint32_t
-LayerManager::StartFrameTimeRecording(int32_t aBufferSize)
-{
- if (mRecording.mIsPaused) {
- mRecording.mIsPaused = false;
-
- if (!mRecording.mIntervals.Length()) { // Initialize recording buffers
- mRecording.mIntervals.SetLength(aBufferSize);
- }
-
- // After being paused, recent values got invalid. Update them to now.
- mRecording.mLastFrameTime = TimeStamp::Now();
-
- // Any recording which started before this is invalid, since we were paused.
- mRecording.mCurrentRunStartIndex = mRecording.mNextIndex;
- }
-
- // If we'll overwrite this index, there are no more consumers with aStartIndex
- // for which we're able to provide the full recording, so no point in keep recording.
- mRecording.mLatestStartIndex = mRecording.mNextIndex;
- return mRecording.mNextIndex;
-}
-
-void
-LayerManager::RecordFrame()
-{
- if (!mRecording.mIsPaused) {
- TimeStamp now = TimeStamp::Now();
- uint32_t i = mRecording.mNextIndex % mRecording.mIntervals.Length();
- mRecording.mIntervals[i] = static_cast<float>((now - mRecording.mLastFrameTime)
- .ToMilliseconds());
- mRecording.mNextIndex++;
- mRecording.mLastFrameTime = now;
-
- if (mRecording.mNextIndex > (mRecording.mLatestStartIndex + mRecording.mIntervals.Length())) {
- // We've just overwritten the most recent recording start -> pause.
- mRecording.mIsPaused = true;
- }
- }
-}
-
-void
-LayerManager::PostPresent()
-{
- if (!mTabSwitchStart.IsNull()) {
- mTabSwitchStart = TimeStamp();
- }
-}
-
-void
-LayerManager::StopFrameTimeRecording(uint32_t aStartIndex,
- nsTArray<float>& aFrameIntervals)
-{
- uint32_t bufferSize = mRecording.mIntervals.Length();
- uint32_t length = mRecording.mNextIndex - aStartIndex;
- if (mRecording.mIsPaused || length > bufferSize || aStartIndex < mRecording.mCurrentRunStartIndex) {
- // aStartIndex is too old. Also if aStartIndex was issued before mRecordingNextIndex overflowed (uint32_t)
- // and stopped after the overflow (would happen once every 828 days of constant 60fps).
- length = 0;
- }
-
- if (!length) {
- aFrameIntervals.Clear();
- return; // empty recording, return empty arrays.
- }
- // Set length in advance to avoid possibly repeated reallocations
- aFrameIntervals.SetLength(length);
-
- uint32_t cyclicPos = aStartIndex % bufferSize;
- for (uint32_t i = 0; i < length; i++, cyclicPos++) {
- if (cyclicPos == bufferSize) {
- cyclicPos = 0;
- }
- aFrameIntervals[i] = mRecording.mIntervals[cyclicPos];
- }
-}
-
-void
-LayerManager::BeginTabSwitch()
-{
- mTabSwitchStart = TimeStamp::Now();
-}
-
static void PrintInfo(std::stringstream& aStream, LayerComposite* aLayerComposite);
#ifdef MOZ_DUMP_PAINTING
diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h
index 805d41d48e..8b5e0a4ab5 100644
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -586,36 +586,6 @@ public:
*/
void LogSelf(const char* aPrefix="");
- /**
- * Record (and return) frame-intervals and paint-times for frames which were presented
- * between calling StartFrameTimeRecording and StopFrameTimeRecording.
- *
- * - Uses a cyclic buffer and serves concurrent consumers, so if Stop is called too late
- * (elements were overwritten since Start), result is considered invalid and hence empty.
- * - Buffer is capable of holding 10 seconds @ 60fps (or more if frames were less frequent).
- * Can be changed (up to 1 hour) via pref: toolkit.framesRecording.bufferSize.
- * - Note: the first frame-interval may be longer than expected because last frame
- * might have been presented some time before calling StartFrameTimeRecording.
- */
-
- /**
- * Returns a handle which represents current recording start position.
- */
- virtual uint32_t StartFrameTimeRecording(int32_t aBufferSize);
-
- /**
- * Clears, then populates aFrameIntervals with the recorded frame timing
- * data. The array will be empty if data was overwritten since
- * aStartIndex was obtained.
- */
- virtual void StopFrameTimeRecording(uint32_t aStartIndex,
- nsTArray<float>& aFrameIntervals);
-
- void RecordFrame();
- void PostPresent();
-
- void BeginTabSwitch();
-
static bool IsLogEnabled();
static mozilla::LogModule* GetLog();
@@ -686,27 +656,6 @@ protected:
TimeStamp mAnimationReadyTime;
// The count of pixels that were painted in the current transaction.
uint32_t mPaintedPixelCount;
-private:
- struct FramesTimingRecording
- {
- // Stores state and data for frame intervals and paint times recording.
- // see LayerManager::StartFrameTimeRecording() at Layers.cpp for more details.
- FramesTimingRecording()
- : mNextIndex(0)
- , mLatestStartIndex(0)
- , mCurrentRunStartIndex(0)
- , mIsPaused(true)
- {}
- nsTArray<float> mIntervals;
- TimeStamp mLastFrameTime;
- uint32_t mNextIndex;
- uint32_t mLatestStartIndex;
- uint32_t mCurrentRunStartIndex;
- bool mIsPaused;
- };
- FramesTimingRecording mRecording;
-
- TimeStamp mTabSwitchStart;
public:
/*
diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp
index 41c37dc8ea..91e0696aa7 100644
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -629,8 +629,6 @@ BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
if (mWidget) {
FlashWidgetUpdateArea(mTarget);
}
- RecordFrame();
- PostPresent();
if (!mTransactionIncomplete) {
// Clear out target if we have a complete transaction.
diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp
index ddca3ec3c1..95af8fb5fc 100644
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -617,28 +617,6 @@ ClientLayerManager::SendInvalidRegion(const nsIntRegion& aRegion)
}
}
-uint32_t
-ClientLayerManager::StartFrameTimeRecording(int32_t aBufferSize)
-{
- CompositorBridgeChild* renderer = GetRemoteRenderer();
- if (renderer) {
- uint32_t startIndex;
- renderer->SendStartFrameTimeRecording(aBufferSize, &startIndex);
- return startIndex;
- }
- return -1;
-}
-
-void
-ClientLayerManager::StopFrameTimeRecording(uint32_t aStartIndex,
- nsTArray<float>& aFrameIntervals)
-{
- CompositorBridgeChild* renderer = GetRemoteRenderer();
- if (renderer) {
- renderer->SendStopFrameTimeRecording(aStartIndex, &aFrameIntervals);
- }
-}
-
void
ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
{
diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h
index 5bcd5e4121..e7ea7f8116 100644
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -98,11 +98,6 @@ public:
virtual void FlushRendering() override;
void SendInvalidRegion(const nsIntRegion& aRegion);
- virtual uint32_t StartFrameTimeRecording(int32_t aBufferSize) override;
-
- virtual void StopFrameTimeRecording(uint32_t aStartIndex,
- nsTArray<float>& aFrameIntervals) override;
-
virtual bool NeedsWidgetInvalidation() override { return false; }
ShadowableLayer* Hold(Layer* aLayer);
diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp
index 0ee11bdfb1..fde5eb1c57 100644
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -966,8 +966,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
}
mCompositor->GetWidget()->PostRender(&widgetContext);
-
- RecordFrame();
}
already_AddRefed<PaintedLayerComposite>
diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp
index f0a1b861ae..ed5c3d52c5 100644
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -803,24 +803,6 @@ CompositorBridgeChild::SendFlushRendering()
}
bool
-CompositorBridgeChild::SendStartFrameTimeRecording(const int32_t& bufferSize, uint32_t* startIndex)
-{
- if (!mCanSend) {
- return false;
- }
- return PCompositorBridgeChild::SendStartFrameTimeRecording(bufferSize, startIndex);
-}
-
-bool
-CompositorBridgeChild::SendStopFrameTimeRecording(const uint32_t& startIndex, nsTArray<float>* intervals)
-{
- if (!mCanSend) {
- return false;
- }
- return PCompositorBridgeChild::SendStopFrameTimeRecording(startIndex, intervals);
-}
-
-bool
CompositorBridgeChild::SendNotifyRegionInvalidated(const nsIntRegion& region)
{
if (!mCanSend) {
diff --git a/gfx/layers/ipc/CompositorBridgeChild.h b/gfx/layers/ipc/CompositorBridgeChild.h
index e5a4906b3e..55b8d37c2d 100644
--- a/gfx/layers/ipc/CompositorBridgeChild.h
+++ b/gfx/layers/ipc/CompositorBridgeChild.h
@@ -159,8 +159,6 @@ public:
bool SendMakeSnapshot(const SurfaceDescriptor& inSnapshot, const gfx::IntRect& dirtyRect);
bool SendFlushRendering();
bool SendGetTileSize(int32_t* tileWidth, int32_t* tileHeight);
- bool SendStartFrameTimeRecording(const int32_t& bufferSize, uint32_t* startIndex);
- bool SendStopFrameTimeRecording(const uint32_t& startIndex, nsTArray<float>* intervals);
bool SendNotifyRegionInvalidated(const nsIntRegion& region);
bool SendRequestNotifyAfterRemotePaint();
bool SendClearApproximatelyVisibleRegions(uint64_t aLayersId, uint32_t aPresShellId);
diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp
index d08176b6a5..f92e74c147 100644
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -817,27 +817,6 @@ CompositorBridgeParent::Invalidate()
}
bool
-CompositorBridgeParent::RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex)
-{
- if (mLayerManager) {
- *aOutStartIndex = mLayerManager->StartFrameTimeRecording(aBufferSize);
- } else {
- *aOutStartIndex = 0;
- }
- return true;
-}
-
-bool
-CompositorBridgeParent::RecvStopFrameTimeRecording(const uint32_t& aStartIndex,
- InfallibleTArray<float>* intervals)
-{
- if (mLayerManager) {
- mLayerManager->StopFrameTimeRecording(aStartIndex, *intervals);
- }
- return true;
-}
-
-bool
CompositorBridgeParent::RecvClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId)
{
diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h
index d4f2da54c2..98812f75c8 100644
--- a/gfx/layers/ipc/CompositorBridgeParent.h
+++ b/gfx/layers/ipc/CompositorBridgeParent.h
@@ -281,8 +281,6 @@ public:
}
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override;
- virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) override;
- virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) override;
// Unused for chrome <-> compositor communication (which this class does).
// @see CrossProcessCompositorBridgeParent::RecvRequestNotifyAfterRemotePaint
diff --git a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h
index 76a90f71b1..919fcfbc4f 100644
--- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h
+++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.h
@@ -56,8 +56,6 @@ public:
virtual bool RecvFlushRendering() override { return true; }
virtual bool RecvForcePresent() override { return true; }
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override { return true; }
- virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) override { return true; }
- virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) override { return true; }
virtual bool RecvClearApproximatelyVisibleRegions(const uint64_t& aLayersId,
const uint32_t& aPresShellId) override;
diff --git a/gfx/layers/ipc/PCompositorBridge.ipdl b/gfx/layers/ipc/PCompositorBridge.ipdl
index 03a3535063..f47e45d92c 100644
--- a/gfx/layers/ipc/PCompositorBridge.ipdl
+++ b/gfx/layers/ipc/PCompositorBridge.ipdl
@@ -184,12 +184,6 @@ parent:
// work around a windows presentation bug (See Bug 1232042)
async ForcePresent();
- sync StartFrameTimeRecording(int32_t bufferSize)
- returns (uint32_t startIndex);
-
- sync StopFrameTimeRecording(uint32_t startIndex)
- returns (float[] intervals);
-
// layersBackendHints is an ordered list of preffered backends where
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
// that hint is ignored.