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

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

Issue 1887243002: cc: Remove retro frames from scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 NOTREACHED(); 80 NOTREACHED();
81 return "???"; 81 return "???";
82 } 82 }
83 83
84 const char* SchedulerStateMachine::BeginImplFrameStateToString( 84 const char* SchedulerStateMachine::BeginImplFrameStateToString(
85 BeginImplFrameState state) { 85 BeginImplFrameState state) {
86 switch (state) { 86 switch (state) {
87 case BEGIN_IMPL_FRAME_STATE_IDLE: 87 case BEGIN_IMPL_FRAME_STATE_IDLE:
88 return "BEGIN_IMPL_FRAME_STATE_IDLE"; 88 return "BEGIN_IMPL_FRAME_STATE_IDLE";
89 case BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING:
90 return "BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING";
91 case BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME: 89 case BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME:
92 return "BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME"; 90 return "BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME";
93 case BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE: 91 case BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE:
94 return "BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE"; 92 return "BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE";
95 } 93 }
96 NOTREACHED(); 94 NOTREACHED();
97 return "???"; 95 return "???";
98 } 96 }
99 97
100 const char* SchedulerStateMachine::BeginImplFrameDeadlineModeToString( 98 const char* SchedulerStateMachine::BeginImplFrameDeadlineModeToString(
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 527
530 bool SchedulerStateMachine::ShouldInvalidateOutputSurface() const { 528 bool SchedulerStateMachine::ShouldInvalidateOutputSurface() const {
531 // Do not invalidate too many times in a frame. 529 // Do not invalidate too many times in a frame.
532 if (invalidate_output_surface_funnel_) 530 if (invalidate_output_surface_funnel_)
533 return false; 531 return false;
534 532
535 // Only the synchronous compositor requires invalidations. 533 // Only the synchronous compositor requires invalidations.
536 if (!settings_.using_synchronous_renderer_compositor) 534 if (!settings_.using_synchronous_renderer_compositor)
537 return false; 535 return false;
538 536
539 // Invalidations are only performed inside a BeginFrame. 537 // Invalidate only within a BeginFrame.
540 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING) 538 if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME)
541 return false; 539 return false;
542 540
543 // TODO(sunnyps): needs_prepare_tiles_ is needed here because PrepareTiles is 541 // TODO(sunnyps): needs_prepare_tiles_ is needed here because PrepareTiles is
544 // called only inside the deadline / draw phase. We could remove this if we 542 // called only inside the deadline / draw phase. We could remove this if we
545 // allowed PrepareTiles to happen in OnBeginImplFrame. 543 // allowed PrepareTiles to happen in OnBeginImplFrame.
546 return needs_redraw_ || needs_prepare_tiles_; 544 return needs_redraw_ || needs_prepare_tiles_;
547 } 545 }
548 546
549 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const { 547 SchedulerStateMachine::Action SchedulerStateMachine::NextAction() const {
550 if (ShouldActivatePendingTree()) 548 if (ShouldActivatePendingTree())
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 851
854 // If the last commit was aborted because of early out (no updates), we should 852 // If the last commit was aborted because of early out (no updates), we should
855 // still want a begin frame in case there is a commit coming again. 853 // still want a begin frame in case there is a commit coming again.
856 if (last_commit_had_no_updates_) 854 if (last_commit_had_no_updates_)
857 return true; 855 return true;
858 856
859 return false; 857 return false;
860 } 858 }
861 859
862 void SchedulerStateMachine::OnBeginImplFrame() { 860 void SchedulerStateMachine::OnBeginImplFrame() {
863 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING; 861 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME;
864 current_frame_number_++; 862 current_frame_number_++;
865 863
866 last_commit_had_no_updates_ = false; 864 last_commit_had_no_updates_ = false;
867 did_draw_in_last_frame_ = false; 865 did_draw_in_last_frame_ = false;
868 did_swap_in_last_frame_ = false; 866 did_swap_in_last_frame_ = false;
869 needs_one_begin_impl_frame_ = false; 867 needs_one_begin_impl_frame_ = false;
870 868
871 // Clear funnels for any actions we perform during the frame. 869 // Clear funnels for any actions we perform during the frame.
872 send_begin_main_frame_funnel_ = false; 870 send_begin_main_frame_funnel_ = false;
873 invalidate_output_surface_funnel_ = false; 871 invalidate_output_surface_funnel_ = false;
874 872
875 // "Drain" the PrepareTiles funnel. 873 // "Drain" the PrepareTiles funnel.
876 if (prepare_tiles_funnel_ > 0) 874 if (prepare_tiles_funnel_ > 0)
877 prepare_tiles_funnel_--; 875 prepare_tiles_funnel_--;
878 } 876 }
879 877
880 void SchedulerStateMachine::OnBeginImplFrameDeadlinePending() {
881 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME;
882 }
883
884 void SchedulerStateMachine::OnBeginImplFrameDeadline() { 878 void SchedulerStateMachine::OnBeginImplFrameDeadline() {
885 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE; 879 begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE;
886 880
887 // Clear funnels for any actions we perform during the deadline. 881 // Clear funnels for any actions we perform during the deadline.
888 draw_funnel_ = false; 882 draw_funnel_ = false;
889 883
890 // Allow one PrepareTiles per draw for synchronous compositor. 884 // Allow one PrepareTiles per draw for synchronous compositor.
891 if (settings_.using_synchronous_renderer_compositor) { 885 if (settings_.using_synchronous_renderer_compositor) {
892 if (prepare_tiles_funnel_ > 0) 886 if (prepare_tiles_funnel_ > 0)
893 prepare_tiles_funnel_--; 887 prepare_tiles_funnel_--;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 case OUTPUT_SURFACE_ACTIVE: 1146 case OUTPUT_SURFACE_ACTIVE:
1153 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: 1147 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT:
1154 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: 1148 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION:
1155 return true; 1149 return true;
1156 } 1150 }
1157 NOTREACHED(); 1151 NOTREACHED();
1158 return false; 1152 return false;
1159 } 1153 }
1160 1154
1161 } // namespace cc 1155 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698