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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 119763002: Android: Adjust tile-size using 'real' resolution in JB-MR1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 | « no previous file | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/gpu/gpu_data_manager_impl_private.h" 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info, 240 void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info,
241 CommandLine* command_line) { 241 CommandLine* command_line) {
242 std::string vendor(StringToLowerASCII(gpu_info.gl_vendor)); 242 std::string vendor(StringToLowerASCII(gpu_info.gl_vendor));
243 std::string renderer(StringToLowerASCII(gpu_info.gl_renderer)); 243 std::string renderer(StringToLowerASCII(gpu_info.gl_renderer));
244 bool is_img = 244 bool is_img =
245 gpu_info.gl_vendor.find("Imagination") != std::string::npos; 245 gpu_info.gl_vendor.find("Imagination") != std::string::npos;
246 246
247 gfx::DeviceDisplayInfo info; 247 gfx::DeviceDisplayInfo info;
248 int default_tile_size = 256; 248 int default_tile_size = 256;
249 249
250 // For very high resolution displays (eg. Nexus 10), set the default 250 // TODO(epenner): Now that this is somewhat generic, maybe we can
251 // tile size to be 512. This should be removed in favour of a generic 251 // unify this for all platforms (http://crbug.com/159524)
252 // hueristic that works across all platforms and devices, once that 252
253 // exists: http://crbug.com/159524. This switches to 512 for screens 253 bool real_size_supported = false;
254 // containing 40 or more 256x256 tiles, such that 1080p devices do 254 int display_width = info.GetRealDisplayWidth(real_size_supported);
no sievers 2013/12/20 19:24:25 I don't see these functions in ui/gfx/android/devi
epennerAtGoogle 2013/12/20 19:34:22 Yep: https://codereview.chromium.org/93933016/
255 // not use 512x512 tiles (eg. 1920x1280 requires 37.5 tiles) 255 int display_height = info.GetRealDisplayHeight(real_size_supported);
256 int numTiles = (info.GetDisplayWidth() * 256 int portrait_width = std::min(display_width, display_height);
257 info.GetDisplayHeight()) / (256 * 256); 257 int landscape_width = std::max(display_width, display_height);
258 if (numTiles >= 40) 258
259 default_tile_size = 512; 259 if (real_size_supported) {
no sievers 2013/12/20 19:24:25 where does that ever get set to |true|?
epennerAtGoogle 2013/12/20 19:34:22 It's an out-param by reference. I could use a poin
no sievers 2013/12/20 19:43:34 I think per style guide it's const-ref or pointer
epenner 2013/12/20 23:00:56 Done.
260 // Maximum HD dimensions should be 768x1280
261 // Maximum FHD dimensions should be 1200x1920
262 if (portrait_width > 768 || landscape_width > 1280)
no sievers 2013/12/20 19:24:25 nit: is it more readable to maybe put all of this
epennerAtGoogle 2013/12/20 19:34:22 I'm not sure about that one. That combines several
no sievers 2013/12/20 19:43:34 I just find it a bit easier to read, because to fo
epenner 2013/12/20 23:00:56 I get your point and we do change it more than onc
263 default_tile_size = 384;
264 if (portrait_width > 1200 || landscape_width > 1920)
265 default_tile_size = 512;
266
267 // Adjust for some resolutions that barely straddle an extra
268 // tile when in portrait mode. This helps worst case scroll/raster
269 // by not needing a full extra tile for each row.
270 if (default_tile_size == 256 && portrait_width == 768)
271 default_tile_size += 32;
272 if (default_tile_size == 384 && portrait_width == 1200)
273 default_tile_size += 32;
274 } else {
275 // We don't know the exact resolution due to screen controls etc.
276 // So this just estimates the values above using tile counts.
277 int numTiles = (display_width * display_height) / (256 * 256);
278 if (numTiles > 16)
279 default_tile_size = 384;
280 if (numTiles >= 40)
281 default_tile_size = 512;
282 }
260 283
261 // IMG: Fast async texture uploads only work with non-power-of-two, 284 // IMG: Fast async texture uploads only work with non-power-of-two,
262 // but still multiple-of-eight sizes. 285 // but still multiple-of-eight sizes.
263 // http://crbug.com/168099 286 // http://crbug.com/168099
264 if (is_img) 287 if (is_img)
265 default_tile_size -= 8; 288 default_tile_size -= 8;
266 289
267 // Set the command line if it isn't already set and we changed 290 // Set the command line if it isn't already set and we changed
268 // the default tile size. 291 // the default tile size.
269 if (default_tile_size != 256 && 292 if (default_tile_size != 256 &&
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 1200
1178 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1201 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1179 gpu_process_accessible_ = false; 1202 gpu_process_accessible_ = false;
1180 gpu_info_.finalized = true; 1203 gpu_info_.finalized = true;
1181 complete_gpu_info_already_requested_ = true; 1204 complete_gpu_info_already_requested_ = true;
1182 // Some observers might be waiting. 1205 // Some observers might be waiting.
1183 NotifyGpuInfoUpdate(); 1206 NotifyGpuInfoUpdate();
1184 } 1207 }
1185 1208
1186 } // namespace content 1209 } // namespace content
OLDNEW
« 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