Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: cc/scheduler/scheduler_state_machine.cc

Issue 918883002: Change input latency result to depend on start of GPU swap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skip late missed BFs; don't wait for browser long; Renderer latency recovery Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/surfaces/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 return true; 811 return true;
812 812
813 // If the last commit was aborted because of early out (no updates), we should 813 // If the last commit was aborted because of early out (no updates), we should
814 // still want a begin frame in case there is a commit coming again. 814 // still want a begin frame in case there is a commit coming again.
815 if (last_commit_had_no_updates_) 815 if (last_commit_had_no_updates_)
816 return true; 816 return true;
817 817
818 return false; 818 return false;
819 } 819 }
820 820
821 void SchedulerStateMachine::DidSkipBeginImplFrameToReduceLatency() {
822 last_swap_ack_came_after_begin_impl_frame_ = false;
823 }
824
821 void SchedulerStateMachine::OnBeginImplFrame() { 825 void SchedulerStateMachine::OnBeginImplFrame() {
822 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING; 826 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING;
823 current_frame_number_++; 827 current_frame_number_++;
824 828
825 last_commit_had_no_updates_ = false; 829 last_commit_had_no_updates_ = false;
826 did_request_swap_in_last_frame_ = false; 830 did_request_swap_in_last_frame_ = false;
827 831
828 // Clear funnels for any actions we perform during the frame. 832 // Clear funnels for any actions we perform during the frame.
829 animate_funnel_ = false; 833 animate_funnel_ = false;
830 send_begin_main_frame_funnel_ = false; 834 send_begin_main_frame_funnel_ = false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 } else { 879 } else {
876 // The impl thread doesn't have anything it wants to draw and we are just 880 // The impl thread doesn't have anything it wants to draw and we are just
877 // waiting for a new active tree or we are swap throttled. In short we are 881 // waiting for a new active tree or we are swap throttled. In short we are
878 // blocked. 882 // blocked.
879 return BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE; 883 return BEGIN_IMPL_FRAME_DEADLINE_MODE_LATE;
880 } 884 }
881 } 885 }
882 886
883 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately() 887 bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately()
884 const { 888 const {
885 // TODO(brianderson): This should take into account multiple commit sources.
886 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME) 889 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME)
887 return false; 890 return false;
888 891
889 // If things are being aborted, end the current BeginImplFrame ASAP so we can 892 // If things are being aborted, end the current BeginImplFrame ASAP so we can
890 // unblock creating the next output surface. 893 // unblock creating the next output surface.
891 if (PendingDrawsShouldBeAborted()) 894 if (PendingDrawsShouldBeAborted())
892 return true; 895 return true;
893 896
894 // SwapAck throttle the deadline since we wont draw and swap anyway. 897 // SwapAck throttle the deadline since we wont draw and swap anyway.
895 if (pending_swaps_ >= max_pending_swaps_) 898 if (pending_swaps_ >= max_pending_swaps_)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 pending_swaps_++; 990 pending_swaps_++;
988 DCHECK_LE(pending_swaps_, max_pending_swaps_); 991 DCHECK_LE(pending_swaps_, max_pending_swaps_);
989 992
990 did_perform_swap_in_last_draw_ = true; 993 did_perform_swap_in_last_draw_ = true;
991 last_frame_number_swap_performed_ = current_frame_number_; 994 last_frame_number_swap_performed_ = current_frame_number_;
992 } 995 }
993 996
994 void SchedulerStateMachine::DidSwapBuffersComplete() { 997 void SchedulerStateMachine::DidSwapBuffersComplete() {
995 DCHECK_GT(pending_swaps_, 0); 998 DCHECK_GT(pending_swaps_, 0);
996 pending_swaps_--; 999 pending_swaps_--;
1000 last_swap_ack_came_after_begin_impl_frame_ =
1001 begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE;
997 } 1002 }
998 1003
999 void SchedulerStateMachine::SetImplLatencyTakesPriority( 1004 void SchedulerStateMachine::SetImplLatencyTakesPriority(
1000 bool impl_latency_takes_priority) { 1005 bool impl_latency_takes_priority) {
1001 impl_latency_takes_priority_ = impl_latency_takes_priority; 1006 impl_latency_takes_priority_ = impl_latency_takes_priority;
1002 } 1007 }
1003 1008
1004 void SchedulerStateMachine::DidDrawIfPossibleCompleted(DrawResult result) { 1009 void SchedulerStateMachine::DidDrawIfPossibleCompleted(DrawResult result) {
1005 switch (result) { 1010 switch (result) {
1006 case INVALID_RESULT: 1011 case INVALID_RESULT:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 static_cast<int>(begin_impl_frame_state_), 1144 static_cast<int>(begin_impl_frame_state_),
1140 static_cast<int>(commit_state_), 1145 static_cast<int>(commit_state_),
1141 has_pending_tree_ ? 'T' : 'F', 1146 has_pending_tree_ ? 'T' : 'F',
1142 pending_tree_is_ready_for_activation_ ? 'T' : 'F', 1147 pending_tree_is_ready_for_activation_ ? 'T' : 'F',
1143 active_tree_needs_first_draw_ ? 'T' : 'F', 1148 active_tree_needs_first_draw_ ? 'T' : 'F',
1144 max_pending_swaps_, 1149 max_pending_swaps_,
1145 pending_swaps_); 1150 pending_swaps_);
1146 } 1151 }
1147 1152
1148 } // namespace cc 1153 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/surfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698