Index: ui/gl/gl_context_android.cc |
diff --git a/ui/gl/gl_context_android.cc b/ui/gl/gl_context_android.cc |
index a9e888b203d41a2912d0e87217ae1a415660013a..f4555a2c28f93fba09d8e5f8c10afff3cd992a2d 100644 |
--- a/ui/gl/gl_context_android.cc |
+++ b/ui/gl/gl_context_android.cc |
@@ -108,27 +108,33 @@ bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { |
// Now we take a default of 1/8th of memory on high-memory devices, |
// and gradually scale that back for low-memory devices (to be nicer |
// to other apps so they don't get killed). Examples: |
- // Nexus 4/10(2GB) 256MB |
- // Droid Razr M(1GB) 91MB |
- // Galaxy Nexus(1GB) 85MB |
- // Xoom(1GB) 85MB |
- // Nexus S(low-end) 8MB |
+ // Nexus 4/10(2GB) 256MB (normally 128MB) |
+ // Droid Razr M(1GB) 114MB (normally 57MB) |
+ // Galaxy Nexus(1GB) 100MB (normally 50MB) |
+ // Xoom(1GB) 100MB (normally 50MB) |
+ // Nexus S(low-end) 12MB (normally 8MB) |
+ // Note that the compositor now uses only some of this memory for |
+ // pre-painting and uses the rest only for 'emergencies'. |
klobag.chromium
2014/02/15 07:27:20
Can we move this two lines up and say the number i
epenner
2014/02/17 05:43:23
Yes, much better way to explain the numbers.
|
static size_t limit_bytes = 0; |
if (limit_bytes == 0) { |
+ // NOTE: Non-low-end devices use only 50% of these limits, |
+ // except during 'emergencies' where 100% can be used. |
if (!base::android::SysUtils::IsLowEndDevice()) { |
if (physical_memory_mb >= 1536) |
- limit_bytes = physical_memory_mb / 8; |
+ limit_bytes = physical_memory_mb / 8; // >192MB |
else if (physical_memory_mb >= 1152) |
- limit_bytes = physical_memory_mb / 10; |
+ limit_bytes = physical_memory_mb / 8; // >144MB |
klobag.chromium
2014/02/15 07:27:20
merge the above two?
epenner
2014/02/17 05:43:23
Good point will do. I think this number is common
|
else if (physical_memory_mb >= 768) |
- limit_bytes = physical_memory_mb / 12; |
+ limit_bytes = physical_memory_mb / 10; // >76MB |
else |
- limit_bytes = physical_memory_mb / 16; |
+ limit_bytes = 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. |
- limit_bytes = 8; |
+ // NOTE: Low-end uses 2/3 (67%) of this memory in practice, so we have |
+ // increased the limit to 12 (8MB, or 12MB in emergencies). |
+ limit_bytes = 12; |
} |
limit_bytes = limit_bytes * 1024 * 1024; |
} |