Commit f471504b authored by Albert Chaulk's avatar Albert Chaulk Committed by Commit Bot

Add kDisableLayerTreeHostMemoryPressure switch to LayerTreeHostImpl

Chromecast is seeing issues when the active layer releases its
resources, disabling the memory pressure listener fixes it.

It is possible that because chromecast devices set critical memory
pressure to very low amounts (<30MB) coupled with the gpu driver not
being able to actually free memory until existing rendering commands
have completed, the memory pressure handler freeing things that then
get reallocated right away for the next frame can actually increase
memory pressure, triggering an actual OOM condition on device

Bug: b/118774931
Test: None
Change-Id: Iff393de370b7250ebe5c4ec21a1f225e3887c0f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2140608
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758985}
parent 8e9c8333
......@@ -48,6 +48,10 @@ const char kCheckDamageEarly[] = "check-damage-early";
// Enables the GPU benchmarking extension
const char kEnableGpuBenchmarking[] = "enable-gpu-benchmarking";
// Disables LayerTreeHost::OnMemoryPressure
const char kDisableLayerTreeHostMemoryPressure[] =
"disable-layer-tree-host-memory-pressure";
// Renders a border around compositor layers to help debug and study
// layer compositing.
const char kShowCompositedLayerBorders[] = "show-composited-layer-borders";
......
......@@ -31,6 +31,9 @@ CC_BASE_EXPORT extern const char kCheckDamageEarly[];
// Switches for both the renderer and ui compositors.
CC_BASE_EXPORT extern const char kEnableGpuBenchmarking[];
// Switches for LayerTreeHost.
CC_BASE_EXPORT extern const char kDisableLayerTreeHostMemoryPressure[];
// Debug visualizations.
CC_BASE_EXPORT extern const char kShowCompositedLayerBorders[];
CC_BASE_EXPORT extern const char kUIShowCompositedLayerBorders[];
......
......@@ -13,6 +13,7 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/containers/adapters.h"
#include "base/containers/flat_map.h"
......@@ -31,6 +32,7 @@
#include "cc/base/devtools_instrumentation.h"
#include "cc/base/histograms.h"
#include "cc/base/math_util.h"
#include "cc/base/switches.h"
#include "cc/benchmarks/benchmark_instrumentation.h"
#include "cc/debug/rendering_stats_instrumentation.h"
#include "cc/input/browser_controls_offset_manager.h"
......@@ -370,9 +372,12 @@ LayerTreeHostImpl::LayerTreeHostImpl(
this, settings.top_controls_show_threshold,
settings.top_controls_hide_threshold);
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableLayerTreeHostMemoryPressure)) {
memory_pressure_listener_.reset(
new base::MemoryPressureListener(base::BindRepeating(
&LayerTreeHostImpl::OnMemoryPressure, base::Unretained(this))));
}
SetDebugState(settings.initial_debug_state);
}
......
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