Commit 0ad654fa authored by vmpstr's avatar vmpstr Committed by Commit bot

cc: Bump up pending tree now tiles order for smoothness mode.

In smoothness takes priority mode, we should ensure to return tiles
that are required for activation sooner than eventually bin. The reason
for this is that we don't want to starve activation and the prepainting
required for smoothness should already be covered by the soon bin.

Additionally, we have to ensure not to mark these tiles as violating
memory policy, since required for activation tiles need special
treatment (unfortunately). The reason for this is that activation is
currently tied to updating our recordings and smoothness mode would
otherwise starve activation even if we're past the recording region.

BUG=422819
R=reveman

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

Cr-Commit-Position: refs/heads/master@{#299386}
parent f44ffcbe
...@@ -69,8 +69,23 @@ WhichTree HigherPriorityTree( ...@@ -69,8 +69,23 @@ WhichTree HigherPriorityTree(
const PictureLayerImpl::LayerRasterTileIterator* pending_iterator, const PictureLayerImpl::LayerRasterTileIterator* pending_iterator,
const Tile* shared_tile) { const Tile* shared_tile) {
switch (tree_priority) { switch (tree_priority) {
case SMOOTHNESS_TAKES_PRIORITY: case SMOOTHNESS_TAKES_PRIORITY: {
const Tile* active_tile = shared_tile ? shared_tile : **active_iterator;
const Tile* pending_tile = shared_tile ? shared_tile : **pending_iterator;
const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE);
const TilePriority& pending_priority =
pending_tile->priority(PENDING_TREE);
// If we're down to eventually bin tiles on the active tree, process the
// pending tree to allow tiles required for activation to be initialized
// when memory policy only allows prepaint.
if (active_priority.priority_bin == TilePriority::EVENTUALLY &&
pending_priority.priority_bin == TilePriority::NOW) {
return PENDING_TREE;
}
return ACTIVE_TREE; return ACTIVE_TREE;
}
case NEW_CONTENT_TAKES_PRIORITY: case NEW_CONTENT_TAKES_PRIORITY:
return PENDING_TREE; return PENDING_TREE;
case SAME_PRIORITY_FOR_BOTH_TREES: { case SAME_PRIORITY_FOR_BOTH_TREES: {
......
...@@ -500,10 +500,8 @@ bool TileManager::FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( ...@@ -500,10 +500,8 @@ bool TileManager::FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit(
return false; return false;
Tile* tile = eviction_priority_queue_.Top(); Tile* tile = eviction_priority_queue_.Top();
if (!other_priority.IsHigherPriorityThan( if (!other_priority.IsHigherPriorityThan(tile->combined_priority()))
tile->priority_for_tree_priority(global_state_.tree_priority))) {
return false; return false;
}
*usage -= MemoryUsage::FromTile(tile); *usage -= MemoryUsage::FromTile(tile);
FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile);
...@@ -560,8 +558,7 @@ void TileManager::AssignGpuMemoryToTiles( ...@@ -560,8 +558,7 @@ void TileManager::AssignGpuMemoryToTiles(
while (!raster_priority_queue_.IsEmpty()) { while (!raster_priority_queue_.IsEmpty()) {
Tile* tile = raster_priority_queue_.Top(); Tile* tile = raster_priority_queue_.Top();
TilePriority priority = TilePriority priority = tile->combined_priority();
tile->priority_for_tree_priority(global_state_.tree_priority);
if (TilePriorityViolatesMemoryPolicy(priority)) if (TilePriorityViolatesMemoryPolicy(priority))
break; break;
......
...@@ -221,7 +221,7 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { ...@@ -221,7 +221,7 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
Tile* last_tile = NULL; Tile* last_tile = NULL;
smoothness_tiles.clear(); smoothness_tiles.clear();
tile_count = 0; tile_count = 0;
size_t increasing_distance_tiles = 0u; size_t correct_order_tiles = 0u;
// Here we expect to get increasing ACTIVE_TREE priority_bin. // Here we expect to get increasing ACTIVE_TREE priority_bin.
queue.Reset(); queue.Reset();
host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY);
...@@ -234,11 +234,19 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { ...@@ -234,11 +234,19 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin, EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin,
tile->priority(ACTIVE_TREE).priority_bin); tile->priority(ACTIVE_TREE).priority_bin);
bool skip_updating_last_tile = false;
if (last_tile->priority(ACTIVE_TREE).priority_bin == if (last_tile->priority(ACTIVE_TREE).priority_bin ==
tile->priority(ACTIVE_TREE).priority_bin) { tile->priority(ACTIVE_TREE).priority_bin) {
increasing_distance_tiles += correct_order_tiles +=
last_tile->priority(ACTIVE_TREE).distance_to_visible <= last_tile->priority(ACTIVE_TREE).distance_to_visible <=
tile->priority(ACTIVE_TREE).distance_to_visible; tile->priority(ACTIVE_TREE).distance_to_visible;
} else if (tile->priority(ACTIVE_TREE).priority_bin ==
TilePriority::EVENTUALLY &&
tile->priority(PENDING_TREE).priority_bin == TilePriority::NOW) {
// Since we'd return pending tree now tiles before the eventually tiles on
// the active tree, update the value.
++correct_order_tiles;
skip_updating_last_tile = true;
} }
if (tile->priority(ACTIVE_TREE).priority_bin == TilePriority::NOW && if (tile->priority(ACTIVE_TREE).priority_bin == TilePriority::NOW &&
...@@ -248,7 +256,8 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { ...@@ -248,7 +256,8 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution); EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution);
} }
last_tile = tile; if (!skip_updating_last_tile)
last_tile = tile;
++tile_count; ++tile_count;
smoothness_tiles.insert(tile); smoothness_tiles.insert(tile);
queue.Pop(); queue.Pop();
...@@ -258,11 +267,11 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { ...@@ -258,11 +267,11 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
EXPECT_EQ(all_tiles, smoothness_tiles); EXPECT_EQ(all_tiles, smoothness_tiles);
// Since we don't guarantee increasing distance due to spiral iterator, we // Since we don't guarantee increasing distance due to spiral iterator, we
// should check that we're _mostly_ right. // should check that we're _mostly_ right.
EXPECT_GT(increasing_distance_tiles, 3 * tile_count / 4); EXPECT_GT(correct_order_tiles, 3 * tile_count / 4);
std::set<Tile*> new_content_tiles; std::set<Tile*> new_content_tiles;
last_tile = NULL; last_tile = NULL;
increasing_distance_tiles = 0u; size_t increasing_distance_tiles = 0u;
// Here we expect to get increasing PENDING_TREE priority_bin. // Here we expect to get increasing PENDING_TREE priority_bin.
queue.Reset(); queue.Reset();
host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY); host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY);
......
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