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

Unified Diff: gpu/skia_bindings/grcontext_for_gles2_interface.cc

Issue 2836063003: Set ganesh cache limit based on system physical RAM (Closed)
Patch Set: adjust low-end threshold 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/skia_bindings/grcontext_for_gles2_interface.cc
diff --git a/gpu/skia_bindings/grcontext_for_gles2_interface.cc b/gpu/skia_bindings/grcontext_for_gles2_interface.cc
index 1f161413640323a6f505a0557e71f7f5263d5bfa..ee7516b4db403403b85c3924433c774ad5cd5c8f 100644
--- a/gpu/skia_bindings/grcontext_for_gles2_interface.cc
+++ b/gpu/skia_bindings/grcontext_for_gles2_interface.cc
@@ -10,6 +10,7 @@
#include "base/lazy_instance.h"
#include "base/macros.h"
+#include "base/sys_info.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
@@ -32,10 +33,22 @@ GrContextForGLES2Interface::GrContextForGLES2Interface(
static const int kMaxGaneshResourceCacheCount = 16384;
// The limit of the bytes allocated toward GPU resources in the GrContext's
// GPU cache.
+ static const size_t kMaxLowEndGaneshResourceCacheBytes = 48 * 1024 * 1024;
static const size_t kMaxGaneshResourceCacheBytes = 96 * 1024 * 1024;
+ static const size_t kMaxHighEndGaneshResourceCacheBytes = 256 * 1024 * 1024;
+ static const int64_t kHighEndMemoryThreshold = (int64_t)4096 * 1024 * 1024;
+ static const int64_t kLowEndMemoryThreshold = (int64_t)512 * 1024 * 1024;
+
+ size_t max_ganesh_resource_cache_bytes = kMaxGaneshResourceCacheBytes;
+ if (base::SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold) {
+ max_ganesh_resource_cache_bytes = kMaxLowEndGaneshResourceCacheBytes;
+ } else if (base::SysInfo::AmountOfPhysicalMemory() >=
+ kHighEndMemoryThreshold) {
+ max_ganesh_resource_cache_bytes = kMaxHighEndGaneshResourceCacheBytes;
+ }
gr_context_->setResourceCacheLimits(kMaxGaneshResourceCacheCount,
- kMaxGaneshResourceCacheBytes);
+ max_ganesh_resource_cache_bytes);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698