Commit f54d5df0 authored by vmpstr's avatar vmpstr Committed by Commit bot

cc: Consider resolution when checking HigherPriorityTree.

When we skip shared tiles in raster iterators, we need to ensure
that we consider resolution as a factor, since the twin will not be
returning tiles if they are of non-ideal resolution (so we shouldn't
be skipping the tile if the twin has higher, but non ideal, priority).

BUG=477136
R=sunnyps, vmiura

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

Cr-Commit-Position: refs/heads/master@{#325346}
parent 5ddc6ffc
......@@ -86,12 +86,21 @@ WhichTree HigherPriorityTree(TreePriority tree_priority,
const TilingSetRasterQueueAll* active_queue,
const TilingSetRasterQueueAll* pending_queue,
const Tile* shared_tile) {
// In cases when we're given an active tile with a non ideal active resolution
// (or pending tile with non ideal pending resolution), we should return the
// other tree. The reason for this is that tiling set iterators will not
// return non ideal tiles and the only way we get here is if we're skipping
// twin tiles, but since it's non-ideal on the twin, we shouldn't skip it.
// TODO(vmpstr): Remove when tiles aren't shared.
const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top();
const Tile* pending_tile = shared_tile ? shared_tile : pending_queue->Top();
if (active_tile->priority(ACTIVE_TREE).resolution == NON_IDEAL_RESOLUTION)
return PENDING_TREE;
if (pending_tile->priority(PENDING_TREE).resolution == NON_IDEAL_RESOLUTION)
return ACTIVE_TREE;
switch (tree_priority) {
case SMOOTHNESS_TAKES_PRIORITY: {
const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top();
const Tile* pending_tile =
shared_tile ? shared_tile : pending_queue->Top();
const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE);
const TilePriority& pending_priority =
pending_tile->priority(PENDING_TREE);
......@@ -108,10 +117,6 @@ WhichTree HigherPriorityTree(TreePriority tree_priority,
case NEW_CONTENT_TAKES_PRIORITY:
return PENDING_TREE;
case SAME_PRIORITY_FOR_BOTH_TREES: {
const Tile* active_tile = shared_tile ? shared_tile : active_queue->Top();
const Tile* pending_tile =
shared_tile ? shared_tile : pending_queue->Top();
const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE);
const TilePriority& pending_priority =
pending_tile->priority(PENDING_TREE);
......
......@@ -426,6 +426,64 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
EXPECT_NE(new_content_tiles, required_for_draw_tiles);
}
TEST_F(TileManagerTilePriorityQueueTest,
RasterTilePriorityQueueHighNonIdealTilings) {
const gfx::Size layer_bounds(1000, 1000);
const gfx::Size viewport(800, 800);
host_impl_.SetViewportSize(viewport);
SetupDefaultTrees(layer_bounds);
pending_layer_->tilings()->AddTiling(1.5f, pending_layer_->raster_source());
active_layer_->tilings()->AddTiling(1.5f, active_layer_->raster_source());
pending_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0,
Occlusion(), true);
active_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0,
Occlusion(), true);
std::set<Tile*> all_expected_tiles;
for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i);
tiling->CreateAllTilesForTesting();
if (tiling->contents_scale() == 1.f) {
tiling->set_resolution(HIGH_RESOLUTION);
const auto& all_tiles = tiling->AllTilesForTesting();
all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
} else {
tiling->set_resolution(NON_IDEAL_RESOLUTION);
}
}
for (size_t i = 0; i < active_layer_->num_tilings(); ++i) {
PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i);
tiling->CreateAllTilesForTesting();
if (tiling->contents_scale() == 1.5f) {
tiling->set_resolution(HIGH_RESOLUTION);
const auto& all_tiles = tiling->AllTilesForTesting();
all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
} else {
tiling->set_resolution(NON_IDEAL_RESOLUTION);
}
}
scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue(
SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL));
EXPECT_FALSE(queue->IsEmpty());
size_t tile_count = 0;
std::set<Tile*> all_actual_tiles;
while (!queue->IsEmpty()) {
EXPECT_TRUE(queue->Top());
all_actual_tiles.insert(queue->Top());
++tile_count;
queue->Pop();
}
EXPECT_EQ(tile_count, all_actual_tiles.size());
EXPECT_EQ(all_expected_tiles.size(), all_actual_tiles.size());
EXPECT_EQ(all_expected_tiles, all_actual_tiles);
}
TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) {
const gfx::Size layer_bounds(1000, 1000);
host_impl_.SetViewportSize(gfx::Size(500, 500));
......
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