Commit a772c842 authored by orglofch's avatar orglofch Committed by Commit bot

cc:: Remove main_frame_before_draw_enabled from scheduler settings.

The flag is set on all platforms and adds uneeded complexity to the
scheduler.

BUG=418368

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

Cr-Commit-Position: refs/heads/master@{#297217}
parent ae846887
......@@ -15,10 +15,6 @@ const char kDisableThreadedAnimation[] = "disable-threaded-animation";
const char kDisableCompositedAntialiasing[] =
"disable-composited-antialiasing";
// Disables sending the next BeginMainFrame before the previous commit has
// drawn.
const char kDisableMainFrameBeforeDraw[] = "disable-main-frame-before-draw";
// Disables sending the next BeginMainFrame before the previous commit
// activates. Overrides the kEnableMainFrameBeforeActivation flag.
const char kDisableMainFrameBeforeActivation[] =
......
......@@ -18,7 +18,6 @@ namespace switches {
// Switches for the renderer compositor only.
CC_EXPORT extern const char kDisableThreadedAnimation[];
CC_EXPORT extern const char kDisableCompositedAntialiasing[];
CC_EXPORT extern const char kDisableMainFrameBeforeDraw[];
CC_EXPORT extern const char kDisableMainFrameBeforeActivation[];
CC_EXPORT extern const char kEnableMainFrameBeforeActivation[];
CC_EXPORT extern const char kEnableTopControlsPositionCalculation[];
......
......@@ -91,9 +91,6 @@ Scheduler::Scheduler(
settings_.AsValue());
DCHECK(client_);
DCHECK(!state_machine_.BeginFrameNeeded());
if (settings_.main_frame_before_activation_enabled) {
DCHECK(settings_.main_frame_before_draw_enabled);
}
begin_retro_frame_closure_ =
base::Bind(&Scheduler::BeginRetroFrame, weak_factory_.GetWeakPtr());
......
......@@ -11,7 +11,6 @@ namespace cc {
SchedulerSettings::SchedulerSettings()
: begin_frame_scheduling_enabled(true),
main_frame_before_draw_enabled(true),
main_frame_before_activation_enabled(false),
impl_side_painting(false),
timeout_and_draw_when_animation_checkerboards(true),
......@@ -22,7 +21,6 @@ SchedulerSettings::SchedulerSettings()
SchedulerSettings::SchedulerSettings(const LayerTreeSettings& settings)
: begin_frame_scheduling_enabled(settings.begin_frame_scheduling_enabled),
main_frame_before_draw_enabled(settings.main_frame_before_draw_enabled),
main_frame_before_activation_enabled(
settings.main_frame_before_activation_enabled),
impl_side_painting(settings.impl_side_painting),
......@@ -43,8 +41,6 @@ SchedulerSettings::AsValue() const {
new base::debug::TracedValue();
state->SetBoolean("begin_frame_scheduling_enabled",
begin_frame_scheduling_enabled);
state->SetBoolean("main_frame_before_draw_enabled",
main_frame_before_draw_enabled);
state->SetBoolean("main_frame_before_activation_enabled",
main_frame_before_activation_enabled);
state->SetBoolean("impl_side_painting", impl_side_painting);
......
......@@ -25,7 +25,6 @@ class CC_EXPORT SchedulerSettings {
~SchedulerSettings();
bool begin_frame_scheduling_enabled;
bool main_frame_before_draw_enabled;
bool main_frame_before_activation_enabled;
bool impl_side_painting;
bool timeout_and_draw_when_animation_checkerboards;
......
......@@ -96,8 +96,6 @@ const char* SchedulerStateMachine::CommitStateToString(CommitState state) {
return "COMMIT_STATE_READY_TO_COMMIT";
case COMMIT_STATE_WAITING_FOR_ACTIVATION:
return "COMMIT_STATE_WAITING_FOR_ACTIVATION";
case COMMIT_STATE_WAITING_FOR_FIRST_DRAW:
return "COMMIT_STATE_WAITING_FOR_FIRST_DRAW";
}
NOTREACHED();
return "???";
......@@ -569,8 +567,6 @@ void SchedulerStateMachine::UpdateState(Action action) {
case ACTION_SEND_BEGIN_MAIN_FRAME:
DCHECK(!has_pending_tree_ ||
settings_.main_frame_before_activation_enabled);
DCHECK(!active_tree_needs_first_draw_ ||
settings_.main_frame_before_draw_enabled);
DCHECK(visible_);
commit_state_ = COMMIT_STATE_BEGIN_MAIN_FRAME_SENT;
needs_commit_ = false;
......@@ -620,12 +616,10 @@ void SchedulerStateMachine::UpdateStateOnCommit(bool commit_was_aborted) {
if (commit_was_aborted || settings_.main_frame_before_activation_enabled) {
commit_state_ = COMMIT_STATE_IDLE;
} else if (settings_.main_frame_before_draw_enabled) {
} else {
commit_state_ = settings_.impl_side_painting
? COMMIT_STATE_WAITING_FOR_ACTIVATION
: COMMIT_STATE_IDLE;
} else {
commit_state_ = COMMIT_STATE_WAITING_FOR_FIRST_DRAW;
}
// If we are impl-side-painting but the commit was aborted, then we behave
......@@ -686,11 +680,6 @@ void SchedulerStateMachine::UpdateStateOnDraw(bool did_request_swap) {
if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)
forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE;
if (!has_pending_tree_ &&
commit_state_ == COMMIT_STATE_WAITING_FOR_FIRST_DRAW) {
commit_state_ = COMMIT_STATE_IDLE;
}
needs_redraw_ = false;
active_tree_needs_first_draw_ = false;
......
......@@ -68,7 +68,6 @@ class CC_EXPORT SchedulerStateMachine {
COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED,
COMMIT_STATE_READY_TO_COMMIT,
COMMIT_STATE_WAITING_FOR_ACTIVATION,
COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
};
static const char* CommitStateToString(CommitState state);
......
......@@ -42,8 +42,7 @@ const SchedulerStateMachine::CommitState all_commit_states[] = {
SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT,
SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED,
SchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT,
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_ACTIVATION,
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW};
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_ACTIVATION};
// Exposes the protected state fields of the SchedulerStateMachine for testing
class StateMachine : public SchedulerStateMachine {
......@@ -176,90 +175,6 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) {
}
}
// Explicitly test main_frame_before_draw_enabled = false
TEST(SchedulerStateMachineTest, MainFrameBeforeDrawDisabled) {
SchedulerSettings scheduler_settings;
scheduler_settings.impl_side_painting = true;
scheduler_settings.main_frame_before_draw_enabled = false;
StateMachine state(scheduler_settings);
state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
state.SetCanStart();
state.UpdateState(state.NextAction());
state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
state.SetNeedsRedraw(false);
state.SetVisible(true);
state.SetCanDraw(true);
state.SetNeedsCommit();
EXPECT_TRUE(state.BeginFrameNeeded());
// Commit to the pending tree.
state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
state.NotifyBeginMainFrameStarted();
state.NotifyReadyToCommit();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(),
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(),
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
// Verify that the next commit doesn't start until the previous
// commit has been drawn.
state.SetNeedsCommit();
state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
// Make sure that a draw of the active tree doesn't spuriously advance
// the commit state and unblock the next commit.
state.SetNeedsRedraw(true);
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(),
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
EXPECT_TRUE(state.has_pending_tree());
// Verify NotifyReadyToActivate unblocks activation, draw, and
// commit in that order.
state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
state.NotifyReadyToActivate();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(),
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly());
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE);
state.DidSwapBuffers();
state.DidSwapBuffersComplete();
EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(),
SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT);
state.NotifyBeginMainFrameStarted();
state.NotifyReadyToCommit();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(),
SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW);
}
// Explicitly test main_frame_before_activation_enabled = true
TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) {
SchedulerSettings scheduler_settings;
......@@ -287,7 +202,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) {
state.NotifyReadyToCommit();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.CommitState());
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
......@@ -320,7 +235,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) {
state.DidSwapBuffersComplete();
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_EQ(state.CommitState(), SchedulerStateMachine::COMMIT_STATE_IDLE);
EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.CommitState());
}
TEST(SchedulerStateMachineTest,
......@@ -434,11 +349,9 @@ TEST(SchedulerStateMachineTest,
EXPECT_TRUE(state.RedrawPending());
}
void TestFailedDrawsEventuallyForceDrawAfterNextCommit(
bool main_frame_before_draw_enabled) {
TEST(SchedulerStateMachineTest,
TestFailedDrawsEventuallyForceDrawAfterNextCommit) {
SchedulerSettings scheduler_settings;
scheduler_settings.main_frame_before_draw_enabled =
main_frame_before_draw_enabled;
scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 1;
StateMachine state(scheduler_settings);
state.SetCanStart();
......@@ -482,10 +395,8 @@ void TestFailedDrawsEventuallyForceDrawAfterNextCommit(
// The redraw should be forced at the end of the next BeginImplFrame.
state.OnBeginImplFrame(CreateBeginFrameArgsForTesting());
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
if (main_frame_before_draw_enabled) {
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
}
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
state.OnBeginImplFrameDeadline();
EXPECT_ACTION_UPDATE_STATE(
......@@ -494,20 +405,6 @@ void TestFailedDrawsEventuallyForceDrawAfterNextCommit(
state.DidSwapBuffersComplete();
}
TEST(SchedulerStateMachineTest,
TestFailedDrawsEventuallyForceDrawAfterNextCommit) {
bool main_frame_before_draw_enabled = false;
TestFailedDrawsEventuallyForceDrawAfterNextCommit(
main_frame_before_draw_enabled);
}
TEST(SchedulerStateMachineTest,
TestFailedDrawsEventuallyForceDrawAfterNextCommit_CommitBeforeDraw) {
bool main_frame_before_draw_enabled = true;
TestFailedDrawsEventuallyForceDrawAfterNextCommit(
main_frame_before_draw_enabled);
}
TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) {
SchedulerSettings scheduler_settings;
int draw_limit = 1;
......@@ -816,10 +713,8 @@ TEST(SchedulerStateMachineTest,
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
}
void TestSetNeedsCommitIsNotLost(bool main_frame_before_draw_enabled) {
TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) {
SchedulerSettings scheduler_settings;
scheduler_settings.main_frame_before_draw_enabled =
main_frame_before_draw_enabled;
StateMachine state(scheduler_settings);
state.SetCanStart();
state.UpdateState(state.NextAction());
......@@ -876,10 +771,8 @@ void TestSetNeedsCommitIsNotLost(bool main_frame_before_draw_enabled) {
// and draw on the next BeginImplFrame.
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
if (main_frame_before_draw_enabled) {
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
}
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
state.OnBeginImplFrameDeadline();
......@@ -890,23 +783,9 @@ void TestSetNeedsCommitIsNotLost(bool main_frame_before_draw_enabled) {
state.DidSwapBuffers();
state.DidDrawIfPossibleCompleted(DRAW_SUCCESS);
state.DidSwapBuffersComplete();
if (!main_frame_before_draw_enabled) {
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
}
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
}
TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) {
bool main_frame_before_draw_enabled = false;
TestSetNeedsCommitIsNotLost(main_frame_before_draw_enabled);
}
TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost_CommitBeforeDraw) {
bool main_frame_before_draw_enabled = true;
TestSetNeedsCommitIsNotLost(main_frame_before_draw_enabled);
}
TEST(SchedulerStateMachineTest, TestFullCycle) {
SchedulerSettings default_scheduler_settings;
StateMachine state(default_scheduler_settings);
......
......@@ -18,7 +18,6 @@ LayerTreeSettings::LayerTreeSettings()
throttle_frame_production(true),
single_thread_proxy_scheduler(true),
begin_frame_scheduling_enabled(false),
main_frame_before_draw_enabled(true),
main_frame_before_activation_enabled(false),
using_synchronous_renderer_compositor(false),
report_overscroll_only_for_scrollable_axes(false),
......
......@@ -23,7 +23,6 @@ class CC_EXPORT LayerTreeSettings {
bool throttle_frame_production;
bool single_thread_proxy_scheduler;
bool begin_frame_scheduling_enabled;
bool main_frame_before_draw_enabled;
bool main_frame_before_activation_enabled;
bool using_synchronous_renderer_compositor;
bool report_overscroll_only_for_scrollable_axes;
......
......@@ -174,7 +174,6 @@ std::string DeriveCommandLine(const GURL& start_url,
cc::switches::kCompositeToMailbox,
cc::switches::kDisableCompositedAntialiasing,
cc::switches::kDisableMainFrameBeforeActivation,
cc::switches::kDisableMainFrameBeforeDraw,
cc::switches::kDisablePinchVirtualViewport,
cc::switches::kDisableThreadedAnimation,
cc::switches::kEnableGpuBenchmarking,
......
......@@ -1200,7 +1200,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
cc::switches::kCompositeToMailbox,
cc::switches::kDisableCompositedAntialiasing,
cc::switches::kDisableMainFrameBeforeActivation,
cc::switches::kDisableMainFrameBeforeDraw,
cc::switches::kDisableThreadedAnimation,
cc::switches::kEnableGpuBenchmarking,
cc::switches::kEnableMainFrameBeforeActivation,
......
......@@ -178,8 +178,6 @@ scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create(
settings.main_frame_before_activation_enabled =
cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) &&
!cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation);
settings.main_frame_before_draw_enabled =
!cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeDraw);
settings.report_overscroll_only_for_scrollable_axes = true;
settings.accelerated_animation_enabled =
!cmd->HasSwitch(cc::switches::kDisableThreadedAnimation);
......
......@@ -97,7 +97,6 @@ Compositor::Compositor(gfx::AcceleratedWidget widget,
context_factory_->DoesCreateTestContexts()
? kTestRefreshRate
: kDefaultRefreshRate;
settings.main_frame_before_draw_enabled = false;
settings.main_frame_before_activation_enabled = false;
settings.throttle_frame_production =
!command_line->HasSwitch(switches::kDisableGpuVsync);
......
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