Bug 1138502. Reset vsync unobserve count if a force composite occurs. r=mstange

This commit is contained in:
Mason Chang 2015-03-06 13:58:22 -08:00
parent 2827c4933d
commit 229752182a
2 changed files with 22 additions and 0 deletions

View File

@ -343,6 +343,23 @@ CompositorVsyncObserver::Composite(TimeStamp aVsyncTimestamp)
DispatchTouchEvents(aVsyncTimestamp);
}
void
CompositorVsyncObserver::OnForceComposeToTarget()
{
/**
* bug 1138502 - There are cases such as during long-running window resizing events
* where we receive many sync RecvFlushComposites. We also get vsync notifications which
* will increment mVsyncNotificationsSkipped because a composite just occurred. After
* enough vsyncs and RecvFlushComposites occurred, we will disable vsync. Then at the next
* ScheduleComposite, we will enable vsync, then get a RecvFlushComposite, which will
* force us to unobserve vsync again. On some platforms, enabling/disabling vsync is not
* free and this oscillating behavior causes a performance hit. In order to avoid this problem,
* we reset the mVsyncNotificationsSkipped counter to keep vsync enabled.
*/
MOZ_ASSERT(CompositorParent::IsInCompositorThread());
mVsyncNotificationsSkipped = 0;
}
bool
CompositorVsyncObserver::NeedsComposite()
{
@ -1040,6 +1057,10 @@ CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const nsIntRect* aRe
PROFILER_LABEL("CompositorParent", "ForceComposeToTarget",
js::ProfileEntry::Category::GRAPHICS);
if (mCompositorVsyncObserver) {
mCompositorVsyncObserver->OnForceComposeToTarget();
}
AutoRestore<bool> override(mOverrideComposeReadiness);
mOverrideComposeReadiness = true;

View File

@ -106,6 +106,7 @@ public:
bool NeedsComposite();
void CancelCurrentCompositeTask();
void Destroy();
void OnForceComposeToTarget();
private:
virtual ~CompositorVsyncObserver();