Commit 1545de0e authored by brianderson's avatar brianderson Committed by Commit bot

cc: Add debug info for unexpected SwapBuffersComplete

Unexpected SwapBuffersComplete's can arrive for two common reasons:
1) DidSwapBuffersComplete is getting called before DidSwapBuffers.
2) A swap ack from the previous OutputSurface arrives.

This extra debug info will allow us to determine which case
we are in.

BUG=495650
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1153283009

Cr-Commit-Position: refs/heads/master@{#333148}
parent cefb99b8
...@@ -226,6 +226,7 @@ void Scheduler::DidSwapBuffers() { ...@@ -226,6 +226,7 @@ void Scheduler::DidSwapBuffers() {
} }
void Scheduler::DidSwapBuffersComplete() { void Scheduler::DidSwapBuffersComplete() {
DCHECK_GT(state_machine_.pending_swaps(), 0) << AsValue()->ToString();
state_machine_.DidSwapBuffersComplete(); state_machine_.DidSwapBuffersComplete();
ProcessScheduledActions(); ProcessScheduledActions();
} }
...@@ -772,14 +773,16 @@ void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { ...@@ -772,14 +773,16 @@ void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const {
estimated_parent_draw_time_.InMillisecondsF()); estimated_parent_draw_time_.InMillisecondsF());
state->SetBoolean("last_set_needs_begin_frame_", state->SetBoolean("last_set_needs_begin_frame_",
frame_source_->NeedsBeginFrames()); frame_source_->NeedsBeginFrames());
state->SetInteger("begin_retro_frame_args_", state->SetInteger("begin_retro_frame_args",
static_cast<int>(begin_retro_frame_args_.size())); static_cast<int>(begin_retro_frame_args_.size()));
state->SetBoolean("begin_retro_frame_task_", state->SetBoolean("begin_retro_frame_task",
!begin_retro_frame_task_.IsCancelled()); !begin_retro_frame_task_.IsCancelled());
state->SetBoolean("begin_impl_frame_deadline_task_", state->SetBoolean("begin_impl_frame_deadline_task",
!begin_impl_frame_deadline_task_.IsCancelled()); !begin_impl_frame_deadline_task_.IsCancelled());
state->SetBoolean("advance_commit_state_task_", state->SetBoolean("advance_commit_state_task",
!advance_commit_state_task_.IsCancelled()); !advance_commit_state_task_.IsCancelled());
state->SetString("inside_action",
SchedulerStateMachine::ActionToString(inside_action_));
state->BeginDictionary("begin_impl_frame_args"); state->BeginDictionary("begin_impl_frame_args");
begin_impl_frame_tracker_.AsValueInto(Now(), state); begin_impl_frame_tracker_.AsValueInto(Now(), state);
state->EndDictionary(); state->EndDictionary();
......
...@@ -34,6 +34,7 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) ...@@ -34,6 +34,7 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
consecutive_checkerboard_animations_(0), consecutive_checkerboard_animations_(0),
max_pending_swaps_(1), max_pending_swaps_(1),
pending_swaps_(0), pending_swaps_(0),
swaps_with_current_output_surface_(0),
needs_redraw_(false), needs_redraw_(false),
needs_animate_(false), needs_animate_(false),
needs_prepare_tiles_(false), needs_prepare_tiles_(false),
...@@ -217,6 +218,8 @@ void SchedulerStateMachine::AsValueInto( ...@@ -217,6 +218,8 @@ void SchedulerStateMachine::AsValueInto(
consecutive_checkerboard_animations_); consecutive_checkerboard_animations_);
state->SetInteger("max_pending_swaps_", max_pending_swaps_); state->SetInteger("max_pending_swaps_", max_pending_swaps_);
state->SetInteger("pending_swaps_", pending_swaps_); state->SetInteger("pending_swaps_", pending_swaps_);
state->SetInteger("swaps_with_current_output_surface",
swaps_with_current_output_surface_);
state->SetBoolean("needs_redraw", needs_redraw_); state->SetBoolean("needs_redraw", needs_redraw_);
state->SetBoolean("needs_animate_", needs_animate_); state->SetBoolean("needs_animate_", needs_animate_);
state->SetBoolean("needs_prepare_tiles", needs_prepare_tiles_); state->SetBoolean("needs_prepare_tiles", needs_prepare_tiles_);
...@@ -1019,6 +1022,8 @@ void SchedulerStateMachine::SetMaxSwapsPending(int max) { ...@@ -1019,6 +1022,8 @@ void SchedulerStateMachine::SetMaxSwapsPending(int max) {
void SchedulerStateMachine::DidSwapBuffers() { void SchedulerStateMachine::DidSwapBuffers() {
pending_swaps_++; pending_swaps_++;
swaps_with_current_output_surface_++;
DCHECK_LE(pending_swaps_, max_pending_swaps_); DCHECK_LE(pending_swaps_, max_pending_swaps_);
did_perform_swap_in_last_draw_ = true; did_perform_swap_in_last_draw_ = true;
...@@ -1026,7 +1031,6 @@ void SchedulerStateMachine::DidSwapBuffers() { ...@@ -1026,7 +1031,6 @@ void SchedulerStateMachine::DidSwapBuffers() {
} }
void SchedulerStateMachine::DidSwapBuffersComplete() { void SchedulerStateMachine::DidSwapBuffersComplete() {
DCHECK_GT(pending_swaps_, 0);
pending_swaps_--; pending_swaps_--;
} }
...@@ -1144,6 +1148,7 @@ void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() { ...@@ -1144,6 +1148,7 @@ void SchedulerStateMachine::DidCreateAndInitializeOutputSurface() {
} }
did_create_and_initialize_first_output_surface_ = true; did_create_and_initialize_first_output_surface_ = true;
pending_swaps_ = 0; pending_swaps_ = 0;
swaps_with_current_output_surface_ = 0;
} }
void SchedulerStateMachine::NotifyBeginMainFrameStarted() { void SchedulerStateMachine::NotifyBeginMainFrameStarted() {
......
...@@ -179,6 +179,8 @@ class CC_EXPORT SchedulerStateMachine { ...@@ -179,6 +179,8 @@ class CC_EXPORT SchedulerStateMachine {
// Notification from the OutputSurface that a swap has been consumed. // Notification from the OutputSurface that a swap has been consumed.
void DidSwapBuffersComplete(); void DidSwapBuffersComplete();
int pending_swaps() const { return pending_swaps_; }
// Indicates whether to prioritize impl thread latency (i.e., animation // Indicates whether to prioritize impl thread latency (i.e., animation
// smoothness) over new content activation. // smoothness) over new content activation.
void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); void SetImplLatencyTakesPriority(bool impl_latency_takes_priority);
...@@ -320,6 +322,7 @@ class CC_EXPORT SchedulerStateMachine { ...@@ -320,6 +322,7 @@ class CC_EXPORT SchedulerStateMachine {
int consecutive_checkerboard_animations_; int consecutive_checkerboard_animations_;
int max_pending_swaps_; int max_pending_swaps_;
int pending_swaps_; int pending_swaps_;
int swaps_with_current_output_surface_;
bool needs_redraw_; bool needs_redraw_;
bool needs_animate_; bool needs_animate_;
bool needs_prepare_tiles_; bool needs_prepare_tiles_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment