diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-22 03:48:26 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-22 03:48:26 +0000 |
commit | 33b1ce0e24c940414ddbec05c1c292ffcf6d4a04 (patch) | |
tree | bd8c559a7480d677a10df0b79ad7df54f650321c /cc/resources | |
parent | 68a2186a20cedea2de8561e3a24e34ad1e12c4a7 (diff) | |
download | chromium_src-33b1ce0e24c940414ddbec05c1c292ffcf6d4a04.zip chromium_src-33b1ce0e24c940414ddbec05c1c292ffcf6d4a04.tar.gz chromium_src-33b1ce0e24c940414ddbec05c1c292ffcf6d4a04.tar.bz2 |
cc: Prevent tiles that are required for activation from being placed in NEVER_BIN.
Some tiles that are required for activation might never be initialized
because we move them into EVENTUALLY_BIN before making adjustments
based on the memory policy. This is because EVENTUALLY_BIN will map
to NEVER_BIN when ALLOW_PREPAINT_ONLY or ALLOW_ABSOLUTE_MINIMUM is the
current memory policy.
This is fixed by moving low-res tiles into EVENTUALLY_BIN after
making adjustments based on current memory policy.
BUG=375801
TEST=cc_unittests --gtest_filter=TileManagerTests/TileManagerTest.EnoughMemoryPendingLowResAllowAbsoluteMinimum/*
Review URL: https://codereview.chromium.org/291093008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272077 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources')
-rw-r--r-- | cc/resources/tile_manager.cc | 25 | ||||
-rw-r--r-- | cc/resources/tile_manager_unittest.cc | 13 |
2 files changed, 27 insertions, 11 deletions
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index 9494586..82b6bf4 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -590,12 +590,6 @@ void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) { bool active_is_non_ideal = active_priority.resolution == NON_IDEAL_RESOLUTION; - // Adjust pending bin state for low res tiles. This prevents - // pending tree low-res tiles from being initialized before - // high-res tiles. - if (pending_is_low_res) - pending_bin = std::max(pending_bin, EVENTUALLY_BIN); - // Adjust bin state based on if ready to draw. active_bin = kBinReadyToDrawMap[tile_is_ready_to_draw][active_bin]; pending_bin = kBinReadyToDrawMap[tile_is_ready_to_draw][pending_bin]; @@ -611,14 +605,11 @@ void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) { if (!tile_is_ready_to_draw && pending_is_non_ideal) pending_bin = NEVER_BIN; - // Compute combined bin. - ManagedTileBin combined_bin = std::min(active_bin, pending_bin); - if (!tile_is_ready_to_draw || tile_version.requires_resource()) { // The bin that the tile would have if the GPU memory manager had // a maximally permissive policy, send to the GPU memory manager // to determine policy. - ManagedTileBin gpu_memmgr_stats_bin = combined_bin; + ManagedTileBin gpu_memmgr_stats_bin = std::min(active_bin, pending_bin); if ((gpu_memmgr_stats_bin == NOW_BIN) || (gpu_memmgr_stats_bin == NOW_AND_READY_TO_DRAW_BIN)) memory_required_bytes_ += BytesConsumedIfAllocated(tile); @@ -630,10 +621,15 @@ void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) { tree_bin[ACTIVE_TREE] = kBinPolicyMap[memory_policy][active_bin]; tree_bin[PENDING_TREE] = kBinPolicyMap[memory_policy][pending_bin]; + // Adjust pending bin state for low res tiles. This prevents pending tree + // low-res tiles from being initialized before high-res tiles. + if (pending_is_low_res) + tree_bin[PENDING_TREE] = std::max(tree_bin[PENDING_TREE], EVENTUALLY_BIN); + TilePriority tile_priority; switch (tree_priority) { case SAME_PRIORITY_FOR_BOTH_TREES: - mts.bin = kBinPolicyMap[memory_policy][combined_bin]; + mts.bin = std::min(tree_bin[ACTIVE_TREE], tree_bin[PENDING_TREE]); tile_priority = tile->combined_priority(); break; case SMOOTHNESS_TAKES_PRIORITY: @@ -662,6 +658,13 @@ void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) { mts.visible_and_ready_to_draw = tree_bin[ACTIVE_TREE] == NOW_AND_READY_TO_DRAW_BIN; + // Tiles that are required for activation shouldn't be in NEVER_BIN unless + // smoothness takes priority or memory policy allows nothing to be + // initialized. + DCHECK(!mts.required_for_activation || mts.bin != NEVER_BIN || + tree_priority == SMOOTHNESS_TAKES_PRIORITY || + memory_policy == ALLOW_NOTHING); + // If the tile is in NEVER_BIN and it does not have an active task, then we // can release the resources early. If it does have the task however, we // should keep it in the prioritized tile set to ensure that AssignGpuMemory diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc index 889a758..5a1837f 100644 --- a/cc/resources/tile_manager_unittest.cc +++ b/cc/resources/tile_manager_unittest.cc @@ -202,6 +202,19 @@ TEST_P(TileManagerTest, EnoughMemoryAllowPrepaintOnly) { EXPECT_EQ(0, AssignedMemoryCount(never_bin)); } +TEST_P(TileManagerTest, EnoughMemoryPendingLowResAllowAbsoluteMinimum) { + // A few low-res tiles required for activation, with enough memory for all + // tiles. + + Initialize(5, ALLOW_ABSOLUTE_MINIMUM, SAME_PRIORITY_FOR_BOTH_TREES); + TileVector pending_low_res = + CreateTiles(5, TilePriority(), TilePriorityLowRes()); + + tile_manager()->AssignMemoryToTiles(global_state_); + + EXPECT_EQ(5, AssignedMemoryCount(pending_low_res)); +} + TEST_P(TileManagerTest, EnoughMemoryAllowAbsoluteMinimum) { // A few tiles of each type of priority, with enough memory for all tiles, // with the exception of never and soon bins. |