diff options
author | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-22 16:17:28 +0000 |
---|---|---|
committer | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-22 16:17:28 +0000 |
commit | b56e320cce0c1425ab09b11baf2be9c214a36140 (patch) | |
tree | 0b80f7711799abf1c8741c14dd259acc3d3d5368 /cc/scheduler/scheduler_state_machine.cc | |
parent | 04941ecad2a0ef7a38069a9e784f45d3b500abe6 (diff) | |
download | chromium_src-b56e320cce0c1425ab09b11baf2be9c214a36140.zip chromium_src-b56e320cce0c1425ab09b11baf2be9c214a36140.tar.gz chromium_src-b56e320cce0c1425ab09b11baf2be9c214a36140.tar.bz2 |
cc: Prioritize impl-thread drawing in scheduler in smoothness mode
When the compositor is in prefer smoothness mode, prioritize impl-thread
draws over main thread frames and tree activations in the scheduler.
This makes it less likely for us to drop frames during
smoothness-triggering gestures such as flings and pinch-zooms. The
tradeoff is that main thread updates will have higher latency in these
modes.
BUG=309630
Review URL: https://codereview.chromium.org/35013002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/scheduler/scheduler_state_machine.cc')
-rw-r--r-- | cc/scheduler/scheduler_state_machine.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc index c14186a..227d5ed 100644 --- a/cc/scheduler/scheduler_state_machine.cc +++ b/cc/scheduler/scheduler_state_machine.cc @@ -39,7 +39,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) pending_tree_is_ready_for_activation_(false), active_tree_needs_first_draw_(false), draw_if_possible_failed_(false), - did_create_and_initialize_first_output_surface_(false) {} + did_create_and_initialize_first_output_surface_(false), + smoothness_takes_priority_(false) {} const char* SchedulerStateMachine::OutputSurfaceStateToString( OutputSurfaceState state) { @@ -255,6 +256,8 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const { minor_state->SetBoolean("draw_if_possible_failed", draw_if_possible_failed_); minor_state->SetBoolean("did_create_and_initialize_first_output_surface", did_create_and_initialize_first_output_surface_); + minor_state->SetBoolean("smoothness_takes_priority", + smoothness_takes_priority_); state->Set("minor_state", minor_state.release()); return state.PassAs<base::Value>(); @@ -896,12 +899,19 @@ bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineEarly() const { if (active_tree_needs_first_draw_) return true; + if (!needs_redraw_) + return false; + // This is used to prioritize impl-thread draws when the main thread isn't // producing anything, e.g., after an aborted commit. We also check that we // don't have a pending tree -- otherwise we should give it a chance to // activate. // TODO(skyostil): Revisit this when we have more accurate deadline estimates. - if (commit_state_ == COMMIT_STATE_IDLE && needs_redraw_ && !has_pending_tree_) + if (commit_state_ == COMMIT_STATE_IDLE && !has_pending_tree_) + return true; + + // Prioritize impl-thread draws in smoothness mode. + if (smoothness_takes_priority_) return true; return false; @@ -935,6 +945,11 @@ void SchedulerStateMachine::SetSwapUsedIncompleteTile( swap_used_incomplete_tile_ = used_incomplete_tile; } +void SchedulerStateMachine::SetSmoothnessTakesPriority( + bool smoothness_takes_priority) { + smoothness_takes_priority_ = smoothness_takes_priority; +} + void SchedulerStateMachine::DidDrawIfPossibleCompleted(bool success) { draw_if_possible_failed_ = !success; if (draw_if_possible_failed_) { |