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
Родитель b232b5d003
Коммит e45770707b
2 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -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;

Просмотреть файл

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