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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 626113004: CC: Have GPU-raster tiles exactly match the viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CC_cleanup_tile_grid_size
Patch Set: Fix tests for min-size. Created 6 years, 2 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 | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 27 matching lines...) Expand all
38 const float kSnapToExistingTilingRatio = 1.2f; 38 const float kSnapToExistingTilingRatio = 1.2f;
39 39
40 // Estimate skewport 60 frames ahead for pre-rasterization on the CPU. 40 // Estimate skewport 60 frames ahead for pre-rasterization on the CPU.
41 const float kCpuSkewportTargetTimeInFrames = 60.0f; 41 const float kCpuSkewportTargetTimeInFrames = 60.0f;
42 42
43 // Don't pre-rasterize on the GPU (except for kBackflingGuardDistancePixels in 43 // Don't pre-rasterize on the GPU (except for kBackflingGuardDistancePixels in
44 // TileManager::BinFromTilePriority). 44 // TileManager::BinFromTilePriority).
45 const float kGpuSkewportTargetTimeInFrames = 0.0f; 45 const float kGpuSkewportTargetTimeInFrames = 0.0f;
46 46
47 // Even for really wide viewports, at some point GPU raster should use 47 // Even for really wide viewports, at some point GPU raster should use
48 // less than 4 tiles to fill the viewport. This is set to 128 as a 48 // less than 4 tiles to fill the viewport. This is set to 256 as a
49 // sane minimum for now, but we might want to increase with tuning. 49 // sane minimum for now, but we might want to tune this for low-end.
50 const int kMinHeightForGpuRasteredTile = 128; 50 const int kMinHeightForGpuRasteredTile = 256;
51 51
52 // When making odd-sized tiles, round them up to increase the chances 52 // When making odd-sized tiles, round them up to increase the chances
53 // of using the same tile size. 53 // of using the same tile size.
54 const int kTileRoundUp = 64; 54 const int kTileRoundUp = 64;
55 55
56 } // namespace 56 } // namespace
57 57
58 namespace cc { 58 namespace cc {
59 59
60 PictureLayerImpl::Pair::Pair() : active(NULL), pending(NULL) { 60 PictureLayerImpl::Pair::Pair() : active(NULL), pending(NULL) {
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 685
686 int default_tile_width = 0; 686 int default_tile_width = 0;
687 int default_tile_height = 0; 687 int default_tile_height = 0;
688 if (layer_tree_impl()->use_gpu_rasterization()) { 688 if (layer_tree_impl()->use_gpu_rasterization()) {
689 // For GPU rasterization, we pick an ideal tile size using the viewport 689 // For GPU rasterization, we pick an ideal tile size using the viewport
690 // so we don't need any settings. The current approach uses 4 tiles 690 // so we don't need any settings. The current approach uses 4 tiles
691 // to cover the viewport vertically. 691 // to cover the viewport vertically.
692 int viewport_width = layer_tree_impl()->device_viewport_size().width(); 692 int viewport_width = layer_tree_impl()->device_viewport_size().width();
693 int viewport_height = layer_tree_impl()->device_viewport_size().height(); 693 int viewport_height = layer_tree_impl()->device_viewport_size().height();
694 default_tile_width = viewport_width; 694 default_tile_width = viewport_width;
695 default_tile_height = viewport_height / 4; 695 // Also, increase the height proportionally as the width decreases, and
696 // pad by our border texels to make the tiles exactly match the viewport.
697 int divisor = 4;
698 if (content_bounds.width() <= viewport_width / 2)
699 divisor = 2;
700 if (content_bounds.width() <= viewport_width / 4)
701 divisor = 1;
702 default_tile_height = RoundUp(viewport_height, divisor) / divisor;
703 default_tile_height += 2 * PictureLayerTiling::kBorderTexels;
696 default_tile_height = 704 default_tile_height =
697 std::max(default_tile_height, kMinHeightForGpuRasteredTile); 705 std::max(default_tile_height, kMinHeightForGpuRasteredTile);
698
699 // Increase the tile-height proportionally when the content width
700 // drops below half the viewport width.
701 if (content_bounds.width() <= viewport_width / 2)
702 default_tile_height *= 2;
703 } else { 706 } else {
704 // For CPU rasterization we use tile-size settings. 707 // For CPU rasterization we use tile-size settings.
705 const LayerTreeSettings& settings = layer_tree_impl()->settings(); 708 const LayerTreeSettings& settings = layer_tree_impl()->settings();
706 int max_untiled_content_width = settings.max_untiled_layer_size.width(); 709 int max_untiled_content_width = settings.max_untiled_layer_size.width();
707 int max_untiled_content_height = settings.max_untiled_layer_size.height(); 710 int max_untiled_content_height = settings.max_untiled_layer_size.height();
708 default_tile_width = settings.default_tile_size.width(); 711 default_tile_width = settings.default_tile_size.width();
709 default_tile_height = settings.default_tile_size.height(); 712 default_tile_height = settings.default_tile_size.height();
710 713
711 // If the content width is small, increase tile size vertically. 714 // If the content width is small, increase tile size vertically.
712 // If the content height is small, increase tile size horizontally. 715 // If the content height is small, increase tile size horizontally.
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1815 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1813 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1816 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1814 return tiling_range.end - 1 - current_tiling_range_offset; 1817 return tiling_range.end - 1 - current_tiling_range_offset;
1815 } 1818 }
1816 } 1819 }
1817 NOTREACHED(); 1820 NOTREACHED();
1818 return 0; 1821 return 0;
1819 } 1822 }
1820 1823
1821 } // namespace cc 1824 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698