| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 void RunRasterQueueConstructTest(const std::string& test_name, | 183 void RunRasterQueueConstructTest(const std::string& test_name, |
| 184 int layer_count) { | 184 int layer_count) { |
| 185 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 185 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 186 SMOOTHNESS_TAKES_PRIORITY, | 186 SMOOTHNESS_TAKES_PRIORITY, |
| 187 NEW_CONTENT_TAKES_PRIORITY}; | 187 NEW_CONTENT_TAKES_PRIORITY}; |
| 188 int priority_count = 0; | 188 int priority_count = 0; |
| 189 | 189 |
| 190 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); | 190 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); |
| 191 for (unsigned i = 0; i < layers.size(); ++i) | 191 bool resourceless_software_draw = false; |
| 192 layers[i]->UpdateTiles(Occlusion()); | 192 for (unsigned i = 0; i < layers.size(); ++i) { |
| 193 layers[i]->UpdateTiles(Occlusion(), resourceless_software_draw); |
| 194 } |
| 193 | 195 |
| 194 timer_.Reset(); | 196 timer_.Reset(); |
| 195 do { | 197 do { |
| 196 RasterTilePriorityQueue queue; | 198 RasterTilePriorityQueue queue; |
| 197 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); | 199 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); |
| 198 priority_count = (priority_count + 1) % arraysize(priorities); | 200 priority_count = (priority_count + 1) % arraysize(priorities); |
| 199 timer_.NextLap(); | 201 timer_.NextLap(); |
| 200 } while (!timer_.HasTimeLimitExpired()); | 202 } while (!timer_.HasTimeLimitExpired()); |
| 201 | 203 |
| 202 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 204 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
| 203 "", | 205 "", |
| 204 test_name, | 206 test_name, |
| 205 timer_.LapsPerSecond(), | 207 timer_.LapsPerSecond(), |
| 206 "runs/s", | 208 "runs/s", |
| 207 true); | 209 true); |
| 208 } | 210 } |
| 209 | 211 |
| 210 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 212 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
| 211 int layer_count, | 213 int layer_count, |
| 212 unsigned tile_count) { | 214 unsigned tile_count) { |
| 213 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 215 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 214 SMOOTHNESS_TAKES_PRIORITY, | 216 SMOOTHNESS_TAKES_PRIORITY, |
| 215 NEW_CONTENT_TAKES_PRIORITY}; | 217 NEW_CONTENT_TAKES_PRIORITY}; |
| 216 | 218 |
| 217 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 100); | 219 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 100); |
| 218 for (unsigned i = 0; i < layers.size(); ++i) | 220 bool resourceless_software_draw = false; |
| 219 layers[i]->UpdateTiles(Occlusion()); | 221 for (unsigned i = 0; i < layers.size(); ++i) { |
| 222 layers[i]->UpdateTiles(Occlusion(), resourceless_software_draw); |
| 223 } |
| 220 | 224 |
| 221 int priority_count = 0; | 225 int priority_count = 0; |
| 222 timer_.Reset(); | 226 timer_.Reset(); |
| 223 do { | 227 do { |
| 224 int count = tile_count; | 228 int count = tile_count; |
| 225 RasterTilePriorityQueue queue; | 229 RasterTilePriorityQueue queue; |
| 226 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); | 230 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); |
| 227 while (count--) { | 231 while (count--) { |
| 228 ASSERT_FALSE(queue.IsEmpty()); | 232 ASSERT_FALSE(queue.IsEmpty()); |
| 229 ASSERT_TRUE(queue.Top() != NULL); | 233 ASSERT_TRUE(queue.Top() != NULL); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 243 } | 247 } |
| 244 | 248 |
| 245 void RunEvictionQueueConstructTest(const std::string& test_name, | 249 void RunEvictionQueueConstructTest(const std::string& test_name, |
| 246 int layer_count) { | 250 int layer_count) { |
| 247 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 251 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 248 SMOOTHNESS_TAKES_PRIORITY, | 252 SMOOTHNESS_TAKES_PRIORITY, |
| 249 NEW_CONTENT_TAKES_PRIORITY}; | 253 NEW_CONTENT_TAKES_PRIORITY}; |
| 250 int priority_count = 0; | 254 int priority_count = 0; |
| 251 | 255 |
| 252 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); | 256 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); |
| 257 bool resourceless_software_draw = false; |
| 253 for (unsigned i = 0; i < layers.size(); ++i) { | 258 for (unsigned i = 0; i < layers.size(); ++i) { |
| 254 FakePictureLayerImpl* layer = | 259 FakePictureLayerImpl* layer = |
| 255 static_cast<FakePictureLayerImpl*>(layers[i]); | 260 static_cast<FakePictureLayerImpl*>(layers[i]); |
| 256 layer->UpdateTiles(Occlusion()); | 261 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
| 257 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { | 262 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { |
| 258 tile_manager()->InitializeTilesWithResourcesForTesting( | 263 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 259 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); | 264 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); |
| 260 } | 265 } |
| 261 } | 266 } |
| 262 | 267 |
| 263 timer_.Reset(); | 268 timer_.Reset(); |
| 264 do { | 269 do { |
| 265 EvictionTilePriorityQueue queue; | 270 EvictionTilePriorityQueue queue; |
| 266 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]); | 271 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 278 | 283 |
| 279 void RunEvictionQueueConstructAndIterateTest(const std::string& test_name, | 284 void RunEvictionQueueConstructAndIterateTest(const std::string& test_name, |
| 280 int layer_count, | 285 int layer_count, |
| 281 unsigned tile_count) { | 286 unsigned tile_count) { |
| 282 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 287 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 283 SMOOTHNESS_TAKES_PRIORITY, | 288 SMOOTHNESS_TAKES_PRIORITY, |
| 284 NEW_CONTENT_TAKES_PRIORITY}; | 289 NEW_CONTENT_TAKES_PRIORITY}; |
| 285 int priority_count = 0; | 290 int priority_count = 0; |
| 286 | 291 |
| 287 std::vector<LayerImpl*> layers = CreateLayers(layer_count, tile_count); | 292 std::vector<LayerImpl*> layers = CreateLayers(layer_count, tile_count); |
| 293 bool resourceless_software_draw = false; |
| 288 for (unsigned i = 0; i < layers.size(); ++i) { | 294 for (unsigned i = 0; i < layers.size(); ++i) { |
| 289 FakePictureLayerImpl* layer = | 295 FakePictureLayerImpl* layer = |
| 290 static_cast<FakePictureLayerImpl*>(layers[i]); | 296 static_cast<FakePictureLayerImpl*>(layers[i]); |
| 291 layer->UpdateTiles(Occlusion()); | 297 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
| 292 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { | 298 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { |
| 293 tile_manager()->InitializeTilesWithResourcesForTesting( | 299 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 294 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); | 300 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); |
| 295 } | 301 } |
| 296 } | 302 } |
| 297 | 303 |
| 298 timer_.Reset(); | 304 timer_.Reset(); |
| 299 do { | 305 do { |
| 300 int count = tile_count; | 306 int count = tile_count; |
| 301 EvictionTilePriorityQueue queue; | 307 EvictionTilePriorityQueue queue; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; | 393 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; |
| 388 return state; | 394 return state; |
| 389 } | 395 } |
| 390 | 396 |
| 391 void RunManageTilesTest(const std::string& test_name, | 397 void RunManageTilesTest(const std::string& test_name, |
| 392 int layer_count, | 398 int layer_count, |
| 393 int approximate_tile_count_per_layer) { | 399 int approximate_tile_count_per_layer) { |
| 394 std::vector<LayerImpl*> layers = | 400 std::vector<LayerImpl*> layers = |
| 395 CreateLayers(layer_count, approximate_tile_count_per_layer); | 401 CreateLayers(layer_count, approximate_tile_count_per_layer); |
| 396 timer_.Reset(); | 402 timer_.Reset(); |
| 403 bool resourceless_software_draw = false; |
| 397 do { | 404 do { |
| 398 BeginFrameArgs args = CreateBeginFrameArgsForTesting(); | 405 BeginFrameArgs args = CreateBeginFrameArgsForTesting(); |
| 399 host_impl_.UpdateCurrentBeginFrameArgs(args); | 406 host_impl_.UpdateCurrentBeginFrameArgs(args); |
| 400 for (unsigned i = 0; i < layers.size(); ++i) | 407 for (unsigned i = 0; i < layers.size(); ++i) { |
| 401 layers[i]->UpdateTiles(Occlusion()); | 408 layers[i]->UpdateTiles(Occlusion(), resourceless_software_draw); |
| 409 } |
| 402 | 410 |
| 403 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); | 411 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); |
| 404 tile_manager()->ManageTiles(global_state); | 412 tile_manager()->ManageTiles(global_state); |
| 405 tile_manager()->UpdateVisibleTiles(); | 413 tile_manager()->UpdateVisibleTiles(); |
| 406 timer_.NextLap(); | 414 timer_.NextLap(); |
| 407 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); | 415 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); |
| 408 } while (!timer_.HasTimeLimitExpired()); | 416 } while (!timer_.HasTimeLimitExpired()); |
| 409 | 417 |
| 410 perf_test::PrintResult( | 418 perf_test::PrintResult( |
| 411 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 419 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 487 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 480 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 488 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 481 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 489 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 482 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 490 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 483 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 491 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 484 } | 492 } |
| 485 | 493 |
| 486 } // namespace | 494 } // namespace |
| 487 | 495 |
| 488 } // namespace cc | 496 } // namespace cc |
| OLD | NEW |