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

Unified Diff: cc/scheduler/scheduler.cc

Issue 1131633003: cc: Use multiple PrepareTiles approaches Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler.cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 535d1056bd382eb5d31c23b736787b2cb7db7672..1664896cc8588c538567d7e9c26127529f792276 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -168,6 +168,11 @@ void Scheduler::NotifyReadyToActivate() {
ProcessScheduledActions();
}
+void Scheduler::SetRequiresHighResToDraw(bool required) {
+ state_machine_.SetRequiresHighResToDraw(required);
+ ProcessScheduledActions();
+}
+
void Scheduler::NotifyReadyToDraw() {
// Future work might still needed for crbug.com/352894.
state_machine_.NotifyReadyToDraw();
@@ -199,9 +204,8 @@ void Scheduler::SetNeedsAnimate() {
ProcessScheduledActions();
}
-void Scheduler::SetNeedsPrepareTiles() {
- DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_PREPARE_TILES));
- state_machine_.SetNeedsPrepareTiles();
+void Scheduler::SetNeedsPrepareTiles(bool for_commit) {
+ state_machine_.SetNeedsPrepareTiles(for_commit);
ProcessScheduledActions();
}
@@ -247,10 +251,6 @@ void Scheduler::BeginMainFrameAborted(CommitEarlyOutReason reason) {
ProcessScheduledActions();
}
-void Scheduler::DidPrepareTiles() {
- state_machine_.DidPrepareTiles();
-}
-
void Scheduler::DidLoseOutputSurface() {
TRACE_EVENT0("cc", "Scheduler::DidLoseOutputSurface");
begin_retro_frame_args_.clear();
@@ -291,8 +291,9 @@ base::TimeTicks Scheduler::LastBeginImplFrameTime() {
void Scheduler::SetupNextBeginFrameIfNeeded() {
// Never call SetNeedsBeginFrames if the frame source already has the right
// value.
- if (frame_source_->NeedsBeginFrames() != state_machine_.BeginFrameNeeded()) {
- if (state_machine_.BeginFrameNeeded()) {
+ bool begin_frames_needed = state_machine_.BeginFrameNeeded();
+ if (frame_source_->NeedsBeginFrames() != begin_frames_needed) {
+ if (begin_frames_needed) {
// Call SetNeedsBeginFrames(true) as soon as possible.
frame_source_->SetNeedsBeginFrames(true);
} else if (state_machine_.begin_impl_frame_state() ==
@@ -301,6 +302,7 @@ void Scheduler::SetupNextBeginFrameIfNeeded() {
frame_source_->SetNeedsBeginFrames(false);
client_->SendBeginMainFrameNotExpectedSoon();
}
+ state_machine_.NotifyBeginFrameSourceActive(begin_frames_needed);
}
PostBeginRetroFrameIfNeeded();
@@ -518,6 +520,30 @@ void Scheduler::BeginImplFrameSynchronous(const BeginFrameArgs& args) {
FinishImplFrame();
}
+// Retry the BeginImplFrame if the draw aborted due to checkerboards and
+// we need a new commit to get a new RasterSource.
+void Scheduler::RetryBeginImplFrameWithDeadline() {
+ TRACE_EVENT0("cc", "Scheduler::RetryBeginImplFrameWithDeadline");
+ state_machine_.ResetRetryBeginImplFrame();
+
+ BeginImplFrame();
+
+ // The deadline will be scheduled in ProcessScheduledActions.
+ state_machine_.OnBeginImplFrameDeadlinePending();
+ ProcessScheduledActions();
+}
+
+// Retry the deadline if the draw aborted due to checkerboards, but we
+// do not need a new commit to get a new RasterSource.
+void Scheduler::RetryBeginImplFrameDeadline() {
+ TRACE_EVENT0("cc", "Scheduler::RetryImplFrameDeadline");
+ state_machine_.ResetRetryBeginImplFrame();
+
+ // The deadline will be scheduled in ProcessScheduledActions.
+ state_machine_.OnBeginImplFrameDeadlinePending();
+ ProcessScheduledActions();
+}
+
void Scheduler::FinishImplFrame() {
state_machine_.OnBeginImplFrameIdle();
ProcessScheduledActions();
@@ -575,6 +601,13 @@ void Scheduler::ScheduleBeginImplFrameDeadline() {
begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval;
break;
case SchedulerStateMachine::
+ BEGIN_IMPL_FRAME_DEADLINE_MODE_TRY_TO_AVOID_CHECKERBOARD:
+ // We will wait up until this deadline for the ReadyToDraw signal.
+ // TODO(brianderson): Use a different timeout for touch vs. mouse wheel.
+ deadline = begin_impl_frame_args_.frame_time +
+ (5 * begin_impl_frame_args_.interval);
+ break;
+ case SchedulerStateMachine::
BEGIN_IMPL_FRAME_DEADLINE_MODE_BLOCKED_ON_READY_TO_DRAW:
// We are blocked because we are waiting for ReadyToDraw signal. We would
// post deadline after we received ReadyToDraw singal.
@@ -626,7 +659,14 @@ void Scheduler::OnBeginImplFrameDeadline() {
"461509 Scheduler::OnBeginImplFrameDeadline1"));
state_machine_.OnBeginImplFrameDeadline();
ProcessScheduledActions();
- FinishImplFrame();
+
+ if (state_machine_.retry_begin_impl_frame()) {
+ RetryBeginImplFrameWithDeadline();
+ } else if (state_machine_.retry_begin_impl_frame_deadline()) {
+ RetryBeginImplFrameDeadline();
+ } else {
+ FinishImplFrame();
+ }
}
@@ -638,7 +678,12 @@ void Scheduler::PollToAdvanceCommitState() {
void Scheduler::DrawAndSwapIfPossible() {
DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible();
- state_machine_.DidDrawIfPossibleCompleted(result);
+ state_machine_.SetDrawResult(result);
+}
+
+void Scheduler::DrawAndSwapForced() {
+ DrawResult result = client_->ScheduledActionDrawAndSwapForced();
+ state_machine_.SetDrawResult(result);
}
void Scheduler::SetDeferCommits(bool defer_commits) {
@@ -667,9 +712,9 @@ void Scheduler::ProcessScheduledActions() {
DVLOG(2) << "Scheduler::ProcessScheduledActions: "
<< SchedulerStateMachine::ActionToString(action) << " "
<< state_machine_.GetStatesForDebugging();
- state_machine_.UpdateState(action);
base::AutoReset<SchedulerStateMachine::Action>
mark_inside_action(&inside_action_, action);
+ state_machine_.WillAction(action);
switch (action) {
case SchedulerStateMachine::ACTION_NONE:
break;
@@ -718,6 +763,7 @@ void Scheduler::ProcessScheduledActions() {
break;
}
}
+ state_machine_.DidAction(action);
} while (action != SchedulerStateMachine::ACTION_NONE);
SetupPollingMechanisms();
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698