Commit ed1ba912 authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Separate impl and main latency recovery settings

Currently, there is a single settings flag controlling CC latency
recovery both on main thread and impl thread. This CL breaks that into
two separate flags that can be controlled independently.

Bug: 993895
Change-Id: I2caae6f5f2cd25332d8a164e082b313152e5e0b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869749Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Auto-Submit: Mohsen Izadi <mohsen@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737561}
parent bfad4b4f
...@@ -932,7 +932,7 @@ bool Scheduler::ShouldRecoverMainLatency( ...@@ -932,7 +932,7 @@ bool Scheduler::ShouldRecoverMainLatency(
bool can_activate_before_deadline) const { bool can_activate_before_deadline) const {
DCHECK(!settings_.using_synchronous_renderer_compositor); DCHECK(!settings_.using_synchronous_renderer_compositor);
if (!settings_.enable_latency_recovery) if (!settings_.enable_main_latency_recovery)
return false; return false;
// The main thread is in a low latency mode and there's no need to recover. // The main thread is in a low latency mode and there's no need to recover.
...@@ -964,7 +964,7 @@ bool Scheduler::ShouldRecoverImplLatency( ...@@ -964,7 +964,7 @@ bool Scheduler::ShouldRecoverImplLatency(
bool can_activate_before_deadline) const { bool can_activate_before_deadline) const {
DCHECK(!settings_.using_synchronous_renderer_compositor); DCHECK(!settings_.using_synchronous_renderer_compositor);
if (!settings_.enable_latency_recovery) if (!settings_.enable_impl_latency_recovery)
return false; return false;
// Disable impl thread latency recovery when using the unthrottled // Disable impl thread latency recovery when using the unthrottled
......
...@@ -25,7 +25,10 @@ SchedulerSettings::AsValue() const { ...@@ -25,7 +25,10 @@ SchedulerSettings::AsValue() const {
maximum_number_of_failed_draws_before_draw_is_forced); maximum_number_of_failed_draws_before_draw_is_forced);
state->SetBoolean("using_synchronous_renderer_compositor", state->SetBoolean("using_synchronous_renderer_compositor",
using_synchronous_renderer_compositor); using_synchronous_renderer_compositor);
state->SetBoolean("enable_latency_recovery", enable_latency_recovery); state->SetBoolean("enable_impl_latency_recovery",
enable_impl_latency_recovery);
state->SetBoolean("enable_main_latency_recovery",
enable_main_latency_recovery);
state->SetBoolean("wait_for_all_pipeline_stages_before_draw", state->SetBoolean("wait_for_all_pipeline_stages_before_draw",
wait_for_all_pipeline_stages_before_draw); wait_for_all_pipeline_stages_before_draw);
return std::move(state); return std::move(state);
......
...@@ -39,13 +39,14 @@ class CC_EXPORT SchedulerSettings { ...@@ -39,13 +39,14 @@ class CC_EXPORT SchedulerSettings {
// This is enabled for android-webview. // This is enabled for android-webview.
bool using_synchronous_renderer_compositor = false; bool using_synchronous_renderer_compositor = false;
// This is used to determine whether some begin-frames should be skipped (both // This is used to determine whether some begin-frames should be skipped
// in the main-thread and the compositor-thread) if previous frames have had // (either in the main-thread or the compositor-thread) if previous frames
// high latency. // have had high latency.
// It is enabled by default on desktop platforms, and has been recently // It is enabled by default on desktop platforms, and has been recently
// disabled by default on android. It may be disabled on all platforms. See // disabled by default on android. It may be disabled on all platforms. See
// more in https://crbug.com/933846 // more in https://crbug.com/933846
bool enable_latency_recovery = true; bool enable_impl_latency_recovery = true;
bool enable_main_latency_recovery = true;
// Turning this on effectively disables pipelining of compositor frame // Turning this on effectively disables pipelining of compositor frame
// production stages by waiting for each stage to complete before producing // production stages by waiting for each stage to complete before producing
......
...@@ -1048,7 +1048,8 @@ void LayerTreeTest::RunTest(CompositorMode mode) { ...@@ -1048,7 +1048,8 @@ void LayerTreeTest::RunTest(CompositorMode mode) {
} }
// Disable latency recovery to make the scheduler more predictable in its // Disable latency recovery to make the scheduler more predictable in its
// actions and less dependent on timings to make decisions. // actions and less dependent on timings to make decisions.
settings_.enable_latency_recovery = false; settings_.enable_impl_latency_recovery = false;
settings_.enable_main_latency_recovery = false;
InitializeSettings(&settings_); InitializeSettings(&settings_);
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
......
...@@ -26,7 +26,10 @@ SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const { ...@@ -26,7 +26,10 @@ SchedulerSettings LayerTreeSettings::ToSchedulerSettings() const {
main_frame_before_activation_enabled; main_frame_before_activation_enabled;
scheduler_settings.using_synchronous_renderer_compositor = scheduler_settings.using_synchronous_renderer_compositor =
using_synchronous_renderer_compositor; using_synchronous_renderer_compositor;
scheduler_settings.enable_latency_recovery = enable_latency_recovery; scheduler_settings.enable_impl_latency_recovery =
enable_impl_latency_recovery;
scheduler_settings.enable_main_latency_recovery =
enable_main_latency_recovery;
scheduler_settings.wait_for_all_pipeline_stages_before_draw = scheduler_settings.wait_for_all_pipeline_stages_before_draw =
wait_for_all_pipeline_stages_before_draw; wait_for_all_pipeline_stages_before_draw;
return scheduler_settings; return scheduler_settings;
......
...@@ -40,7 +40,8 @@ class CC_EXPORT LayerTreeSettings { ...@@ -40,7 +40,8 @@ class CC_EXPORT LayerTreeSettings {
// When |enable_early_damage_check| is true, the early damage check is // When |enable_early_damage_check| is true, the early damage check is
// performed if one of the last |damaged_frame_limit| frames had no damage. // performed if one of the last |damaged_frame_limit| frames had no damage.
int damaged_frame_limit = 3; int damaged_frame_limit = 3;
bool enable_latency_recovery = true; bool enable_impl_latency_recovery = true;
bool enable_main_latency_recovery = true;
bool can_use_lcd_text = true; bool can_use_lcd_text = true;
bool gpu_rasterization_forced = false; bool gpu_rasterization_forced = false;
bool gpu_rasterization_disabled = false; bool gpu_rasterization_disabled = false;
......
...@@ -397,7 +397,8 @@ void CompositorImpl::CreateLayerTreeHost() { ...@@ -397,7 +397,8 @@ void CompositorImpl::CreateLayerTreeHost() {
settings.use_painted_device_scale_factor = true; settings.use_painted_device_scale_factor = true;
// TODO(crbug.com/933846): LatencyRecovery is causing jank on Android. Disable // TODO(crbug.com/933846): LatencyRecovery is causing jank on Android. Disable
// for now, with a plan to disable more widely once viz launches. // for now, with a plan to disable more widely once viz launches.
settings.enable_latency_recovery = false; settings.enable_impl_latency_recovery = false;
settings.enable_main_latency_recovery = false;
animation_host_ = cc::AnimationHost::CreateMainInstance(); animation_host_ = cc::AnimationHost::CreateMainInstance();
......
...@@ -3135,12 +3135,14 @@ cc::LayerTreeSettings RenderWidget::GenerateLayerTreeSettings( ...@@ -3135,12 +3135,14 @@ cc::LayerTreeSettings RenderWidget::GenerateLayerTreeSettings(
if (cmd.HasSwitch(switches::kRunAllCompositorStagesBeforeDraw)) { if (cmd.HasSwitch(switches::kRunAllCompositorStagesBeforeDraw)) {
settings.wait_for_all_pipeline_stages_before_draw = true; settings.wait_for_all_pipeline_stages_before_draw = true;
settings.enable_latency_recovery = false; settings.enable_impl_latency_recovery = false;
settings.enable_main_latency_recovery = false;
} }
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// TODO(crbug.com/933846): LatencyRecovery is causing jank on Android. Disable // TODO(crbug.com/933846): LatencyRecovery is causing jank on Android. Disable
// in viz mode for now, with plan to disable more widely once viz launches. // in viz mode for now, with plan to disable more widely once viz launches.
settings.enable_latency_recovery = false; settings.enable_impl_latency_recovery = false;
settings.enable_main_latency_recovery = false;
#endif #endif
settings.enable_image_animation_resync = settings.enable_image_animation_resync =
......
...@@ -195,7 +195,8 @@ Compositor::Compositor(const viz::FrameSinkId& frame_sink_id, ...@@ -195,7 +195,8 @@ Compositor::Compositor(const viz::FrameSinkId& frame_sink_id,
if (command_line->HasSwitch(switches::kRunAllCompositorStagesBeforeDraw)) { if (command_line->HasSwitch(switches::kRunAllCompositorStagesBeforeDraw)) {
settings.wait_for_all_pipeline_stages_before_draw = true; settings.wait_for_all_pipeline_stages_before_draw = true;
settings.enable_latency_recovery = false; settings.enable_impl_latency_recovery = false;
settings.enable_main_latency_recovery = false;
} }
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
......
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