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

Unified Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2820643002: Decouple some graphics-related IsLowEndDevice() policies for 1GB devices. (Closed)
Patch Set: Rebase Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/gpu/render_widget_compositor.cc
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index ed8514c2c22fea17601d18953ab7295e2f219f18..7bffa0d79544250fceed101c4efd38b36e863fb8 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -418,7 +418,8 @@ cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings(
// RGBA_4444 textures are only enabled by default for low end devices
// and are disabled for Android WebView as it doesn't support the format.
- if (!cmd.HasSwitch(switches::kDisableRGBA4444Textures))
+ if (!cmd.HasSwitch(switches::kDisableRGBA4444Textures) &&
+ base::SysInfo::AmountOfPhysicalMemoryMB() <= 512)
settings.renderer_settings.preferred_tile_format = cc::RGBA_4444;
} else {
// On other devices we have increased memory excessively to avoid
@@ -550,21 +551,20 @@ cc::ManagedMemoryPolicy RenderWidgetCompositor::GetGpuMemoryPolicy(
if (actual.bytes_limit_when_visible == 0) {
// NOTE: Non-low-end devices use only 50% of these limits,
// except during 'emergencies' where 100% can be used.
- if (!base::SysInfo::IsLowEndDevice()) {
- if (physical_memory_mb >= 1536)
- actual.bytes_limit_when_visible = physical_memory_mb / 8; // >192MB
- else if (physical_memory_mb >= 1152)
- actual.bytes_limit_when_visible = physical_memory_mb / 8; // >144MB
- else if (physical_memory_mb >= 768)
- actual.bytes_limit_when_visible = physical_memory_mb / 10; // >76MB
- else
- actual.bytes_limit_when_visible = physical_memory_mb / 12; // <64MB
- } else {
- // Low-end devices have 512MB or less memory by definition
- // so we hard code the limit rather than relying on the heuristics
- // above. Low-end devices use 4444 textures so we can use a lower limit.
+ if (physical_memory_mb >= 1536)
+ actual.bytes_limit_when_visible = physical_memory_mb / 8; // >192MB
+ else if (physical_memory_mb >= 1152)
+ actual.bytes_limit_when_visible = physical_memory_mb / 8; // >144MB
+ else if (physical_memory_mb >= 768)
+ actual.bytes_limit_when_visible = physical_memory_mb / 10; // >76MB
+ else if (physical_memory_mb >= 513)
+ actual.bytes_limit_when_visible = physical_memory_mb / 12; // <64MB
+ else
+ // Devices with this little RAM have very little headroom so we hardcode
+ // the limit rather than relying on the heuristics above. (They also use
+ // 4444 textures so we can use a lower limit.)
actual.bytes_limit_when_visible = 8;
- }
+
actual.bytes_limit_when_visible =
actual.bytes_limit_when_visible * 1024 * 1024;
// Clamp the observed value to a specific range on Android.
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.cc ('k') | content/renderer/media/renderer_webmediaplayer_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698