summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-19 02:50:15 +0000
committerccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-19 02:50:15 +0000
commite3fa5caea0826ea578866a10796eac67875d927c (patch)
tree26e97ae7c3238e1b28e8e3569e2322b98ab11bff
parentc2cf5dd3f5f1dd3de94555312d179a1512afd9ab (diff)
downloadchromium_src-e3fa5caea0826ea578866a10796eac67875d927c.zip
chromium_src-e3fa5caea0826ea578866a10796eac67875d927c.tar.gz
chromium_src-e3fa5caea0826ea578866a10796eac67875d927c.tar.bz2
Increase the minimum GPU memory limit on Mac
Increase the minimum GPU memory limit for a renderer from 64MB to 128MB. The Mac's memory policy will not actually use the full amount of memory, unless the page requires that much to render content on the screen (in which case, jank due to paging is better than missing content). Make the prioritized resource manager more aggressively free unused textures when the memory policy indicates that GPU memory should be used sparingly. Without this change, the amount of memory spent holding on to spare textures to recycle would double. Move the definition of the priority cutoff to the same location as all other platform dependent variables. BUG=318877 Review URL: https://codereview.chromium.org/98073011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241769 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/resources/prioritized_resource_manager.cc10
-rw-r--r--content/common/gpu/gpu_memory_manager.cc23
-rw-r--r--content/common/gpu/gpu_memory_manager.h3
3 files changed, 23 insertions, 13 deletions
diff --git a/cc/resources/prioritized_resource_manager.cc b/cc/resources/prioritized_resource_manager.cc
index 43d4f52..da8f055 100644
--- a/cc/resources/prioritized_resource_manager.cc
+++ b/cc/resources/prioritized_resource_manager.cc
@@ -326,10 +326,14 @@ void PrioritizedResourceManager::ReduceWastedMemory(
continue;
wasted_memory += (*it)->bytes();
}
- size_t ten_percent_of_memory = memory_available_bytes_ / 10;
- if (wasted_memory > ten_percent_of_memory)
+ size_t wasted_memory_to_allow = memory_available_bytes_ / 10;
+ // If the external priority cutoff indicates that unused memory should be
+ // freed, then do not allow any memory for texture recycling.
+ if (external_priority_cutoff_ != PriorityCalculator::AllowEverythingCutoff())
+ wasted_memory_to_allow = 0;
+ if (wasted_memory > wasted_memory_to_allow)
EvictBackingsToReduceMemory(MemoryUseBytes() -
- (wasted_memory - ten_percent_of_memory),
+ (wasted_memory - wasted_memory_to_allow),
PriorityCalculator::AllowEverythingCutoff(),
EVICT_ONLY_RECYCLABLE,
DO_NOT_UNLINK_BACKINGS,
diff --git a/content/common/gpu/gpu_memory_manager.cc b/content/common/gpu/gpu_memory_manager.cc
index e693627..5dfd3fb 100644
--- a/content/common/gpu/gpu_memory_manager.cc
+++ b/content/common/gpu/gpu_memory_manager.cc
@@ -54,6 +54,7 @@ GpuMemoryManager::GpuMemoryManager(
manage_immediate_scheduled_(false),
max_surfaces_with_frontbuffer_soft_limit_(
max_surfaces_with_frontbuffer_soft_limit),
+ priority_cutoff_(MemoryAllocation::CUTOFF_ALLOW_EVERYTHING),
bytes_available_gpu_memory_(0),
bytes_available_gpu_memory_overridden_(false),
bytes_minimum_per_client_(0),
@@ -68,12 +69,23 @@ GpuMemoryManager::GpuMemoryManager(
{
CommandLine* command_line = CommandLine::ForCurrentProcess();
+ // Use a more conservative memory allocation policy on Linux and Mac because
+ // the platform is unstable when under memory pressure.
+ // http://crbug.com/145600 (Linux)
+ // http://crbug.com/141377 (Mac)
+#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
+ priority_cutoff_ = MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
+#endif
+
#if defined(OS_ANDROID)
bytes_default_per_client_ = 8 * 1024 * 1024;
bytes_minimum_per_client_ = 8 * 1024 * 1024;
#elif defined(OS_CHROMEOS)
bytes_default_per_client_ = 64 * 1024 * 1024;
bytes_minimum_per_client_ = 4 * 1024 * 1024;
+#elif defined(OS_MACOSX)
+ bytes_default_per_client_ = 128 * 1024 * 1024;
+ bytes_minimum_per_client_ = 128 * 1024 * 1024;
#else
bytes_default_per_client_ = 64 * 1024 * 1024;
bytes_minimum_per_client_ = 64 * 1024 * 1024;
@@ -659,16 +671,7 @@ void GpuMemoryManager::AssignSurfacesAllocations() {
allocation.bytes_limit_when_visible =
client_state->bytes_allocation_when_visible_;
- // Use a more conservative memory allocation policy on Linux and Mac
- // because the platform is unstable when under memory pressure.
- // http://crbug.com/145600 (Linux)
- // http://crbug.com/141377 (Mac)
- allocation.priority_cutoff_when_visible =
-#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
- MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
-#else
- MemoryAllocation::CUTOFF_ALLOW_EVERYTHING;
-#endif
+ allocation.priority_cutoff_when_visible = priority_cutoff_;
client_state->client_->SetMemoryAllocation(allocation);
client_state->client_->SuggestHaveFrontBuffer(!client_state->hibernated_);
diff --git a/content/common/gpu/gpu_memory_manager.h b/content/common/gpu/gpu_memory_manager.h
index a895968..255c20b 100644
--- a/content/common/gpu/gpu_memory_manager.h
+++ b/content/common/gpu/gpu_memory_manager.h
@@ -227,6 +227,9 @@ class CONTENT_EXPORT GpuMemoryManager :
uint64 max_surfaces_with_frontbuffer_soft_limit_;
+ // The priority cutoff used for all renderers.
+ gpu::MemoryAllocation::PriorityCutoff priority_cutoff_;
+
// The maximum amount of memory that may be allocated for GPU resources
uint64 bytes_available_gpu_memory_;
bool bytes_available_gpu_memory_overridden_;