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

Side by Side Diff: ui/gl/gl_context_android.cc

Issue 258663002: Expose a low-end device mode override flags for non-android OSs as well (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments. Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/async_pixel_transfer_manager_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_context.h" 5 #include "ui/gl/gl_context.h"
6 6
7 #include "base/android/sys_utils.h"
8 #include "base/logging.h" 7 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
10 #include "base/sys_info.h" 9 #include "base/sys_info.h"
11 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
12 #include "ui/gl/gl_context_egl.h" 11 #include "ui/gl/gl_context_egl.h"
13 #include "ui/gl/gl_context_osmesa.h" 12 #include "ui/gl/gl_context_osmesa.h"
14 #include "ui/gl/gl_context_stub.h" 13 #include "ui/gl/gl_context_stub.h"
15 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
16 #include "ui/gl/gl_surface.h" 15 #include "ui/gl/gl_surface.h"
17 16
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Droid Razr M(1GB) 114MB (normally 57MB) 120 // Droid Razr M(1GB) 114MB (normally 57MB)
122 // Galaxy Nexus(1GB) 100MB (normally 50MB) 121 // Galaxy Nexus(1GB) 100MB (normally 50MB)
123 // Xoom(1GB) 100MB (normally 50MB) 122 // Xoom(1GB) 100MB (normally 50MB)
124 // Nexus S(low-end) 12MB (normally 8MB) 123 // Nexus S(low-end) 12MB (normally 8MB)
125 // Note that the compositor now uses only some of this memory for 124 // Note that the compositor now uses only some of this memory for
126 // pre-painting and uses the rest only for 'emergencies'. 125 // pre-painting and uses the rest only for 'emergencies'.
127 static size_t limit_bytes = 0; 126 static size_t limit_bytes = 0;
128 if (limit_bytes == 0) { 127 if (limit_bytes == 0) {
129 // NOTE: Non-low-end devices use only 50% of these limits, 128 // NOTE: Non-low-end devices use only 50% of these limits,
130 // except during 'emergencies' where 100% can be used. 129 // except during 'emergencies' where 100% can be used.
131 if (!base::android::SysUtils::IsLowEndDevice()) { 130 if (!base::SysInfo::IsLowEndDevice()) {
132 if (physical_memory_mb >= 1536) 131 if (physical_memory_mb >= 1536)
133 limit_bytes = physical_memory_mb / 8; // >192MB 132 limit_bytes = physical_memory_mb / 8; // >192MB
134 else if (physical_memory_mb >= 1152) 133 else if (physical_memory_mb >= 1152)
135 limit_bytes = physical_memory_mb / 8; // >144MB 134 limit_bytes = physical_memory_mb / 8; // >144MB
136 else if (physical_memory_mb >= 768) 135 else if (physical_memory_mb >= 768)
137 limit_bytes = physical_memory_mb / 10; // >76MB 136 limit_bytes = physical_memory_mb / 10; // >76MB
138 else 137 else
139 limit_bytes = physical_memory_mb / 12; // <64MB 138 limit_bytes = physical_memory_mb / 12; // <64MB
140 } else { 139 } else {
141 // Low-end devices have 512MB or less memory by definition 140 // Low-end devices have 512MB or less memory by definition
142 // so we hard code the limit rather than relying on the heuristics 141 // so we hard code the limit rather than relying on the heuristics
143 // above. Low-end devices use 4444 textures so we can use a lower limit. 142 // above. Low-end devices use 4444 textures so we can use a lower limit.
144 // NOTE: Low-end uses 2/3 (67%) of this memory in practice, so we have 143 // NOTE: Low-end uses 2/3 (67%) of this memory in practice, so we have
145 // increased the limit to 12 (8MB, or 12MB in emergencies). 144 // increased the limit to 12 (8MB, or 12MB in emergencies).
146 limit_bytes = 12; 145 limit_bytes = 12;
147 } 146 }
148 limit_bytes = limit_bytes * 1024 * 1024; 147 limit_bytes = limit_bytes * 1024 * 1024;
149 } 148 }
150 *bytes = limit_bytes; 149 *bytes = limit_bytes;
151 return true; 150 return true;
152 } 151 }
153 152
154 } 153 }
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/async_pixel_transfer_manager_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698