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

Unified Diff: cc/resources/tile_manager.cc

Issue 22900018: cc: Set the mapped memory reclaim limit for the renderer compositor on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 7 years, 4 months 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
Index: cc/resources/tile_manager.cc
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 3e91167866031a18cb3c342f37f4f1fa4c9d3c1b..6f86daf146409639193bd7567af7390cfe4a38c7 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -124,7 +124,8 @@ scoped_ptr<TileManager> TileManager::Create(
ResourceProvider* resource_provider,
size_t num_raster_threads,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
- bool use_map_image) {
+ bool use_map_image,
+ ContextProvider* context_provider) {
return make_scoped_ptr(
new TileManager(client,
resource_provider,
@@ -132,7 +133,9 @@ scoped_ptr<TileManager> TileManager::Create(
ImageRasterWorkerPool::Create(
resource_provider, num_raster_threads) :
PixelBufferRasterWorkerPool::Create(
- resource_provider, num_raster_threads),
+ resource_provider,
+ num_raster_threads,
+ GetMaxBytesPendingUpload(context_provider)),
num_raster_threads,
rendering_stats_instrumentation));
}
@@ -854,4 +857,24 @@ void TileManager::OnRasterTaskCompleted(
did_initialize_visible_tile_ = true;
}
+// static
+size_t TileManager::GetMaxBytesPendingUpload(
danakj 2013/09/03 17:18:57 this could be a file-static method in anonymous na
reveman 2013/09/03 18:02:03 Can we move this logic to the OutputSurface? And c
danakj 2013/09/03 18:06:04 -1 to putting more code in output surface. that sh
reveman 2013/09/03 18:37:24 I don't want the TileManager to be aware of if sof
danakj 2013/09/03 19:06:31 So, this limit is the max upload that the tile man
kaanb 2013/09/03 20:43:11 Moved to the anonymous namespace in LTHI
+ ContextProvider* context_provider) {
+ if (context_provider != NULL) {
+ // For reference Chromebook Pixel can upload 1MB in about 0.5ms.
+ const size_t kMaxBytesUploadedPerMs = 1024 * 1024 * 2;
+ // Assuming a two frame deep pipeline between CPU and GPU and we are
+ // drawing 60 frames per second which would require us to draw one
+ // frame in 16 milliseconds.
+ const size_t kMaxBytesPendingUpload = 16 * 2 * kMaxBytesUploadedPerMs;
+ return std::min(
+ context_provider->ContextCapabilities().max_transfer_buffer_usage_bytes,
+ kMaxBytesPendingUpload);
+ } else {
+ // Software compositing should not use this path in production. Just use a
+ // default value when testing this path with software compositor.
+ return std::numeric_limits<size_t>::max();
+ }
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698