OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // Even for really wide viewports, at some point GPU raster should use | 45 // Even for really wide viewports, at some point GPU raster should use |
46 // less than 4 tiles to fill the viewport. This is set to 256 as a | 46 // less than 4 tiles to fill the viewport. This is set to 256 as a |
47 // sane minimum for now, but we might want to tune this for low-end. | 47 // sane minimum for now, but we might want to tune this for low-end. |
48 const int kMinHeightForGpuRasteredTile = 256; | 48 const int kMinHeightForGpuRasteredTile = 256; |
49 | 49 |
50 // When making odd-sized tiles, round them up to increase the chances | 50 // When making odd-sized tiles, round them up to increase the chances |
51 // of using the same tile size. | 51 // of using the same tile size. |
52 const int kTileRoundUp = 64; | 52 const int kTileRoundUp = 64; |
53 | 53 |
| 54 // Round GPU default tile sizes to a multiple of 32. This helps prevent |
| 55 // rounding errors during compositing. |
| 56 const int kGpuDefaultTileRoundUp = 32; |
| 57 |
54 // For performance reasons and to support compressed tile textures, tile | 58 // For performance reasons and to support compressed tile textures, tile |
55 // width and height should be an even multiple of 4 in size. | 59 // width and height should be an even multiple of 4 in size. |
56 const int kTileMinimalAlignment = 4; | 60 const int kTileMinimalAlignment = 4; |
57 | 61 |
58 } // namespace | 62 } // namespace |
59 | 63 |
60 namespace cc { | 64 namespace cc { |
61 | 65 |
62 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, | 66 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, |
63 int id, | 67 int id, |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 divisor = 2; | 736 divisor = 2; |
733 if (content_bounds.width() <= viewport_width / 4) | 737 if (content_bounds.width() <= viewport_width / 4) |
734 divisor = 1; | 738 divisor = 1; |
735 default_tile_height = | 739 default_tile_height = |
736 MathUtil::UncheckedRoundUp(viewport_height, divisor) / divisor; | 740 MathUtil::UncheckedRoundUp(viewport_height, divisor) / divisor; |
737 | 741 |
738 // Grow default sizes to account for overlapping border texels. | 742 // Grow default sizes to account for overlapping border texels. |
739 default_tile_width += 2 * PictureLayerTiling::kBorderTexels; | 743 default_tile_width += 2 * PictureLayerTiling::kBorderTexels; |
740 default_tile_height += 2 * PictureLayerTiling::kBorderTexels; | 744 default_tile_height += 2 * PictureLayerTiling::kBorderTexels; |
741 | 745 |
| 746 // Round GPU default tile sizes to a multiple of kGpuDefaultTileAlignment. |
| 747 // This helps prevent rounding errors in our CA path. crbug.com/632274 |
| 748 default_tile_width = |
| 749 MathUtil::UncheckedRoundUp(default_tile_width, kGpuDefaultTileRoundUp); |
| 750 default_tile_height = |
| 751 MathUtil::UncheckedRoundUp(default_tile_height, kGpuDefaultTileRoundUp); |
| 752 |
742 default_tile_height = | 753 default_tile_height = |
743 std::max(default_tile_height, kMinHeightForGpuRasteredTile); | 754 std::max(default_tile_height, kMinHeightForGpuRasteredTile); |
744 } else { | 755 } else { |
745 // For CPU rasterization we use tile-size settings. | 756 // For CPU rasterization we use tile-size settings. |
746 const LayerTreeSettings& settings = layer_tree_impl()->settings(); | 757 const LayerTreeSettings& settings = layer_tree_impl()->settings(); |
747 int max_untiled_content_width = settings.max_untiled_layer_size.width(); | 758 int max_untiled_content_width = settings.max_untiled_layer_size.width(); |
748 int max_untiled_content_height = settings.max_untiled_layer_size.height(); | 759 int max_untiled_content_height = settings.max_untiled_layer_size.height(); |
749 default_tile_width = settings.default_tile_size.width(); | 760 default_tile_width = settings.default_tile_size.width(); |
750 default_tile_height = settings.default_tile_size.height(); | 761 default_tile_height = settings.default_tile_size.height(); |
751 | 762 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1315 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1305 return !layer_tree_impl()->IsRecycleTree(); | 1316 return !layer_tree_impl()->IsRecycleTree(); |
1306 } | 1317 } |
1307 | 1318 |
1308 bool PictureLayerImpl::HasValidTilePriorities() const { | 1319 bool PictureLayerImpl::HasValidTilePriorities() const { |
1309 return IsOnActiveOrPendingTree() && | 1320 return IsOnActiveOrPendingTree() && |
1310 is_drawn_render_surface_layer_list_member(); | 1321 is_drawn_render_surface_layer_list_member(); |
1311 } | 1322 } |
1312 | 1323 |
1313 } // namespace cc | 1324 } // namespace cc |
OLD | NEW |