Commit 20650a53 authored by epenner's avatar epenner Committed by Commit bot

CC: Decouple tile-grid-size from tile-size.

Using the tile-size for the tile-grid-size isn't effective, since
these have different scales etc.

This patch adds a new setting such that we can start to tune this
independantly of other settings.

BUG=365877

Review URL: https://codereview.chromium.org/666573002

Cr-Commit-Position: refs/heads/master@{#300420}
parent e89e058e
...@@ -60,7 +60,7 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { ...@@ -60,7 +60,7 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
Layer::SetLayerTreeHost(host); Layer::SetLayerTreeHost(host);
if (host) { if (host) {
pile_->SetMinContentsScale(host->settings().minimum_contents_scale); pile_->SetMinContentsScale(host->settings().minimum_contents_scale);
pile_->SetTileGridSize(host->settings().default_tile_size); pile_->SetTileGridSize(host->settings().default_tile_grid_size);
pile_->set_slow_down_raster_scale_factor( pile_->set_slow_down_raster_scale_factor(
host->debug_state().slow_down_raster_scale_factor); host->debug_state().slow_down_raster_scale_factor);
pile_->set_show_debug_picture_borders( pile_->set_show_debug_picture_borders(
......
...@@ -84,5 +84,23 @@ TEST(PictureLayerTest, SuitableForGpuRasterization) { ...@@ -84,5 +84,23 @@ TEST(PictureLayerTest, SuitableForGpuRasterization) {
EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); EXPECT_FALSE(layer->IsSuitableForGpuRasterization());
} }
TEST(PictureLayerTest, UseTileGridSize) {
LayerTreeSettings settings;
settings.default_tile_grid_size = gfx::Size(123, 123);
MockContentLayerClient client;
scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client);
FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D);
scoped_ptr<FakeLayerTreeHost> host =
FakeLayerTreeHost::Create(&host_client, settings);
host->SetRootLayer(layer);
// Tile-grid is set according to its setting.
SkTileGridFactory::TileGridInfo info =
layer->GetPicturePileForTesting()->GetTileGridInfoForTesting();
EXPECT_EQ(info.fTileInterval.width(), 123 - 2 * info.fMargin.width());
EXPECT_EQ(info.fTileInterval.height(), 123 - 2 * info.fMargin.height());
}
} // namespace } // namespace
} // namespace cc } // namespace cc
...@@ -65,6 +65,10 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { ...@@ -65,6 +65,10 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
void AsValueInto(base::debug::TracedValue* array) const; void AsValueInto(base::debug::TracedValue* array) const;
SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const {
return tile_grid_info_;
}
protected: protected:
class CC_EXPORT PictureInfo { class CC_EXPORT PictureInfo {
public: public:
......
...@@ -22,7 +22,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile( ...@@ -22,7 +22,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile(
scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
pile->tiling().SetTilingSize(layer_bounds); pile->tiling().SetTilingSize(layer_bounds);
pile->tiling().SetMaxTextureSize(tile_size); pile->tiling().SetMaxTextureSize(tile_size);
pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
pile->recorded_viewport_ = gfx::Rect(layer_bounds); pile->recorded_viewport_ = gfx::Rect(layer_bounds);
pile->has_any_recordings_ = true; pile->has_any_recordings_ = true;
for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) {
...@@ -38,7 +38,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( ...@@ -38,7 +38,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile(
scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
pile->tiling().SetTilingSize(layer_bounds); pile->tiling().SetTilingSize(layer_bounds);
pile->tiling().SetMaxTextureSize(tile_size); pile->tiling().SetMaxTextureSize(tile_size);
pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
pile->recorded_viewport_ = gfx::Rect(); pile->recorded_viewport_ = gfx::Rect();
pile->has_any_recordings_ = false; pile->has_any_recordings_ = false;
return pile; return pile;
...@@ -51,7 +51,7 @@ FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( ...@@ -51,7 +51,7 @@ FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl());
pile->tiling().SetTilingSize(layer_bounds); pile->tiling().SetTilingSize(layer_bounds);
pile->tiling().SetMaxTextureSize(tile_size); pile->tiling().SetMaxTextureSize(tile_size);
pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
// This simulates a false positive for this flag. // This simulates a false positive for this flag.
pile->recorded_viewport_ = gfx::Rect(); pile->recorded_viewport_ = gfx::Rect();
pile->has_any_recordings_ = true; pile->has_any_recordings_ = true;
......
...@@ -49,6 +49,7 @@ LayerTreeSettings::LayerTreeSettings() ...@@ -49,6 +49,7 @@ LayerTreeSettings::LayerTreeSettings()
max_partial_texture_updates(std::numeric_limits<size_t>::max()), max_partial_texture_updates(std::numeric_limits<size_t>::max()),
default_tile_size(gfx::Size(256, 256)), default_tile_size(gfx::Size(256, 256)),
max_untiled_layer_size(gfx::Size(512, 512)), max_untiled_layer_size(gfx::Size(512, 512)),
default_tile_grid_size(gfx::Size(256, 256)),
minimum_occlusion_tracking_size(gfx::Size(160, 160)), minimum_occlusion_tracking_size(gfx::Size(160, 160)),
use_pinch_zoom_scrollbars(false), use_pinch_zoom_scrollbars(false),
use_pinch_virtual_viewport(false), use_pinch_virtual_viewport(false),
......
...@@ -60,6 +60,7 @@ class CC_EXPORT LayerTreeSettings { ...@@ -60,6 +60,7 @@ class CC_EXPORT LayerTreeSettings {
size_t max_partial_texture_updates; size_t max_partial_texture_updates;
gfx::Size default_tile_size; gfx::Size default_tile_size;
gfx::Size max_untiled_layer_size; gfx::Size max_untiled_layer_size;
gfx::Size default_tile_grid_size;
gfx::Size minimum_occlusion_tracking_size; gfx::Size minimum_occlusion_tracking_size;
bool use_pinch_zoom_scrollbars; bool use_pinch_zoom_scrollbars;
bool use_pinch_virtual_viewport; bool use_pinch_virtual_viewport;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment