diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-04 19:49:18 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-04 19:49:18 +0000 |
commit | 7e7d3f44cc3ffbab93a9d3bcab245df660a4e772 (patch) | |
tree | 3861a032284622d8ec31882a2a8686c228a3a8ad /cc/scheduler | |
parent | a5348bf5b6aa0838bd09774d87a93b5c1a2c2ca0 (diff) | |
download | chromium_src-7e7d3f44cc3ffbab93a9d3bcab245df660a4e772.zip chromium_src-7e7d3f44cc3ffbab93a9d3bcab245df660a4e772.tar.gz chromium_src-7e7d3f44cc3ffbab93a9d3bcab245df660a4e772.tar.bz2 |
cc: Fix disabled vsync state freezing
Previously, when vsync was disabled the scheduler state machine would
never proactively request a new begin frame message. This logic was
tightly coupled to commits not being aborted and causing a redraw,
incrementing the frame number, and allowing a number of the "only once
per frame" logic in the state machine to proceed.
Instead, treat disabled vsync like the synchronous compositor. In both
cases, it's undesirable to proactively request a begin frame. For the
synchronous compositor, this is because every begin frame results in a
draw. For the unthrottled disabled vsync case, this is because if the
compositor can't draw it will get into a tight loop of continuing to
request new begin frames. By lumping it with the synchronous compositor
logic, it will periodically poll to see if it needs to start a new frame
rather than freezing forever.
R=brianderson@chromium.org
BUG=303293
Review URL: https://codereview.chromium.org/25494009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/scheduler')
-rw-r--r-- | cc/scheduler/scheduler.cc | 2 | ||||
-rw-r--r-- | cc/scheduler/scheduler_state_machine.cc | 16 | ||||
-rw-r--r-- | cc/scheduler/scheduler_state_machine.h | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc index 64179c7..8de9d382 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc @@ -157,7 +157,7 @@ void Scheduler::SetupNextBeginFrameIfNeeded() { // aren't expecting any more BeginFrames. This should only be needed by the // synchronous compositor when BeginFrameNeededByImplThread is false. if (state_machine_.ShouldPollForAnticipatedDrawTriggers()) { - DCHECK(settings_.using_synchronous_renderer_compositor); + DCHECK(!state_machine_.SupportsProactiveBeginFrame()); DCHECK(!needs_begin_frame); if (poll_for_draw_triggers_closure_.IsCancelled()) { poll_for_draw_triggers_closure_.Reset( diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc index 0178ccb..641c80b 100644 --- a/cc/scheduler/scheduler_state_machine.cc +++ b/cc/scheduler/scheduler_state_machine.cc @@ -751,7 +751,7 @@ bool SchedulerStateMachine::BeginFrameNeededByImplThread() const { // duplicate frames if our new frame isn't ready in time. // To poll for state with the synchronous compositor without having to draw, // we rely on ShouldPollForAnticipatedDrawTriggers instead. - if (settings_.using_synchronous_renderer_compositor) + if (!SupportsProactiveBeginFrame()) return BeginFrameNeededToDrawByImplThread(); return BeginFrameNeededToDrawByImplThread() || @@ -762,7 +762,7 @@ bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { // ShouldPollForAnticipatedDrawTriggers is what we use in place of // ProactiveBeginFrameWantedByImplThread when we are using the synchronous // compositor. - if (settings_.using_synchronous_renderer_compositor) { + if (!SupportsProactiveBeginFrame()) { return !BeginFrameNeededToDrawByImplThread() && ProactiveBeginFrameWantedByImplThread(); } @@ -772,6 +772,14 @@ bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { return false; } +bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { + // Both the synchronous compositor and disabled vsync settings + // make it undesirable to proactively request begin frames. + // If this is true, the scheduler should poll. + return !settings_.using_synchronous_renderer_compositor && + settings_.throttle_frame_production; +} + // These are the cases where we definitely (or almost definitely) have a // new frame to draw and can draw. bool SchedulerStateMachine::BeginFrameNeededToDrawByImplThread() const { @@ -812,10 +820,6 @@ bool SchedulerStateMachine::ProactiveBeginFrameWantedByImplThread() const { if (!HasInitializedOutputSurface()) return false; - // Do not be proactive if vsync is off. - if (!settings_.throttle_frame_production) - return false; - // Do not be proactive when invisible. if (!visible_) return false; diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h index 55e54b5..a473687 100644 --- a/cc/scheduler/scheduler_state_machine.h +++ b/cc/scheduler/scheduler_state_machine.h @@ -223,6 +223,8 @@ class CC_EXPORT SchedulerStateMachine { // True if we need to abort draws to make forward progress. bool PendingDrawsShouldBeAborted() const; + bool SupportsProactiveBeginFrame() const; + protected: bool BeginFrameNeededToDrawByImplThread() const; bool ProactiveBeginFrameWantedByImplThread() const; |