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

Unified 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 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: content/browser/gpu/gpu_data_manager_impl_private.cc
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc
index d7424120a5cd3a93cf390130413924ee22ea6f35..ccaee74eda83982fc6f28fe90d8c4151afef99be 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -247,16 +247,39 @@ void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info,
gfx::DeviceDisplayInfo info;
int default_tile_size = 256;
- // For very high resolution displays (eg. Nexus 10), set the default
- // tile size to be 512. This should be removed in favour of a generic
- // hueristic that works across all platforms and devices, once that
- // exists: http://crbug.com/159524. This switches to 512 for screens
- // containing 40 or more 256x256 tiles, such that 1080p devices do
- // not use 512x512 tiles (eg. 1920x1280 requires 37.5 tiles)
- int numTiles = (info.GetDisplayWidth() *
- info.GetDisplayHeight()) / (256 * 256);
- if (numTiles >= 40)
- default_tile_size = 512;
+ // TODO(epenner): Now that this is somewhat generic, maybe we can
+ // unify this for all platforms (http://crbug.com/159524)
+
+ bool real_size_supported = false;
+ 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/
+ int display_height = info.GetRealDisplayHeight(real_size_supported);
+ int portrait_width = std::min(display_width, display_height);
+ int landscape_width = std::max(display_width, display_height);
+
+ 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.
+ // Maximum HD dimensions should be 768x1280
+ // Maximum FHD dimensions should be 1200x1920
+ 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
+ default_tile_size = 384;
+ if (portrait_width > 1200 || landscape_width > 1920)
+ default_tile_size = 512;
+
+ // Adjust for some resolutions that barely straddle an extra
+ // tile when in portrait mode. This helps worst case scroll/raster
+ // by not needing a full extra tile for each row.
+ if (default_tile_size == 256 && portrait_width == 768)
+ default_tile_size += 32;
+ if (default_tile_size == 384 && portrait_width == 1200)
+ default_tile_size += 32;
+ } else {
+ // We don't know the exact resolution due to screen controls etc.
+ // So this just estimates the values above using tile counts.
+ int numTiles = (display_width * display_height) / (256 * 256);
+ if (numTiles > 16)
+ default_tile_size = 384;
+ if (numTiles >= 40)
+ default_tile_size = 512;
+ }
// IMG: Fast async texture uploads only work with non-power-of-two,
// but still multiple-of-eight sizes.
« 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