| Index: cc/scheduler/scheduler_state_machine.h
|
| diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
|
| index cf29ca9b6a53ec89a43c1b20e905e9c4792dff8f..f73b7e894ca2df8d46fc8f913557053c9ac1d7d2 100644
|
| --- a/cc/scheduler/scheduler_state_machine.h
|
| +++ b/cc/scheduler/scheduler_state_machine.h
|
| @@ -67,6 +67,7 @@ class CC_EXPORT SchedulerStateMachine {
|
| BEGIN_IMPL_FRAME_DEADLINE_MODE_IMMEDIATE,
|
| BEGIN_IMPL_FRAME_DEADLINE_MODE_REGULAR,
|
| BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE,
|
| + BEGIN_IMPL_FRAME_DEADLINE_MODE_TRY_TO_AVOID_CHECKERBOARD,
|
| BEGIN_IMPL_FRAME_DEADLINE_MODE_BLOCKED_ON_READY_TO_DRAW,
|
| };
|
| static const char* BeginImplFrameDeadlineModeToString(
|
| @@ -82,14 +83,36 @@ class CC_EXPORT SchedulerStateMachine {
|
| };
|
| static const char* CommitStateToString(CommitState state);
|
|
|
| - enum ForcedRedrawOnTimeoutState {
|
| - FORCED_REDRAW_STATE_IDLE,
|
| - FORCED_REDRAW_STATE_WAITING_FOR_COMMIT,
|
| - FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION,
|
| - FORCED_REDRAW_STATE_WAITING_FOR_DRAW,
|
| + enum PrepareTilesApproach {
|
| + // This approach calls PrepareTiles after every commit and after draws if
|
| + // there wasn't a commit for that frame. With this approach, we cannot trust
|
| + // NotifyReadyToActivate and NotifyReadyToDraw and they should only be used
|
| + // as hints. All other approaches have trustworthy NotifyReadyToActivate's
|
| + // and NotifyReadyToDraw's.
|
| + PREPARE_TILES_APPROACH_PRIORITIZE_LATENCY,
|
| + // This approach only calls PrepareTiles at the start of a frame so new
|
| + // active tree work starts ASAP, but the pending tree work doesn't.
|
| + PREPARE_TILES_APPROACH_ACCURATE_ACTIVE_WORK,
|
| + // This approach calls PrepareTiles at the start of every frame and after
|
| + // every commit so any new work starts ASAP.
|
| + PREPARE_TILES_APPROACH_ACCURATE_ACTIVE_PENDING_WORK,
|
| + // This approach calls PrepareTiles at the start of every frame, after every
|
| + // commit, and after every activation so any new or canceled work is
|
| + // reflected immediately.
|
| + PREPARE_TILES_APPROACH_ACCURATE_ACTIVE_PENDING_CANCELED_WORK,
|
| };
|
| - static const char* ForcedRedrawOnTimeoutStateToString(
|
| - ForcedRedrawOnTimeoutState state);
|
| + static const char* PrepareTilesApproachToString(
|
| + PrepareTilesApproach approach);
|
| +
|
| + enum PrepareTilesReason {
|
| + PREPARE_TILES_NOT_NEEDED,
|
| + PREPARE_TILES_REQUESTED,
|
| + PREPARE_TILES_NEEDED_FOR_COMMIT,
|
| + PREPARE_TILES_NEEDED_FOR_ACTIVATION,
|
| + PREPARE_TILES_NEEDED_FOR_ABORTED_DRAW,
|
| + PREPARE_TILES_NEEDED_TO_EVICT_TILES,
|
| + };
|
| + static const char* PrepareTilesReasonToString(PrepareTilesReason reason);
|
|
|
| bool CommitPending() const {
|
| return commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
|
| @@ -99,7 +122,9 @@ class CC_EXPORT SchedulerStateMachine {
|
| CommitState commit_state() const { return commit_state_; }
|
|
|
| bool RedrawPending() const { return needs_redraw_; }
|
| - bool PrepareTilesPending() const { return needs_prepare_tiles_; }
|
| + bool PrepareTilesPending() const {
|
| + return prepare_tiles_reason_ != PREPARE_TILES_NOT_NEEDED;
|
| + }
|
|
|
| enum Action {
|
| ACTION_NONE,
|
| @@ -126,6 +151,10 @@ class CC_EXPORT SchedulerStateMachine {
|
| // to make progress.
|
| bool BeginFrameNeeded() const;
|
|
|
| + // This reflects the actual state of the BeginFrameSource, not just whether
|
| + // the SchedulerStateMachine wants BeginFrames at this instance.
|
| + void NotifyBeginFrameSourceActive(bool active);
|
| +
|
| // Indicates that the system has entered and left a BeginImplFrame callback.
|
| // The scheduler will not draw more than once in a given BeginImplFrame
|
| // callback nor send more than one BeginMainFrame message.
|
| @@ -159,7 +188,7 @@ class CC_EXPORT SchedulerStateMachine {
|
|
|
| // Indicates that prepare-tiles is required. This guarantees another
|
| // PrepareTiles will occur shortly (even if no redraw is required).
|
| - void SetNeedsPrepareTiles();
|
| + void SetNeedsPrepareTiles(bool for_commit);
|
|
|
| // Make deadline wait for ReadyToDraw signal.
|
| void SetWaitForReadyToDraw();
|
| @@ -186,8 +215,8 @@ class CC_EXPORT SchedulerStateMachine {
|
| return impl_latency_takes_priority_;
|
| }
|
|
|
| - // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen.
|
| - void DidDrawIfPossibleCompleted(DrawResult result);
|
| + // Indicates whether a draw request succeeded or not.
|
| + void SetDrawResult(DrawResult result);
|
|
|
| // Indicates that a new commit flow needs to be performed, either to pull
|
| // updates from the main thread to the impl, or to push deltas from the impl
|
| @@ -224,12 +253,14 @@ class CC_EXPORT SchedulerStateMachine {
|
| // Indicates the active tree's visible tiles are ready to be drawn.
|
| void NotifyReadyToDraw();
|
|
|
| + // Indicates we shouldn't draw the active tree until we won't checkerboard.
|
| + void SetRequiresHighResToDraw(bool required);
|
| +
|
| bool has_pending_tree() const { return has_pending_tree_; }
|
| bool active_tree_needs_first_draw() const {
|
| return active_tree_needs_first_draw_;
|
| }
|
|
|
| - void DidPrepareTiles();
|
| void DidLoseOutputSurface();
|
| void DidCreateAndInitializeOutputSurface();
|
| bool HasInitializedOutputSurface() const;
|
| @@ -291,7 +322,8 @@ class CC_EXPORT SchedulerStateMachine {
|
| OutputSurfaceState output_surface_state_;
|
| BeginImplFrameState begin_impl_frame_state_;
|
| CommitState commit_state_;
|
| - ForcedRedrawOnTimeoutState forced_redraw_state_;
|
| + PrepareTilesApproach prepare_tiles_approach_;
|
| + PrepareTilesReason prepare_tiles_reason_;
|
|
|
| // These are used for tracing only.
|
| int commit_count_;
|
| @@ -308,25 +340,27 @@ class CC_EXPORT SchedulerStateMachine {
|
| bool request_swap_funnel_;
|
| bool send_begin_main_frame_funnel_;
|
| bool invalidate_output_surface_funnel_;
|
| + // TODO(brianderson): Update the comment below.
|
| // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called
|
| // and "drained" on each BeginImplFrame. If the funnel gets too full,
|
| // we start throttling ACTION_PREPARE_TILES such that we average one
|
| // PrepareTiles per BeginImplFrame.
|
| int prepare_tiles_funnel_;
|
|
|
| - int consecutive_checkerboard_animations_;
|
| int max_pending_swaps_;
|
| int pending_swaps_;
|
| bool needs_redraw_;
|
| + DrawResult last_draw_result_;
|
| bool needs_animate_;
|
| - bool needs_prepare_tiles_;
|
| bool needs_commit_;
|
| bool visible_;
|
| bool can_start_;
|
| bool can_draw_;
|
| bool has_pending_tree_;
|
| bool pending_tree_is_ready_for_activation_;
|
| + bool requires_high_res_to_draw_;
|
| bool active_tree_needs_first_draw_;
|
| + bool active_tree_ready_to_draw_;
|
| bool did_create_and_initialize_first_output_surface_;
|
| bool impl_latency_takes_priority_;
|
| bool skip_next_begin_main_frame_to_reduce_latency_;
|
|
|