| Index: cc/scheduler/scheduler_state_machine.cc
|
| diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
|
| index 2bbf2563264bb1365654663e8d13435346357137..79507c5808b38e0841d9b6c6309567633edb8088 100644
|
| --- a/cc/scheduler/scheduler_state_machine.cc
|
| +++ b/cc/scheduler/scheduler_state_machine.cc
|
| @@ -28,6 +28,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
|
| last_frame_number_update_visible_tiles_was_called_(-1),
|
| manage_tiles_funnel_(0),
|
| consecutive_checkerboard_animations_(0),
|
| + max_pending_swaps_(1),
|
| + pending_swaps_(0),
|
| needs_redraw_(false),
|
| needs_manage_tiles_(false),
|
| swap_used_incomplete_tile_(false),
|
| @@ -247,6 +249,8 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const {
|
| minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_);
|
| minor_state->SetInteger("consecutive_checkerboard_animations",
|
| consecutive_checkerboard_animations_);
|
| + minor_state->SetInteger("max_pending_swaps_", max_pending_swaps_);
|
| + minor_state->SetInteger("pending_swaps_", pending_swaps_);
|
| minor_state->SetBoolean("needs_redraw", needs_redraw_);
|
| minor_state->SetBoolean("needs_manage_tiles", needs_manage_tiles_);
|
| minor_state->SetBoolean("swap_used_incomplete_tile",
|
| @@ -391,6 +395,10 @@ bool SchedulerStateMachine::ShouldDraw() const {
|
| if (HasSwappedThisFrame())
|
| return false;
|
|
|
| + // Do not queue too many swaps.
|
| + if (pending_swaps_ >= max_pending_swaps_)
|
| + return false;
|
| +
|
| // Except for the cases above, do not draw outside of the BeginImplFrame
|
| // deadline.
|
| if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE)
|
| @@ -508,6 +516,11 @@ bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
|
| if (!HasInitializedOutputSurface())
|
| return false;
|
|
|
| + // SwapAck throttle the BeginMainFrames
|
| + // TODO(brianderson): Remove this restriction to improve throughput.
|
| + if (pending_swaps_ >= max_pending_swaps_)
|
| + return false;
|
| +
|
| if (skip_begin_main_frame_to_reduce_latency_)
|
| return false;
|
|
|
| @@ -839,8 +852,7 @@ bool SchedulerStateMachine::SupportsProactiveBeginImplFrame() const {
|
| // Both the synchronous compositor and disabled vsync settings
|
| // make it undesirable to proactively request BeginImplFrames.
|
| // If this is true, the scheduler should poll.
|
| - return !settings_.using_synchronous_renderer_compositor &&
|
| - settings_.throttle_frame_production;
|
| + return !settings_.using_synchronous_renderer_compositor;
|
| }
|
|
|
| // These are the cases where we definitely (or almost definitely) have a
|
| @@ -955,6 +967,10 @@ bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineEarly() const {
|
| if (output_surface_state_ == OUTPUT_SURFACE_LOST)
|
| return true;
|
|
|
| + // SwapAck throttle the deadline since we wont draw and swap anyway.
|
| + if (pending_swaps_ >= max_pending_swaps_)
|
| + return false;
|
| +
|
| if (active_tree_needs_first_draw_)
|
| return true;
|
|
|
| @@ -1043,11 +1059,26 @@ void SchedulerStateMachine::SetNeedsManageTiles() {
|
| }
|
| }
|
|
|
| +void SchedulerStateMachine::SetMaxSwapsPending(int max) {
|
| + max_pending_swaps_ = max;
|
| +}
|
| +
|
| +void SchedulerStateMachine::DidSwapBuffers() {
|
| + pending_swaps_++;
|
| + DCHECK_LE(pending_swaps_, max_pending_swaps_);
|
| +}
|
| +
|
| void SchedulerStateMachine::SetSwapUsedIncompleteTile(
|
| bool used_incomplete_tile) {
|
| swap_used_incomplete_tile_ = used_incomplete_tile;
|
| }
|
|
|
| +void SchedulerStateMachine::OnSwapBuffersComplete() {
|
| + DCHECK(HasInitializedOutputSurface());
|
| + DCHECK_GT(pending_swaps_, 0);
|
| + pending_swaps_--;
|
| +}
|
| +
|
| void SchedulerStateMachine::SetSmoothnessTakesPriority(
|
| bool smoothness_takes_priority) {
|
| smoothness_takes_priority_ = smoothness_takes_priority;
|
| @@ -1153,6 +1184,7 @@ void SchedulerStateMachine::DidLoseOutputSurface() {
|
| return;
|
| output_surface_state_ = OUTPUT_SURFACE_LOST;
|
| needs_redraw_ = false;
|
| + pending_swaps_ = 0;
|
| }
|
|
|
| void SchedulerStateMachine::NotifyReadyToActivate() {
|
|
|