Bug 1361915 - Record telemetry each time we try to run a transform animation on the compositor. r=birtles,bsmedberg
The telemetry is recorded once per effect:target pair, and is intended for comparison with the telemetry added in bug 1349808. MozReview-Commit-ID: 8JYbAifjmki
This commit is contained in:
@@ -134,6 +134,7 @@ KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
||||
// too so we have a more complete picture of the type of frame sizes we
|
||||
// encounter, hence we reset the telemetry flag here.
|
||||
mRecordedContentTooLarge = false;
|
||||
mRecordedFrameSize = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1662,6 +1662,14 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::RecordFrameSizeTelemetry(uint32_t aPixelArea) {
|
||||
if (!mRecordedFrameSize) {
|
||||
Telemetry::Accumulate(Telemetry::ASYNC_ANIMATION_FRAME_SIZE, aPixelArea);
|
||||
mRecordedFrameSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
static already_AddRefed<nsStyleContext>
|
||||
CreateStyleContextForAnimationValue(nsCSSPropertyID aProperty,
|
||||
const StyleAnimationValue& aValue,
|
||||
|
||||
@@ -257,6 +257,9 @@ public:
|
||||
nsCSSPropertyID aProperty,
|
||||
const AnimationPerformanceWarning& aWarning);
|
||||
|
||||
// Record telemetry about the size of the content being animated.
|
||||
void RecordFrameSizeTelemetry(uint32_t aPixelArea);
|
||||
|
||||
// Cumulative change hint on each segment for each property.
|
||||
// This is used for deciding the animation is paint-only.
|
||||
void CalculateCumulativeChangeHint(nsStyleContext* aStyleContext);
|
||||
@@ -416,6 +419,10 @@ protected:
|
||||
// per effect:target pair so we use this member to record if we have already
|
||||
// reported a "ContentTooLarge" warning for the current target.
|
||||
bool mRecordedContentTooLarge = false;
|
||||
// Similarly, as a point of comparison we record telemetry whether or not
|
||||
// we get a "ContentTooLarge" warning, but again only once per effect:target
|
||||
// pair.
|
||||
bool mRecordedFrameSize = false;
|
||||
|
||||
private:
|
||||
nsChangeHint mCumulativeChangeHint;
|
||||
|
||||
@@ -7336,6 +7336,21 @@ static nsRect ComputePartialPrerenderArea(const nsRect& aDirtyRect,
|
||||
return result.MoveInsideAndClamp(aOverflow);
|
||||
}
|
||||
|
||||
static void
|
||||
RecordAnimationFrameSizeTelemetry(nsIFrame* aFrame, const nsSize& overflow)
|
||||
{
|
||||
gfxSize scale = nsLayoutUtils::GetTransformToAncestorScale(aFrame);
|
||||
nsSize frameSize = nsSize(overflow.width * scale.width,
|
||||
overflow.height * scale.height);
|
||||
uint32_t pixelArea = uint32_t(nsPresContext::AppUnitsToIntCSSPixels(frameSize.width))
|
||||
* nsPresContext::AppUnitsToIntCSSPixels(frameSize.height);
|
||||
if (EffectSet* effects = EffectSet::GetEffectSet(aFrame)) {
|
||||
for (KeyframeEffectReadOnly* effect : *effects) {
|
||||
effect->RecordFrameSizeTelemetry(pixelArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ auto
|
||||
nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
@@ -7356,9 +7371,17 @@ nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBui
|
||||
return NoPrerender;
|
||||
}
|
||||
|
||||
nsRect overflow = aFrame->GetVisualOverflowRectRelativeToSelf();
|
||||
|
||||
// Record telemetry about the size of the animated content.
|
||||
// Check CanRecordExtended() so we don't do any processing if the
|
||||
// telemetry won't be recorded anyways.
|
||||
if (Telemetry::CanRecordExtended()) {
|
||||
RecordAnimationFrameSizeTelemetry(aFrame, overflow.Size());
|
||||
}
|
||||
|
||||
// If the incoming dirty rect already contains the entire overflow area,
|
||||
// we are already rendering the entire content.
|
||||
nsRect overflow = aFrame->GetVisualOverflowRectRelativeToSelf();
|
||||
if (aDirtyRect->Contains(overflow)) {
|
||||
return FullPrerender;
|
||||
}
|
||||
|
||||
@@ -176,6 +176,15 @@
|
||||
"bug_numbers": [1100357, 1349808],
|
||||
"description": "The ratio of the frame size (in total number of pixels) to the relative limit (~viewport size plus some tolerance factor, typically 12.5% in each dimension, i.e. ~27% tolerance in total area) for each time we encountered a layer that was so large we decided not to run its animations on the compositor expressed as a percentage (e.g. 130 = frame area was 30% larger than the relative limit)"
|
||||
},
|
||||
"ASYNC_ANIMATION_FRAME_SIZE": {
|
||||
"alert_emails": ["bbirtles@mozilla.com"],
|
||||
"expires_in_version": "59",
|
||||
"kind": "exponential",
|
||||
"high": 80000000,
|
||||
"n_buckets": 100,
|
||||
"bug_numbers": [1100357, 1361915],
|
||||
"description": "The number of pixels of the frame each time we potentially run a transform animation on the compositor. Intended for comparison with ASYNC_ANIMATION_CONTENT_TOO_LARGE_FRAME_SIZE. "
|
||||
},
|
||||
"AUDIOSTREAM_FIRST_OPEN_MS": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "50",
|
||||
|
||||
Reference in New Issue
Block a user