summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmpstr <vmpstr@chromium.org>2015-04-03 15:35:11 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-03 22:36:08 +0000
commitba84d9f7d200b847d5d6cefefa324f972f9541aa (patch)
tree8662e9a3e56caffccc917a558ee7a5f437af2614
parenta4c9d060fa6e74b6513b198064cfe7b06482d404 (diff)
downloadchromium_src-ba84d9f7d200b847d5d6cefefa324f972f9541aa.zip
chromium_src-ba84d9f7d200b847d5d6cefefa324f972f9541aa.tar.gz
chromium_src-ba84d9f7d200b847d5d6cefefa324f972f9541aa.tar.bz2
cc: Make the invalidation frequency buffer bigger.
With large enough tiles we can get visible checkerboards if the buffer we use for invalidation frequency is too small. Note that this fix is a work around to make this case less likely to hit. The proper fix is to stop repainting off screen frequently invalidating content at a higher level. R=enne, danakj BUG=467197 Review URL: https://codereview.chromium.org/1059403002 Cr-Commit-Position: refs/heads/master@{#323838}
-rw-r--r--cc/resources/picture_pile.cc4
-rw-r--r--cc/resources/picture_pile_unittest.cc33
2 files changed, 22 insertions, 15 deletions
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index b5b9c79..76570ed 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -30,8 +30,10 @@ const int kBasePictureSize = 512;
// indicates when to stop invalidating offscreen regions.
// kFrequentInvalidationDistanceThreshold defines what it means to be
// "offscreen" in terms of distance to visible in css pixels.
+// TODO(vmpstr): Remove invalidation frequency after frequently invalidated
+// content is not painted at a higher level.
const float kInvalidationFrequencyThreshold = 0.75f;
-const int kFrequentInvalidationDistanceThreshold = 512;
+const int kFrequentInvalidationDistanceThreshold = 1024;
// TODO(humper): The density threshold here is somewhat arbitrary; need a
// way to set // this from the command line so we can write a benchmark
diff --git a/cc/resources/picture_pile_unittest.cc b/cc/resources/picture_pile_unittest.cc
index 91ad7ce..bfeb082 100644
--- a/cc/resources/picture_pile_unittest.cc
+++ b/cc/resources/picture_pile_unittest.cc
@@ -287,6 +287,7 @@ TEST_F(PicturePileTest, StopRecordingOffscreenInvalidations) {
UpdateAndExpandInvalidation(&invalidation, tiling_size(), viewport);
EXPECT_EQ(tiling_rect().ToString(), invalidation.ToString());
+ bool had_tiles_with_no_pictures = false;
for (int i = 0; i < pile_.tiling().num_tiles_x(); ++i) {
for (int j = 0; j < pile_.tiling().num_tiles_y(); ++j) {
FakePicturePile::PictureInfo& picture_info =
@@ -297,13 +298,17 @@ TEST_F(PicturePileTest, StopRecordingOffscreenInvalidations) {
// If the y far enough away we expect to find no picture (no re-recording
// happened). For close y, the picture should change.
- if (j >= 2)
+ if (j >= 3) {
EXPECT_FALSE(picture_info.GetPicture()) << "i " << i << " j " << j;
- else
+ had_tiles_with_no_pictures = true;
+ } else {
EXPECT_TRUE(picture_info.GetPicture()) << "i " << i << " j " << j;
+ }
}
}
+ EXPECT_TRUE(had_tiles_with_no_pictures);
+
// Update a partial tile that doesn't get recorded. We should expand the
// invalidation to the entire tiles that overlap it.
Region small_invalidation =
@@ -360,20 +365,20 @@ TEST_F(PicturePileTest, FrequentInvalidationCanRaster) {
gfx::ToCeiledSize(gfx::ScaleSize(tiling_size(), 4.f));
SetTilingSize(new_tiling_size);
- gfx::Rect tile01_borders = pile_.tiling().TileBoundsWithBorder(0, 1);
gfx::Rect tile02_borders = pile_.tiling().TileBoundsWithBorder(0, 2);
- gfx::Rect tile01_noborders = pile_.tiling().TileBounds(0, 1);
+ gfx::Rect tile03_borders = pile_.tiling().TileBoundsWithBorder(0, 3);
gfx::Rect tile02_noborders = pile_.tiling().TileBounds(0, 2);
+ gfx::Rect tile03_noborders = pile_.tiling().TileBounds(0, 3);
// Sanity check these two tiles are overlapping with borders, since this is
// what the test is trying to repro.
- EXPECT_TRUE(tile01_borders.Intersects(tile02_borders));
- EXPECT_FALSE(tile01_noborders.Intersects(tile02_noborders));
+ EXPECT_TRUE(tile02_borders.Intersects(tile03_borders));
+ EXPECT_FALSE(tile02_noborders.Intersects(tile03_noborders));
UpdateWholePile();
- EXPECT_TRUE(pile_.CanRasterLayerRect(tile01_noborders));
- EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile01_noborders));
EXPECT_TRUE(pile_.CanRasterLayerRect(tile02_noborders));
EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile02_noborders));
+ EXPECT_TRUE(pile_.CanRasterLayerRect(tile03_noborders));
+ EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile03_noborders));
// Sanity check that an initial paint goes down the fast path of having
// a valid recorded viewport.
EXPECT_TRUE(!pile_.recorded_viewport().IsEmpty());
@@ -391,16 +396,16 @@ TEST_F(PicturePileTest, FrequentInvalidationCanRaster) {
// Sanity check some pictures exist and others don't.
EXPECT_TRUE(pile_.picture_map()
- .find(FakePicturePile::PictureMapKey(0, 1))
+ .find(FakePicturePile::PictureMapKey(0, 2))
->second.GetPicture());
EXPECT_FALSE(pile_.picture_map()
- .find(FakePicturePile::PictureMapKey(0, 2))
+ .find(FakePicturePile::PictureMapKey(0, 3))
->second.GetPicture());
- EXPECT_TRUE(pile_.CanRasterLayerRect(tile01_noborders));
- EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile01_noborders));
- EXPECT_FALSE(pile_.CanRasterLayerRect(tile02_noborders));
- EXPECT_FALSE(pile_.CanRasterSlowTileCheck(tile02_noborders));
+ EXPECT_TRUE(pile_.CanRasterLayerRect(tile02_noborders));
+ EXPECT_TRUE(pile_.CanRasterSlowTileCheck(tile02_noborders));
+ EXPECT_FALSE(pile_.CanRasterLayerRect(tile03_noborders));
+ EXPECT_FALSE(pile_.CanRasterSlowTileCheck(tile03_noborders));
}
TEST_F(PicturePileTest, NoInvalidationValidViewport) {