Chromium Code Reviews| 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..1ba8939e6007074f7de83cfc04ca25ea19d00be6 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, |
|
aelias_OOO_until_Jul13
2014/02/15 00:55:17
I think we should include screen resolution as par
epenner
2014/02/15 01:02:27
If you look at the history of this code, we have g
|
| // 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'. |
| static size_t limit_bytes = 0; |
| if (limit_bytes == 0) { |
| + // NOTE: Non-low-end devices use only 50% of these limites, |
|
aelias_OOO_until_Jul13
2014/02/15 00:55:17
typo: should be "limits"
epenner
2014/02/15 01:02:27
Done.
|
| + // 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 |
| 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; |
| } |