| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/time/time.h" | 5 #include "base/time/time.h" |
| 6 #include "cc/debug/lap_timer.h" | 6 #include "cc/debug/lap_timer.h" |
| 7 #include "cc/resources/raster_buffer.h" | 7 #include "cc/resources/raster_buffer.h" |
| 8 #include "cc/resources/tile.h" | 8 #include "cc/resources/tile.h" |
| 9 #include "cc/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
| 10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 void RunRasterQueueConstructTest(const std::string& test_name, | 172 void RunRasterQueueConstructTest(const std::string& test_name, |
| 173 int layer_count) { | 173 int layer_count) { |
| 174 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 174 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 175 SMOOTHNESS_TAKES_PRIORITY, | 175 SMOOTHNESS_TAKES_PRIORITY, |
| 176 NEW_CONTENT_TAKES_PRIORITY}; | 176 NEW_CONTENT_TAKES_PRIORITY}; |
| 177 int priority_count = 0; | 177 int priority_count = 0; |
| 178 | 178 |
| 179 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 179 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
| 180 bool resourceless_software_draw = false; | 180 bool resourceless_software_draw = false; |
| 181 for (const auto& layer : layers) | 181 for (const auto& layer : layers) |
| 182 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 182 layer->UpdateTiles(resourceless_software_draw); |
| 183 | 183 |
| 184 timer_.Reset(); | 184 timer_.Reset(); |
| 185 do { | 185 do { |
| 186 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 186 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
| 187 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); | 187 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); |
| 188 priority_count = (priority_count + 1) % arraysize(priorities); | 188 priority_count = (priority_count + 1) % arraysize(priorities); |
| 189 timer_.NextLap(); | 189 timer_.NextLap(); |
| 190 } while (!timer_.HasTimeLimitExpired()); | 190 } while (!timer_.HasTimeLimitExpired()); |
| 191 | 191 |
| 192 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 192 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
| 193 "", | 193 "", |
| 194 test_name, | 194 test_name, |
| 195 timer_.LapsPerSecond(), | 195 timer_.LapsPerSecond(), |
| 196 "runs/s", | 196 "runs/s", |
| 197 true); | 197 true); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 200 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
| 201 int layer_count, | 201 int layer_count, |
| 202 int tile_count) { | 202 int tile_count) { |
| 203 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 203 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 204 SMOOTHNESS_TAKES_PRIORITY, | 204 SMOOTHNESS_TAKES_PRIORITY, |
| 205 NEW_CONTENT_TAKES_PRIORITY}; | 205 NEW_CONTENT_TAKES_PRIORITY}; |
| 206 | 206 |
| 207 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); | 207 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); |
| 208 bool resourceless_software_draw = false; | 208 bool resourceless_software_draw = false; |
| 209 for (const auto& layer : layers) | 209 for (const auto& layer : layers) |
| 210 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 210 layer->UpdateTiles(resourceless_software_draw); |
| 211 | 211 |
| 212 int priority_count = 0; | 212 int priority_count = 0; |
| 213 timer_.Reset(); | 213 timer_.Reset(); |
| 214 do { | 214 do { |
| 215 int count = tile_count; | 215 int count = tile_count; |
| 216 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 216 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
| 217 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); | 217 priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); |
| 218 while (count--) { | 218 while (count--) { |
| 219 ASSERT_FALSE(queue->IsEmpty()); | 219 ASSERT_FALSE(queue->IsEmpty()); |
| 220 ASSERT_TRUE(queue->Top() != NULL); | 220 ASSERT_TRUE(queue->Top() != NULL); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 236 void RunEvictionQueueConstructTest(const std::string& test_name, | 236 void RunEvictionQueueConstructTest(const std::string& test_name, |
| 237 int layer_count) { | 237 int layer_count) { |
| 238 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 238 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 239 SMOOTHNESS_TAKES_PRIORITY, | 239 SMOOTHNESS_TAKES_PRIORITY, |
| 240 NEW_CONTENT_TAKES_PRIORITY}; | 240 NEW_CONTENT_TAKES_PRIORITY}; |
| 241 int priority_count = 0; | 241 int priority_count = 0; |
| 242 | 242 |
| 243 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 243 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
| 244 bool resourceless_software_draw = false; | 244 bool resourceless_software_draw = false; |
| 245 for (const auto& layer : layers) { | 245 for (const auto& layer : layers) { |
| 246 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 246 layer->UpdateTiles(resourceless_software_draw); |
| 247 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 247 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
| 248 tile_manager()->InitializeTilesWithResourcesForTesting( | 248 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 249 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 249 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 timer_.Reset(); | 253 timer_.Reset(); |
| 254 do { | 254 do { |
| 255 scoped_ptr<EvictionTilePriorityQueue> queue( | 255 scoped_ptr<EvictionTilePriorityQueue> queue( |
| 256 host_impl_.BuildEvictionQueue(priorities[priority_count])); | 256 host_impl_.BuildEvictionQueue(priorities[priority_count])); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 271 int tile_count) { | 271 int tile_count) { |
| 272 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 272 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 273 SMOOTHNESS_TAKES_PRIORITY, | 273 SMOOTHNESS_TAKES_PRIORITY, |
| 274 NEW_CONTENT_TAKES_PRIORITY}; | 274 NEW_CONTENT_TAKES_PRIORITY}; |
| 275 int priority_count = 0; | 275 int priority_count = 0; |
| 276 | 276 |
| 277 std::vector<FakePictureLayerImpl*> layers = | 277 std::vector<FakePictureLayerImpl*> layers = |
| 278 CreateLayers(layer_count, tile_count); | 278 CreateLayers(layer_count, tile_count); |
| 279 bool resourceless_software_draw = false; | 279 bool resourceless_software_draw = false; |
| 280 for (const auto& layer : layers) { | 280 for (const auto& layer : layers) { |
| 281 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 281 layer->UpdateTiles(resourceless_software_draw); |
| 282 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 282 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
| 283 tile_manager()->InitializeTilesWithResourcesForTesting( | 283 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 284 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 284 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 timer_.Reset(); | 288 timer_.Reset(); |
| 289 do { | 289 do { |
| 290 int count = tile_count; | 290 int count = tile_count; |
| 291 scoped_ptr<EvictionTilePriorityQueue> queue( | 291 scoped_ptr<EvictionTilePriorityQueue> queue( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 int approximate_tile_count_per_layer) { | 380 int approximate_tile_count_per_layer) { |
| 381 std::vector<FakePictureLayerImpl*> layers = | 381 std::vector<FakePictureLayerImpl*> layers = |
| 382 CreateLayers(layer_count, approximate_tile_count_per_layer); | 382 CreateLayers(layer_count, approximate_tile_count_per_layer); |
| 383 timer_.Reset(); | 383 timer_.Reset(); |
| 384 bool resourceless_software_draw = false; | 384 bool resourceless_software_draw = false; |
| 385 do { | 385 do { |
| 386 BeginFrameArgs args = | 386 BeginFrameArgs args = |
| 387 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); | 387 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); |
| 388 host_impl_.UpdateCurrentBeginFrameArgs(args); | 388 host_impl_.UpdateCurrentBeginFrameArgs(args); |
| 389 for (const auto& layer : layers) | 389 for (const auto& layer : layers) |
| 390 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 390 layer->UpdateTiles(resourceless_software_draw); |
| 391 | 391 |
| 392 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); | 392 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); |
| 393 tile_manager()->PrepareTiles(global_state); | 393 tile_manager()->PrepareTiles(global_state); |
| 394 tile_manager()->UpdateVisibleTiles(global_state); | 394 tile_manager()->UpdateVisibleTiles(global_state); |
| 395 timer_.NextLap(); | 395 timer_.NextLap(); |
| 396 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); | 396 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); |
| 397 } while (!timer_.HasTimeLimitExpired()); | 397 } while (!timer_.HasTimeLimitExpired()); |
| 398 | 398 |
| 399 perf_test::PrintResult("prepare_tiles", "", test_name, | 399 perf_test::PrintResult("prepare_tiles", "", test_name, |
| 400 timer_.LapsPerSecond(), "runs/s", true); | 400 timer_.LapsPerSecond(), "runs/s", true); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 470 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
| 471 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 471 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 472 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 472 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 473 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 473 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 474 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 474 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 475 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 475 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace | 478 } // namespace |
| 479 } // namespace cc | 479 } // namespace cc |
| OLD | NEW |