Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1886)

Unified Diff: cc/tile_manager.cc

Issue 11637022: Send memory management policies to the tile manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« cc/tile_manager.h ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tile_manager.cc
diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
index 42b7ea331dd724eccc5b267888f4c93df9a66bcd..098e309dfe7d8f3b57ef2693dc62a285847e7b48 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -39,6 +39,18 @@ cc::TileManagerBin BinFromTilePriority(const cc::TilePriority& prio) {
const double prepainting_window_time_seconds = 1.0;
const double backfling_guard_distance_pixels = 314.0;
+ // Explicitly limit how far ahead we will prepaint for low and non-low res.
+ const double max_lores_paint_distance_pixels = 8192.0;
+ const double max_hires_paint_distance_pixels = 4096.0;
+ if (prio.resolution == cc::LOW_RESOLUTION) {
+ if (prio.distance_to_visible_in_pixels > max_lores_paint_distance_pixels)
+ return cc::NEVER_BIN;
+ }
+ else {
+ if (prio.distance_to_visible_in_pixels > max_hires_paint_distance_pixels)
+ return cc::NEVER_BIN;
+ }
+
if (prio.time_to_needed_in_seconds() == std::numeric_limits<float>::max())
return cc::NEVER_BIN;
@@ -147,7 +159,8 @@ ManagedTileState::ManagedTileState()
can_be_freed(true),
resource_is_being_initialized(false),
contents_swizzled(false),
- need_to_gather_pixel_refs(true) {
+ need_to_gather_pixel_refs(true),
+ gpu_memmgr_stats_bin(NEVER_BIN) {
}
ManagedTileState::~ManagedTileState() {
@@ -286,6 +299,7 @@ void TileManager::ManageTiles() {
mts.resolution = prio.resolution;
mts.time_to_needed_in_seconds = prio.time_to_needed_in_seconds();
mts.raster_bin = BinFromTilePriority(prio);
+ mts.gpu_memmgr_stats_bin = BinFromTilePriority(tile->combined_priority());
}
// Memory limit policy works by mapping some bin states to the NEVER bin.
@@ -340,8 +354,11 @@ void TileManager::ManageTiles() {
// Assign gpu memory and determine what tiles need to be rasterized.
AssignGpuMemoryToTiles();
- // Finally, kick the rasterizer.
+ // Kick the rasterizer.
DispatchMoreTasks();
+
+ // Finally, send the new managed memory statistics to the GPU memory manager
+ SendManagedMemoryStats();
}
void TileManager::CheckForCompletedSetPixels() {
@@ -399,6 +416,27 @@ int TileManager::GetDrawableTilesInBinCount(
return drawable_tiles_in_bin_count_[bin][tree];
}
+void TileManager::SendManagedMemoryStats() {
+ size_t memoryRequiredBytes = 0;
+ size_t memoryNiceToHaveBytes = 0;
+ size_t memoryUsedBytes = 0;
+ for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ Tile* tile = *it;
+ ManagedTileState& mts = tile->managed_state();
+ size_t tile_bytes = tile->bytes_consumed_if_allocated();
+ if (mts.gpu_memmgr_stats_bin == NOW_BIN)
+ memoryRequiredBytes += tile_bytes;
+ if (mts.gpu_memmgr_stats_bin != NEVER_BIN)
+ memoryNiceToHaveBytes += tile_bytes;
+ if (mts.can_use_gpu_memory)
+ memoryUsedBytes += tile_bytes;
+ }
+ client_->SendTileManagerMemoryStats(
+ memoryRequiredBytes,
+ memoryNiceToHaveBytes,
+ memoryUsedBytes);
+}
+
void TileManager::ResetBinCounts() {
for (int i = 0; i < NUM_BINS; ++i)
for (int j = 0; j < NUM_TREES; ++j)
« cc/tile_manager.h ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698