| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/scheduler/scheduler_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "ui/gfx/frame_time.h" | 12 #include "ui/gfx/frame_time.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) | 16 SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
| 17 : settings_(settings), | 17 : settings_(settings), |
| 18 output_surface_state_(OUTPUT_SURFACE_LOST), | 18 output_surface_state_(OUTPUT_SURFACE_LOST), |
| 19 begin_impl_frame_state_(BEGIN_IMPL_FRAME_STATE_IDLE), | 19 begin_impl_frame_state_(BEGIN_IMPL_FRAME_STATE_IDLE), |
| 20 commit_state_(COMMIT_STATE_IDLE), | 20 commit_state_(COMMIT_STATE_IDLE), |
| 21 forced_redraw_state_(FORCED_REDRAW_STATE_IDLE), | 21 forced_redraw_state_(FORCED_REDRAW_STATE_IDLE), |
| 22 readback_state_(READBACK_STATE_IDLE), | 22 readback_state_(READBACK_STATE_IDLE), |
| 23 commit_count_(0), | 23 commit_count_(0), |
| 24 current_frame_number_(0), | 24 current_frame_number_(0), |
| 25 last_frame_number_animate_performed_(-1), | 25 last_frame_number_animate_performed_(-1), |
| 26 last_frame_number_swap_performed_(-1), | 26 last_frame_number_swap_performed_(-1), |
| 27 last_frame_number_swap_requested_(-1), |
| 27 last_frame_number_begin_main_frame_sent_(-1), | 28 last_frame_number_begin_main_frame_sent_(-1), |
| 28 last_frame_number_update_visible_tiles_was_called_(-1), | 29 last_frame_number_update_visible_tiles_was_called_(-1), |
| 29 manage_tiles_funnel_(0), | 30 manage_tiles_funnel_(0), |
| 30 consecutive_checkerboard_animations_(0), | 31 consecutive_checkerboard_animations_(0), |
| 31 max_pending_swaps_(1), | 32 max_pending_swaps_(1), |
| 32 pending_swaps_(0), | 33 pending_swaps_(0), |
| 33 needs_redraw_(false), | 34 needs_redraw_(false), |
| 34 needs_animate_(false), | 35 needs_animate_(false), |
| 35 needs_manage_tiles_(false), | 36 needs_manage_tiles_(false), |
| 36 swap_used_incomplete_tile_(false), | 37 swap_used_incomplete_tile_(false), |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 state->Set("major_timestamps_in_ms", timestamps_state.release()); | 218 state->Set("major_timestamps_in_ms", timestamps_state.release()); |
| 218 | 219 |
| 219 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue); | 220 scoped_ptr<base::DictionaryValue> minor_state(new base::DictionaryValue); |
| 220 minor_state->SetInteger("commit_count", commit_count_); | 221 minor_state->SetInteger("commit_count", commit_count_); |
| 221 minor_state->SetInteger("current_frame_number", current_frame_number_); | 222 minor_state->SetInteger("current_frame_number", current_frame_number_); |
| 222 | 223 |
| 223 minor_state->SetInteger("last_frame_number_animate_performed", | 224 minor_state->SetInteger("last_frame_number_animate_performed", |
| 224 last_frame_number_animate_performed_); | 225 last_frame_number_animate_performed_); |
| 225 minor_state->SetInteger("last_frame_number_swap_performed", | 226 minor_state->SetInteger("last_frame_number_swap_performed", |
| 226 last_frame_number_swap_performed_); | 227 last_frame_number_swap_performed_); |
| 228 minor_state->SetInteger("last_frame_number_swap_requested", |
| 229 last_frame_number_swap_requested_); |
| 227 minor_state->SetInteger( | 230 minor_state->SetInteger( |
| 228 "last_frame_number_begin_main_frame_sent", | 231 "last_frame_number_begin_main_frame_sent", |
| 229 last_frame_number_begin_main_frame_sent_); | 232 last_frame_number_begin_main_frame_sent_); |
| 230 minor_state->SetInteger( | 233 minor_state->SetInteger( |
| 231 "last_frame_number_update_visible_tiles_was_called", | 234 "last_frame_number_update_visible_tiles_was_called", |
| 232 last_frame_number_update_visible_tiles_was_called_); | 235 last_frame_number_update_visible_tiles_was_called_); |
| 233 | 236 |
| 234 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_); | 237 minor_state->SetInteger("manage_tiles_funnel", manage_tiles_funnel_); |
| 235 minor_state->SetInteger("consecutive_checkerboard_animations", | 238 minor_state->SetInteger("consecutive_checkerboard_animations", |
| 236 consecutive_checkerboard_animations_); | 239 consecutive_checkerboard_animations_); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 288 |
| 286 bool SchedulerStateMachine::HasUpdatedVisibleTilesThisFrame() const { | 289 bool SchedulerStateMachine::HasUpdatedVisibleTilesThisFrame() const { |
| 287 return current_frame_number_ == | 290 return current_frame_number_ == |
| 288 last_frame_number_update_visible_tiles_was_called_; | 291 last_frame_number_update_visible_tiles_was_called_; |
| 289 } | 292 } |
| 290 | 293 |
| 291 bool SchedulerStateMachine::HasSwappedThisFrame() const { | 294 bool SchedulerStateMachine::HasSwappedThisFrame() const { |
| 292 return current_frame_number_ == last_frame_number_swap_performed_; | 295 return current_frame_number_ == last_frame_number_swap_performed_; |
| 293 } | 296 } |
| 294 | 297 |
| 298 bool SchedulerStateMachine::HasRequestedSwapThisFrame() const { |
| 299 return current_frame_number_ == last_frame_number_swap_requested_; |
| 300 } |
| 301 |
| 295 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const { | 302 bool SchedulerStateMachine::PendingDrawsShouldBeAborted() const { |
| 296 // These are all the cases where we normally cannot or do not want to draw | 303 // These are all the cases where we normally cannot or do not want to draw |
| 297 // but, if needs_redraw_ is true and we do not draw to make forward progress, | 304 // but, if needs_redraw_ is true and we do not draw to make forward progress, |
| 298 // we might deadlock with the main thread. | 305 // we might deadlock with the main thread. |
| 299 // This should be a superset of PendingActivationsShouldBeForced() since | 306 // This should be a superset of PendingActivationsShouldBeForced() since |
| 300 // activation of the pending tree is blocked by drawing of the active tree and | 307 // activation of the pending tree is blocked by drawing of the active tree and |
| 301 // the main thread might be blocked on activation of the most recent commit. | 308 // the main thread might be blocked on activation of the most recent commit. |
| 302 if (PendingActivationsShouldBeForced()) | 309 if (PendingActivationsShouldBeForced()) |
| 303 return true; | 310 return true; |
| 304 | 311 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return true; | 370 return true; |
| 364 | 371 |
| 365 // If we need to abort draws, we should do so ASAP since the draw could | 372 // If we need to abort draws, we should do so ASAP since the draw could |
| 366 // be blocking other important actions (like output surface initialization), | 373 // be blocking other important actions (like output surface initialization), |
| 367 // from occuring. If we are waiting for the first draw, then perfom the | 374 // from occuring. If we are waiting for the first draw, then perfom the |
| 368 // aborted draw to keep things moving. If we are not waiting for the first | 375 // aborted draw to keep things moving. If we are not waiting for the first |
| 369 // draw however, we don't want to abort for no reason. | 376 // draw however, we don't want to abort for no reason. |
| 370 if (PendingDrawsShouldBeAborted()) | 377 if (PendingDrawsShouldBeAborted()) |
| 371 return active_tree_needs_first_draw_; | 378 return active_tree_needs_first_draw_; |
| 372 | 379 |
| 373 // After this line, we only want to swap once per frame. | 380 // After this line, we only want to send a swap request once per frame. |
| 374 if (HasSwappedThisFrame()) | 381 if (HasRequestedSwapThisFrame()) |
| 375 return false; | 382 return false; |
| 376 | 383 |
| 377 // Do not queue too many swaps. | 384 // Do not queue too many swaps. |
| 378 if (pending_swaps_ >= max_pending_swaps_) | 385 if (pending_swaps_ >= max_pending_swaps_) |
| 379 return false; | 386 return false; |
| 380 | 387 |
| 381 // Except for the cases above, do not draw outside of the BeginImplFrame | 388 // Except for the cases above, do not draw outside of the BeginImplFrame |
| 382 // deadline. | 389 // deadline. |
| 383 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) | 390 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) |
| 384 return false; | 391 return false; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 | 793 |
| 787 if (!has_pending_tree_ && | 794 if (!has_pending_tree_ && |
| 788 commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) { | 795 commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) { |
| 789 commit_state_ = COMMIT_STATE_IDLE; | 796 commit_state_ = COMMIT_STATE_IDLE; |
| 790 } | 797 } |
| 791 | 798 |
| 792 needs_redraw_ = false; | 799 needs_redraw_ = false; |
| 793 active_tree_needs_first_draw_ = false; | 800 active_tree_needs_first_draw_ = false; |
| 794 | 801 |
| 795 if (did_request_swap) | 802 if (did_request_swap) |
| 796 last_frame_number_swap_performed_ = current_frame_number_; | 803 last_frame_number_swap_requested_ = current_frame_number_; |
| 797 } | 804 } |
| 798 | 805 |
| 799 void SchedulerStateMachine::UpdateStateOnManageTiles() { | 806 void SchedulerStateMachine::UpdateStateOnManageTiles() { |
| 800 needs_manage_tiles_ = false; | 807 needs_manage_tiles_ = false; |
| 801 } | 808 } |
| 802 | 809 |
| 803 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { | 810 void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { |
| 804 skip_next_begin_main_frame_to_reduce_latency_ = true; | 811 skip_next_begin_main_frame_to_reduce_latency_ = true; |
| 805 } | 812 } |
| 806 | 813 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 // If the pending tree activates quickly, we'll want a BeginImplFrame soon | 901 // If the pending tree activates quickly, we'll want a BeginImplFrame soon |
| 895 // to draw the new active tree. | 902 // to draw the new active tree. |
| 896 if (has_pending_tree_) | 903 if (has_pending_tree_) |
| 897 return true; | 904 return true; |
| 898 | 905 |
| 899 // Changing priorities may allow us to activate (given the new priorities), | 906 // Changing priorities may allow us to activate (given the new priorities), |
| 900 // which may result in a new frame. | 907 // which may result in a new frame. |
| 901 if (needs_manage_tiles_) | 908 if (needs_manage_tiles_) |
| 902 return true; | 909 return true; |
| 903 | 910 |
| 904 // If we just swapped, it's likely that we are going to produce another | 911 // If we just sent a swap request, it's likely that we are going to produce |
| 905 // frame soon. This helps avoid negative glitches in our | 912 // another frame soon. This helps avoid negative glitches in our |
| 906 // SetNeedsBeginFrame requests, which may propagate to the BeginImplFrame | 913 // SetNeedsBeginFrame requests, which may propagate to the BeginImplFrame |
| 907 // provider and get sampled at an inopportune time, delaying the next | 914 // provider and get sampled at an inopportune time, delaying the next |
| 908 // BeginImplFrame. | 915 // BeginImplFrame. |
| 909 if (last_frame_number_swap_performed_ == current_frame_number_) | 916 if (HasRequestedSwapThisFrame()) |
| 910 return true; | 917 return true; |
| 911 | 918 |
| 912 return false; | 919 return false; |
| 913 } | 920 } |
| 914 | 921 |
| 915 void SchedulerStateMachine::OnBeginImplFrame(const BeginFrameArgs& args) { | 922 void SchedulerStateMachine::OnBeginImplFrame(const BeginFrameArgs& args) { |
| 916 AdvanceCurrentFrameNumber(); | 923 AdvanceCurrentFrameNumber(); |
| 917 begin_impl_frame_args_ = args; | 924 begin_impl_frame_args_ = args; |
| 918 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE) << *AsValue(); | 925 DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE) << *AsValue(); |
| 919 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING; | 926 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 } | 987 } |
| 981 | 988 |
| 982 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const { | 989 bool SchedulerStateMachine::MainThreadIsInHighLatencyMode() const { |
| 983 // If a commit is pending before the previous commit has been drawn, we | 990 // If a commit is pending before the previous commit has been drawn, we |
| 984 // are definitely in a high latency mode. | 991 // are definitely in a high latency mode. |
| 985 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_)) | 992 if (CommitPending() && (active_tree_needs_first_draw_ || has_pending_tree_)) |
| 986 return true; | 993 return true; |
| 987 | 994 |
| 988 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main | 995 // If we just sent a BeginMainFrame and haven't hit the deadline yet, the main |
| 989 // thread is in a low latency mode. | 996 // thread is in a low latency mode. |
| 990 if (last_frame_number_begin_main_frame_sent_ == current_frame_number_ && | 997 if (HasSentBeginMainFrameThisFrame() && |
| 991 (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING || | 998 (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING || |
| 992 begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME)) | 999 begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME)) |
| 993 return false; | 1000 return false; |
| 994 | 1001 |
| 995 // If there's a commit in progress it must either be from the previous frame | 1002 // If there's a commit in progress it must either be from the previous frame |
| 996 // or it started after the impl thread's deadline. In either case the main | 1003 // or it started after the impl thread's deadline. In either case the main |
| 997 // thread is in high latency mode. | 1004 // thread is in high latency mode. |
| 998 if (commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 1005 if (CommitPending()) |
| 999 commit_state_ == COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED || | |
| 1000 commit_state_ == COMMIT_STATE_READY_TO_COMMIT) | |
| 1001 return true; | 1006 return true; |
| 1002 | 1007 |
| 1003 // Similarly, if there's a pending tree the main thread is in high latency | 1008 // Similarly, if there's a pending tree the main thread is in high latency |
| 1004 // mode, because either | 1009 // mode, because either |
| 1005 // it's from the previous frame | 1010 // it's from the previous frame |
| 1006 // or | 1011 // or |
| 1007 // we're currently drawing the active tree and the pending tree will thus | 1012 // we're currently drawing the active tree and the pending tree will thus |
| 1008 // only be drawn in the next frame. | 1013 // only be drawn in the next frame. |
| 1009 if (has_pending_tree_) | 1014 if (has_pending_tree_) |
| 1010 return true; | 1015 return true; |
| 1011 | 1016 |
| 1012 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) { | 1017 if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) { |
| 1013 // Even if there's a new active tree to draw at the deadline or we've just | 1018 // Even if there's a new active tree to draw at the deadline or we've just |
| 1014 // drawn it, it may have been triggered by a previous BeginImplFrame, in | 1019 // swapped it, it may have been triggered by a previous BeginImplFrame, in |
| 1015 // which case the main thread is in a high latency mode. | 1020 // which case the main thread is in a high latency mode. |
| 1016 return (active_tree_needs_first_draw_ || | 1021 return (active_tree_needs_first_draw_ || HasSwappedThisFrame()) && |
| 1017 last_frame_number_swap_performed_ == current_frame_number_) && | 1022 !HasSentBeginMainFrameThisFrame(); |
| 1018 last_frame_number_begin_main_frame_sent_ != current_frame_number_; | |
| 1019 } | 1023 } |
| 1020 | 1024 |
| 1021 // If the active tree needs its first draw in any other state, we know the | 1025 // If the active tree needs its first draw in any other state, we know the |
| 1022 // main thread is in a high latency mode. | 1026 // main thread is in a high latency mode. |
| 1023 return active_tree_needs_first_draw_; | 1027 return active_tree_needs_first_draw_; |
| 1024 } | 1028 } |
| 1025 | 1029 |
| 1026 void SchedulerStateMachine::DidEnterPollForAnticipatedDrawTriggers() { | 1030 void SchedulerStateMachine::DidEnterPollForAnticipatedDrawTriggers() { |
| 1027 AdvanceCurrentFrameNumber(); | 1031 AdvanceCurrentFrameNumber(); |
| 1028 inside_poll_for_anticipated_draw_triggers_ = true; | 1032 inside_poll_for_anticipated_draw_triggers_ = true; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1050 } | 1054 } |
| 1051 } | 1055 } |
| 1052 | 1056 |
| 1053 void SchedulerStateMachine::SetMaxSwapsPending(int max) { | 1057 void SchedulerStateMachine::SetMaxSwapsPending(int max) { |
| 1054 max_pending_swaps_ = max; | 1058 max_pending_swaps_ = max; |
| 1055 } | 1059 } |
| 1056 | 1060 |
| 1057 void SchedulerStateMachine::DidSwapBuffers() { | 1061 void SchedulerStateMachine::DidSwapBuffers() { |
| 1058 pending_swaps_++; | 1062 pending_swaps_++; |
| 1059 DCHECK_LE(pending_swaps_, max_pending_swaps_); | 1063 DCHECK_LE(pending_swaps_, max_pending_swaps_); |
| 1064 |
| 1065 last_frame_number_swap_performed_ = current_frame_number_; |
| 1060 } | 1066 } |
| 1061 | 1067 |
| 1062 void SchedulerStateMachine::SetSwapUsedIncompleteTile( | 1068 void SchedulerStateMachine::SetSwapUsedIncompleteTile( |
| 1063 bool used_incomplete_tile) { | 1069 bool used_incomplete_tile) { |
| 1064 swap_used_incomplete_tile_ = used_incomplete_tile; | 1070 swap_used_incomplete_tile_ = used_incomplete_tile; |
| 1065 } | 1071 } |
| 1066 | 1072 |
| 1067 void SchedulerStateMachine::DidSwapBuffersComplete() { | 1073 void SchedulerStateMachine::DidSwapBuffersComplete() { |
| 1068 DCHECK_GT(pending_swaps_, 0); | 1074 DCHECK_GT(pending_swaps_, 0); |
| 1069 pending_swaps_--; | 1075 pending_swaps_--; |
| 1070 } | 1076 } |
| 1071 | 1077 |
| 1072 void SchedulerStateMachine::SetSmoothnessTakesPriority( | 1078 void SchedulerStateMachine::SetSmoothnessTakesPriority( |
| 1073 bool smoothness_takes_priority) { | 1079 bool smoothness_takes_priority) { |
| 1074 smoothness_takes_priority_ = smoothness_takes_priority; | 1080 smoothness_takes_priority_ = smoothness_takes_priority; |
| 1075 } | 1081 } |
| 1076 | 1082 |
| 1077 void SchedulerStateMachine::DidDrawIfPossibleCompleted( | 1083 void SchedulerStateMachine::DidDrawIfPossibleCompleted(DrawResult result) { |
| 1078 DrawSwapReadbackResult::DrawResult result) { | |
| 1079 switch (result) { | 1084 switch (result) { |
| 1080 case DrawSwapReadbackResult::INVALID_RESULT: | 1085 case INVALID_RESULT: |
| 1081 NOTREACHED() << "Uninitialized DrawSwapReadbackResult."; | 1086 NOTREACHED() << "Uninitialized DrawResult."; |
| 1082 break; | 1087 break; |
| 1083 case DrawSwapReadbackResult::DRAW_ABORTED_CANT_DRAW: | 1088 case DRAW_ABORTED_CANT_DRAW: |
| 1084 case DrawSwapReadbackResult::DRAW_ABORTED_CANT_READBACK: | 1089 case DRAW_ABORTED_CANT_READBACK: |
| 1085 case DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST: | 1090 case DRAW_ABORTED_CONTEXT_LOST: |
| 1086 NOTREACHED() << "Invalid return value from DrawAndSwapIfPossible:" | 1091 NOTREACHED() << "Invalid return value from DrawAndSwapIfPossible:" |
| 1087 << result; | 1092 << result; |
| 1088 break; | 1093 break; |
| 1089 case DrawSwapReadbackResult::DRAW_SUCCESS: | 1094 case DRAW_SUCCESS: |
| 1090 consecutive_checkerboard_animations_ = 0; | 1095 consecutive_checkerboard_animations_ = 0; |
| 1091 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; | 1096 forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; |
| 1092 break; | 1097 break; |
| 1093 case DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS: | 1098 case DRAW_ABORTED_CHECKERBOARD_ANIMATIONS: |
| 1094 needs_redraw_ = true; | 1099 needs_redraw_ = true; |
| 1095 | 1100 |
| 1096 // If we're already in the middle of a redraw, we don't need to | 1101 // If we're already in the middle of a redraw, we don't need to |
| 1097 // restart it. | 1102 // restart it. |
| 1098 if (forced_redraw_state_ != FORCED_REDRAW_STATE_IDLE) | 1103 if (forced_redraw_state_ != FORCED_REDRAW_STATE_IDLE) |
| 1099 return; | 1104 return; |
| 1100 | 1105 |
| 1101 needs_commit_ = true; | 1106 needs_commit_ = true; |
| 1102 consecutive_checkerboard_animations_++; | 1107 consecutive_checkerboard_animations_++; |
| 1103 if (settings_.timeout_and_draw_when_animation_checkerboards && | 1108 if (settings_.timeout_and_draw_when_animation_checkerboards && |
| 1104 consecutive_checkerboard_animations_ >= | 1109 consecutive_checkerboard_animations_ >= |
| 1105 settings_.maximum_number_of_failed_draws_before_draw_is_forced_) { | 1110 settings_.maximum_number_of_failed_draws_before_draw_is_forced_) { |
| 1106 consecutive_checkerboard_animations_ = 0; | 1111 consecutive_checkerboard_animations_ = 0; |
| 1107 // We need to force a draw, but it doesn't make sense to do this until | 1112 // We need to force a draw, but it doesn't make sense to do this until |
| 1108 // we've committed and have new textures. | 1113 // we've committed and have new textures. |
| 1109 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT; | 1114 forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT; |
| 1110 } | 1115 } |
| 1111 break; | 1116 break; |
| 1112 case DrawSwapReadbackResult::DRAW_ABORTED_MISSING_HIGH_RES_CONTENT: | 1117 case DRAW_ABORTED_MISSING_HIGH_RES_CONTENT: |
| 1113 // It's not clear whether this missing content is because of missing | 1118 // It's not clear whether this missing content is because of missing |
| 1114 // pictures (which requires a commit) or because of memory pressure | 1119 // pictures (which requires a commit) or because of memory pressure |
| 1115 // removing textures (which might not). To be safe, request a commit | 1120 // removing textures (which might not). To be safe, request a commit |
| 1116 // anyway. | 1121 // anyway. |
| 1117 needs_commit_ = true; | 1122 needs_commit_ = true; |
| 1118 break; | 1123 break; |
| 1119 } | 1124 } |
| 1120 } | 1125 } |
| 1121 | 1126 |
| 1122 void SchedulerStateMachine::SetNeedsCommit() { needs_commit_ = true; } | 1127 void SchedulerStateMachine::SetNeedsCommit() { needs_commit_ = true; } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 case OUTPUT_SURFACE_ACTIVE: | 1227 case OUTPUT_SURFACE_ACTIVE: |
| 1223 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1228 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
| 1224 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1229 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
| 1225 return true; | 1230 return true; |
| 1226 } | 1231 } |
| 1227 NOTREACHED(); | 1232 NOTREACHED(); |
| 1228 return false; | 1233 return false; |
| 1229 } | 1234 } |
| 1230 | 1235 |
| 1231 } // namespace cc | 1236 } // namespace cc |
| OLD | NEW |