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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 522023002: cc: Decrease transfer buffer memory limit to a single frame of uploads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index e293a5aa9ad34723305fe31def6293258d0cad95..377e05cf61b155b3e2e1ec036a64cc3527e23f5a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -89,7 +89,8 @@ void DidVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) {
TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::SetVisible", id);
}
-size_t GetMaxTransferBufferUsageBytes(cc::ContextProvider* context_provider) {
+size_t GetMaxTransferBufferUsageBytes(cc::ContextProvider* context_provider,
+ double refresh_rate) {
// Software compositing should not use this value in production. Just use a
// default value when testing uploads with the software compositor.
if (!context_provider)
@@ -100,13 +101,17 @@ size_t GetMaxTransferBufferUsageBytes(cc::ContextProvider* context_provider) {
// the pipeline.
// 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 kMaxTransferBufferUsageBytes = 16 * 2 * kMaxBytesUploadedPerMs;
+
+ // This is the number of bytes the compositor would be able to upload before
+ // the next frame deadline.
reveman 2014/08/30 00:38:39 maybe worth mentioning that this assumes no more t
danakj 2014/08/30 00:51:38 I added something, let me know if you think it's a
+ const size_t ms_per_frame = std::floor(1000.0 / refresh_rate);
+ const size_t max_transfer_buffer_usage_bytes =
+ ms_per_frame * kMaxBytesUploadedPerMs;
reveman 2014/08/30 00:38:39 nit: up to you but I'd get rid of the 'const' modi
danakj 2014/08/30 00:42:32 Done.
+
+ // The context may request a higher limit based on the device capabilities.
reveman 2014/08/30 00:38:39 nit: lower limit based on the device capabilities.
danakj 2014/08/30 00:42:32 I would have to change std::min to std::max then.
danakj 2014/08/30 00:44:28 Oh, no I agree with you. Fridays~
return std::min(
context_provider->ContextCapabilities().max_transfer_buffer_usage_bytes,
- kMaxTransferBufferUsageBytes);
+ max_transfer_buffer_usage_bytes);
}
unsigned GetMapImageTextureTarget(cc::ContextProvider* context_provider) {
@@ -1939,7 +1944,7 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
ContextProvider* context_provider = output_surface_->context_provider();
transfer_buffer_memory_limit_ =
- GetMaxTransferBufferUsageBytes(context_provider);
+ GetMaxTransferBufferUsageBytes(context_provider, settings_.refresh_rate);
if (use_gpu_rasterization_ && context_provider) {
resource_pool_ =
@@ -2066,9 +2071,6 @@ bool LayerTreeHostImpl::InitializeRenderer(
CreateAndSetRenderer();
- transfer_buffer_memory_limit_ =
danakj 2014/08/30 00:29:00 this is also set in CreateAndSetTileManager() whic
- GetMaxTransferBufferUsageBytes(output_surface_->context_provider());
-
if (settings_.impl_side_painting)
CreateAndSetTileManager();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698