Bug 1578042 - Add a CompositionOpportunityId counter and implement it for WebRender. r=nical

This ID is different from the IDs we already have:
 - It is different from VsyncId because it doesn't skip numbers when composites
   are delayed.
 - It is different from RenderedFrameId because it also increases for no-op
   composites.
 - It is different from transaction IDs and epochs because it doesn't care about
   the content side, it just looks at compositing.

It is currently not implemented for non-WR. In non-WR the video frame drop
detection wouldn't properly work anyway, because UpdateCompositedFrame is not
called on every composite for non-WR.

Differential Revision: https://phabricator.services.mozilla.com/D83461
This commit is contained in:
Markus Stange 2020-07-16 03:37:02 +00:00
parent 8b30d46d48
commit 8dfd00ccf3
3 changed files with 18 additions and 0 deletions

View File

@ -151,6 +151,20 @@ struct LayersObserverEpoch {
}
};
// CompositionOpportunityId is a counter that goes up every time we have an
// opportunity to composite. It increments even on no-op composites (if nothing
// has changed) and while compositing is paused. It does not skip values if a
// composite is delayed. It is meaningful per window.
// This counter is used to differentiate intentionally-skipped video frames from
// unintentionally-skipped video frames: If CompositionOpportunityIds are
// observed by the video in +1 increments, then the video was onscreen the
// entire time and compositing was not paused. But if gaps in
// CompositionOpportunityIds are observed, that must mean that the video was not
// considered during some composition opportunities, because compositing was
// paused or because the video was not part of the on-screen scene.
class CompositionOpportunityType {};
typedef BaseTransactionId<CompositionOpportunityType> CompositionOpportunityId;
enum class LayersBackend : int8_t {
LAYERS_NONE = 0,
LAYERS_BASIC,

View File

@ -1960,6 +1960,7 @@ void WebRenderBridgeParent::CompositeToTarget(VsyncId aId,
AUTO_PROFILER_TRACING_MARKER("Paint", "CompositeToTarget", GRAPHICS);
if (mPaused || !mReceivedDisplayList) {
ResetPreviousSampleTime();
mCompositionOpportunityId = mCompositionOpportunityId.Next();
TimeStamp now = TimeStamp::Now();
PROFILER_ADD_TEXT_MARKER("SkippedComposite",
mPaused ? "Paused"_ns : "No display list"_ns,
@ -1987,6 +1988,8 @@ void WebRenderBridgeParent::CompositeToTarget(VsyncId aId,
JS::ProfilingCategoryPair::GRAPHICS, now, now);
return;
}
mCompositionOpportunityId = mCompositionOpportunityId.Next();
MaybeGenerateFrame(aId, /* aForceGenerateFrame */ false);
}

View File

@ -506,6 +506,7 @@ class WebRenderBridgeParent final
std::queue<CompositorAnimationIdsForEpoch> mCompositorAnimationsToDelete;
wr::Epoch mWrEpoch;
wr::IdNamespace mIdNamespace;
CompositionOpportunityId mCompositionOpportunityId;
VsyncId mSkippedCompositeId;
TimeStamp mMostRecentComposite;