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

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

Issue 2258343002: Change GPU Tile rounding to 32 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 4 years, 4 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Even for really wide viewports, at some point GPU raster should use 46 // Even for really wide viewports, at some point GPU raster should use
47 // less than 4 tiles to fill the viewport. This is set to 256 as a 47 // less than 4 tiles to fill the viewport. This is set to 256 as a
48 // sane minimum for now, but we might want to tune this for low-end. 48 // sane minimum for now, but we might want to tune this for low-end.
49 const int kMinHeightForGpuRasteredTile = 256; 49 const int kMinHeightForGpuRasteredTile = 256;
50 50
51 // When making odd-sized tiles, round them up to increase the chances 51 // When making odd-sized tiles, round them up to increase the chances
52 // of using the same tile size. 52 // of using the same tile size.
53 const int kTileRoundUp = 64; 53 const int kTileRoundUp = 64;
54 54
55 // Round GPU default tile sizes to a multiple of 32. This helps prevent
56 // rounding errors during compositing.
57 const int kGpuDefaultTileRoundUp = 32;
58
55 // For performance reasons and to support compressed tile textures, tile 59 // For performance reasons and to support compressed tile textures, tile
56 // width and height should be an even multiple of 4 in size. 60 // width and height should be an even multiple of 4 in size.
57 const int kTileMinimalAlignment = 4; 61 const int kTileMinimalAlignment = 4;
58 62
59 // Large contents scale can cause overflow issues. Cap the ideal contents scale 63 // Large contents scale can cause overflow issues. Cap the ideal contents scale
60 // by this constant, since scales larger than this are usually not correct or 64 // by this constant, since scales larger than this are usually not correct or
61 // their scale doesn't matter as long as it's large. See 65 // their scale doesn't matter as long as it's large. See
62 // Renderer4.IdealContentsScale UMA for distribution of existing contents 66 // Renderer4.IdealContentsScale UMA for distribution of existing contents
63 // scales. 67 // scales.
64 const float kMaxIdealContentsScale = 10000.f; 68 const float kMaxIdealContentsScale = 10000.f;
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 divisor = 2; 764 divisor = 2;
761 if (content_bounds.width() <= viewport_width / 4) 765 if (content_bounds.width() <= viewport_width / 4)
762 divisor = 1; 766 divisor = 1;
763 default_tile_height = 767 default_tile_height =
764 MathUtil::UncheckedRoundUp(viewport_height, divisor) / divisor; 768 MathUtil::UncheckedRoundUp(viewport_height, divisor) / divisor;
765 769
766 // Grow default sizes to account for overlapping border texels. 770 // Grow default sizes to account for overlapping border texels.
767 default_tile_width += 2 * PictureLayerTiling::kBorderTexels; 771 default_tile_width += 2 * PictureLayerTiling::kBorderTexels;
768 default_tile_height += 2 * PictureLayerTiling::kBorderTexels; 772 default_tile_height += 2 * PictureLayerTiling::kBorderTexels;
769 773
770 // Round GPU default tile sizes to a multiple of kTileRoundUp. This 774 // Round GPU default tile sizes to a multiple of kGpuDefaultTileAlignment.
771 // helps prevent rounding errors in our CA path. crbug.com/632274 775 // This helps prevent rounding errors in our CA path. crbug.com/632274
772 default_tile_width = 776 default_tile_width =
773 MathUtil::UncheckedRoundUp(default_tile_width, kTileRoundUp); 777 MathUtil::UncheckedRoundUp(default_tile_width, kGpuDefaultTileRoundUp);
774 default_tile_height = 778 default_tile_height =
775 MathUtil::UncheckedRoundUp(default_tile_height, kTileRoundUp); 779 MathUtil::UncheckedRoundUp(default_tile_height, kGpuDefaultTileRoundUp);
776 780
777 default_tile_height = 781 default_tile_height =
778 std::max(default_tile_height, kMinHeightForGpuRasteredTile); 782 std::max(default_tile_height, kMinHeightForGpuRasteredTile);
779 } else { 783 } else {
780 // For CPU rasterization we use tile-size settings. 784 // For CPU rasterization we use tile-size settings.
781 const LayerTreeSettings& settings = layer_tree_impl()->settings(); 785 const LayerTreeSettings& settings = layer_tree_impl()->settings();
782 int max_untiled_content_width = settings.max_untiled_layer_size.width(); 786 int max_untiled_content_width = settings.max_untiled_layer_size.width();
783 int max_untiled_content_height = settings.max_untiled_layer_size.height(); 787 int max_untiled_content_height = settings.max_untiled_layer_size.height();
784 default_tile_width = settings.default_tile_size.width(); 788 default_tile_width = settings.default_tile_size.width();
785 default_tile_height = settings.default_tile_size.height(); 789 default_tile_height = settings.default_tile_size.height();
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1347 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1344 return !layer_tree_impl()->IsRecycleTree(); 1348 return !layer_tree_impl()->IsRecycleTree();
1345 } 1349 }
1346 1350
1347 bool PictureLayerImpl::HasValidTilePriorities() const { 1351 bool PictureLayerImpl::HasValidTilePriorities() const {
1348 return IsOnActiveOrPendingTree() && 1352 return IsOnActiveOrPendingTree() &&
1349 is_drawn_render_surface_layer_list_member(); 1353 is_drawn_render_surface_layer_list_member();
1350 } 1354 }
1351 1355
1352 } // namespace cc 1356 } // 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