Chromium Code Reviews| 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 870b65d89ba7b123085028c34359d4afbf122131..0015537d44c905cd05b11d6126cfeb923675d2c2 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -5,6 +5,7 @@ |
| #include "cc/trees/layer_tree_host_impl.h" |
| #include <algorithm> |
| +#include <limits> |
| #include "base/basictypes.h" |
| #include "base/containers/hash_tables.h" |
| @@ -69,6 +70,24 @@ void DidVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) { |
| TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::SetVisible", id); |
| } |
| +size_t GetMaxBytesPendingUpload(cc::ContextProvider* context_provider) { |
|
reveman
2013/09/05 17:52:10
GetMaxTransferBufferUsageBytes instead please and
|
| + if (context_provider != NULL) { |
|
reveman
2013/09/03 22:01:50
is this really the correct way to determine the li
danakj
2013/09/03 22:19:25
AIUI This limit is how much the compositor should
reveman
2013/09/04 23:22:15
we should always be using std::numeric_limits<size
danakj
2013/09/05 14:36:17
We don't recreate the TileManager when we draw a s
reveman
2013/09/05 15:32:14
Hm, we're still using the tile manager to initiali
danakj
2013/09/05 15:35:07
No, resourceless software mode means there are no
reveman
2013/09/05 17:52:10
Ok, got it.
nit: "if (context_provider)" instead
kaanb
2013/09/05 19:26:57
Done.
|
| + // For reference Chromebook Pixel can upload 1MB in about 0.5ms. |
| + const size_t kMaxBytesUploadedPerMs = 1024 * 1024 * 2; |
|
reveman
2013/09/03 22:01:50
nit: kMaxTransferBufferUsageBytes here and below
kaanb
2013/09/03 23:09:29
Done.
kaanb
2013/09/05 19:26:57
On 2013/09/03 23:09:29, kaanb wrote:
> On 2013/09/
|
| + // 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 |
|
danakj
2013/09/03 21:48:29
s/path/value/
kaanb
2013/09/03 23:09:29
Done.
|
| + // default value when testing this path with software compositor. |
|
danakj
2013/09/03 21:48:29
...when testing uploads with the software composit
kaanb
2013/09/03 23:09:29
Done.
|
| + return std::numeric_limits<size_t>::max(); |
| + } |
| +} |
| + |
| } // namespace |
| namespace cc { |
| @@ -1594,14 +1613,18 @@ void LayerTreeHostImpl::CreateAndSetRenderer( |
| void LayerTreeHostImpl::CreateAndSetTileManager( |
| ResourceProvider* resource_provider, |
| - bool using_map_image) { |
| + bool using_map_image, |
| + ContextProvider* context_provider) { |
| DCHECK(settings_.impl_side_painting); |
| DCHECK(resource_provider); |
| - tile_manager_ = TileManager::Create(this, |
| - resource_provider, |
| - settings_.num_raster_threads, |
| - rendering_stats_instrumentation_, |
| - using_map_image); |
| + tile_manager_ = |
| + TileManager::Create(this, |
| + resource_provider, |
| + settings_.num_raster_threads, |
| + rendering_stats_instrumentation_, |
| + using_map_image, |
| + GetMaxBytesPendingUpload(context_provider)); |
| + |
| UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
| need_to_update_visible_tiles_before_draw_ = false; |
| } |
| @@ -1645,7 +1668,8 @@ bool LayerTreeHostImpl::InitializeRenderer( |
| if (settings_.impl_side_painting) { |
| CreateAndSetTileManager(resource_provider.get(), |
| - GetRendererCapabilities().using_map_image); |
| + GetRendererCapabilities().using_map_image, |
| + output_surface->context_provider().get()); |
| } |
| // Setup BeginFrameEmulation if it's not supported natively |
| @@ -1757,7 +1781,9 @@ void LayerTreeHostImpl::ReleaseGL() { |
| EnforceZeroBudget(true); |
| CreateAndSetTileManager(resource_provider_.get(), |
| - GetRendererCapabilities().using_map_image); |
| + GetRendererCapabilities().using_map_image, |
| + NULL); |
| + |
| DCHECK(tile_manager_); |
| SetOffscreenContextProvider(NULL); |