OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 state->SetInteger("canceled_count", stats.canceled_count); | 117 state->SetInteger("canceled_count", stats.canceled_count); |
118 return state.PassAs<base::Value>(); | 118 return state.PassAs<base::Value>(); |
119 } | 119 } |
120 | 120 |
121 // static | 121 // static |
122 scoped_ptr<TileManager> TileManager::Create( | 122 scoped_ptr<TileManager> TileManager::Create( |
123 TileManagerClient* client, | 123 TileManagerClient* client, |
124 ResourceProvider* resource_provider, | 124 ResourceProvider* resource_provider, |
125 size_t num_raster_threads, | 125 size_t num_raster_threads, |
126 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 126 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
127 bool use_map_image) { | 127 bool use_map_image, |
128 ContextProvider* context_provider) { | |
128 return make_scoped_ptr( | 129 return make_scoped_ptr( |
129 new TileManager(client, | 130 new TileManager(client, |
130 resource_provider, | 131 resource_provider, |
131 use_map_image ? | 132 use_map_image ? |
132 ImageRasterWorkerPool::Create( | 133 ImageRasterWorkerPool::Create( |
133 resource_provider, num_raster_threads) : | 134 resource_provider, num_raster_threads) : |
134 PixelBufferRasterWorkerPool::Create( | 135 PixelBufferRasterWorkerPool::Create( |
135 resource_provider, num_raster_threads), | 136 resource_provider, |
137 num_raster_threads, | |
138 GetMaxBytesPendingUpload(context_provider)), | |
136 num_raster_threads, | 139 num_raster_threads, |
137 rendering_stats_instrumentation)); | 140 rendering_stats_instrumentation)); |
138 } | 141 } |
139 | 142 |
140 TileManager::TileManager( | 143 TileManager::TileManager( |
141 TileManagerClient* client, | 144 TileManagerClient* client, |
142 ResourceProvider* resource_provider, | 145 ResourceProvider* resource_provider, |
143 scoped_ptr<RasterWorkerPool> raster_worker_pool, | 146 scoped_ptr<RasterWorkerPool> raster_worker_pool, |
144 size_t num_raster_threads, | 147 size_t num_raster_threads, |
145 RenderingStatsInstrumentation* rendering_stats_instrumentation) | 148 RenderingStatsInstrumentation* rendering_stats_instrumentation) |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 | 850 |
848 bytes_releasable_ += tile->bytes_consumed_if_allocated(); | 851 bytes_releasable_ += tile->bytes_consumed_if_allocated(); |
849 ++resources_releasable_; | 852 ++resources_releasable_; |
850 } | 853 } |
851 | 854 |
852 FreeUnusedResourcesForTile(tile); | 855 FreeUnusedResourcesForTile(tile); |
853 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) | 856 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) |
854 did_initialize_visible_tile_ = true; | 857 did_initialize_visible_tile_ = true; |
855 } | 858 } |
856 | 859 |
860 // static | |
861 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
| |
862 ContextProvider* context_provider) { | |
863 if (context_provider != NULL) { | |
864 // For reference Chromebook Pixel can upload 1MB in about 0.5ms. | |
865 const size_t kMaxBytesUploadedPerMs = 1024 * 1024 * 2; | |
866 // Assuming a two frame deep pipeline between CPU and GPU and we are | |
867 // drawing 60 frames per second which would require us to draw one | |
868 // frame in 16 milliseconds. | |
869 const size_t kMaxBytesPendingUpload = 16 * 2 * kMaxBytesUploadedPerMs; | |
870 return std::min( | |
871 context_provider->ContextCapabilities().max_transfer_buffer_usage_bytes, | |
872 kMaxBytesPendingUpload); | |
873 } else { | |
874 // Software compositing should not use this path in production. Just use a | |
875 // default value when testing this path with software compositor. | |
876 return std::numeric_limits<size_t>::max(); | |
877 } | |
878 } | |
879 | |
857 } // namespace cc | 880 } // namespace cc |
OLD | NEW |