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

Side by Side Diff: cc/resources/tile_manager.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « cc/resources/tile_draw_info.cc ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 base::Bind(&TileManager::UpdateTileDrawInfo, base::Unretained(this))); 432 base::Bind(&TileManager::UpdateTileDrawInfo, base::Unretained(this)));
433 433
434 // Use on-demand raster for any required-for-draw tiles that have not been 434 // Use on-demand raster for any required-for-draw tiles that have not been
435 // assigned memory after reaching a steady memory state. 435 // assigned memory after reaching a steady memory state.
436 // TODO(hendrikw): Figure out why this would improve jank on some tests - See 436 // TODO(hendrikw): Figure out why this would improve jank on some tests - See
437 // crbug.com/449288 437 // crbug.com/449288
438 required_for_draw_queue = client_->BuildRasterQueue( 438 required_for_draw_queue = client_->BuildRasterQueue(
439 global_state_.tree_priority, 439 global_state_.tree_priority,
440 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); 440 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW);
441 441
442 // Change to OOM mode for any tiles that have not been been assigned memory. 442 // Use on-demand raster for any tiles that have not been been assigned
443 // This ensures that we draw even when OOM. 443 // memory. This ensures that we draw even when OOM.
444 for (; !required_for_draw_queue->IsEmpty(); required_for_draw_queue->Pop()) { 444 for (; !required_for_draw_queue->IsEmpty(); required_for_draw_queue->Pop()) {
445 Tile* tile = required_for_draw_queue->Top(); 445 Tile* tile = required_for_draw_queue->Top();
446 tile->draw_info().set_oom(); 446 tile->draw_info().set_rasterize_on_demand();
447 client_->NotifyTileStateChanged(tile); 447 client_->NotifyTileStateChanged(tile);
448 } 448 }
449 449
450 TRACE_EVENT_INSTANT1("cc", "DidRasterize", TRACE_EVENT_SCOPE_THREAD, "state", 450 TRACE_EVENT_INSTANT1("cc", "DidRasterize", TRACE_EVENT_SCOPE_THREAD, "state",
451 BasicStateAsValue()); 451 BasicStateAsValue());
452 452
453 TRACE_COUNTER_ID1("cc", "unused_memory_bytes", this, 453 TRACE_COUNTER_ID1("cc", "unused_memory_bytes", this,
454 resource_pool_->total_memory_usage_bytes() - 454 resource_pool_->total_memory_usage_bytes() -
455 resource_pool_->acquired_memory_usage_bytes()); 455 resource_pool_->acquired_memory_usage_bytes());
456 } 456 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // We won't be able to schedule this tile, so break out early. 597 // We won't be able to schedule this tile, so break out early.
598 if (tiles_that_need_to_be_rasterized->size() >= 598 if (tiles_that_need_to_be_rasterized->size() >=
599 scheduled_raster_task_limit) { 599 scheduled_raster_task_limit) {
600 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; 600 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false;
601 break; 601 break;
602 } 602 }
603 603
604 TileDrawInfo& draw_info = tile->draw_info(); 604 TileDrawInfo& draw_info = tile->draw_info();
605 tile->scheduled_priority_ = schedule_priority++; 605 tile->scheduled_priority_ = schedule_priority++;
606 606
607 DCHECK_IMPLIES(draw_info.mode() != TileDrawInfo::OOM_MODE, 607 DCHECK(draw_info.mode() == TileDrawInfo::PICTURE_PILE_MODE ||
608 !draw_info.IsReadyToDraw()); 608 !draw_info.IsReadyToDraw());
609 609
610 // If the tile already has a raster_task, then the memory used by it is 610 // If the tile already has a raster_task, then the memory used by it is
611 // already accounted for in memory_usage. Otherwise, we'll have to acquire 611 // already accounted for in memory_usage. Otherwise, we'll have to acquire
612 // more memory to create a raster task. 612 // more memory to create a raster task.
613 MemoryUsage memory_required_by_tile_to_be_scheduled; 613 MemoryUsage memory_required_by_tile_to_be_scheduled;
614 if (!tile->raster_task_.get()) { 614 if (!tile->raster_task_.get()) {
615 memory_required_by_tile_to_be_scheduled = MemoryUsage::FromConfig( 615 memory_required_by_tile_to_be_scheduled = MemoryUsage::FromConfig(
616 tile->desired_texture_size(), tile_task_runner_->GetResourceFormat()); 616 tile->desired_texture_size(), tile_task_runner_->GetResourceFormat());
617 } 617 }
618 618
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 FreeResourcesForReleasedTiles(); 966 FreeResourcesForReleasedTiles();
967 967
968 resource_pool_->ReduceResourceUsage(); 968 resource_pool_->ReduceResourceUsage();
969 969
970 // We don't reserve memory for required-for-activation tiles during 970 // We don't reserve memory for required-for-activation tiles during
971 // accelerated gestures, so we just postpone activation when we don't 971 // accelerated gestures, so we just postpone activation when we don't
972 // have these tiles, and activate after the accelerated gesture. 972 // have these tiles, and activate after the accelerated gesture.
973 // Likewise if we don't allow any tiles (as is the case when we're 973 // Likewise if we don't allow any tiles (as is the case when we're
974 // invisible), if we have tiles that aren't ready, then we shouldn't 974 // invisible), if we have tiles that aren't ready, then we shouldn't
975 // activate as activation can cause checkerboards. 975 // activate as activation can cause checkerboards.
976 bool wait_for_all_required_tiles = 976 bool allow_rasterize_on_demand =
977 global_state_.tree_priority == SMOOTHNESS_TAKES_PRIORITY || 977 global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY &&
978 global_state_.memory_limit_policy == ALLOW_NOTHING; 978 global_state_.memory_limit_policy != ALLOW_NOTHING;
979 979
980 // Mark any required-for-activation tiles that have not been been assigned 980 // Use on-demand raster for any required-for-activation tiles that have
981 // memory after reaching a steady memory state as OOM. This ensures that we 981 // not been been assigned memory after reaching a steady memory state. This
982 // activate even when OOM. Note that we can't reuse the queue we used for 982 // ensures that we activate even when OOM. Note that we can't reuse the queue
983 // AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call could have 983 // we used for AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call
984 // evicted some tiles that would not be picked up by the old raster queue. 984 // could have evicted some tiles that would not be picked up by the old raster
985 // queue.
985 scoped_ptr<RasterTilePriorityQueue> required_for_activation_queue( 986 scoped_ptr<RasterTilePriorityQueue> required_for_activation_queue(
986 client_->BuildRasterQueue( 987 client_->BuildRasterQueue(
987 global_state_.tree_priority, 988 global_state_.tree_priority,
988 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); 989 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION));
989 990
990 // If we have tiles left to raster for activation, and we don't allow 991 // If we have tiles to mark as rasterize on demand, but we don't allow
991 // activating without them, then skip activation and return early. 992 // rasterize on demand, then skip activation and return early.
992 if (!required_for_activation_queue->IsEmpty() && wait_for_all_required_tiles) 993 if (!required_for_activation_queue->IsEmpty() && !allow_rasterize_on_demand)
993 return; 994 return;
994 995
995 // Mark required tiles as OOM so that we can activate without them. 996 // Mark required tiles as rasterize on demand.
996 for (; !required_for_activation_queue->IsEmpty(); 997 for (; !required_for_activation_queue->IsEmpty();
997 required_for_activation_queue->Pop()) { 998 required_for_activation_queue->Pop()) {
998 Tile* tile = required_for_activation_queue->Top(); 999 Tile* tile = required_for_activation_queue->Top();
999 tile->draw_info().set_oom(); 1000 tile->draw_info().set_rasterize_on_demand();
1000 client_->NotifyTileStateChanged(tile); 1001 client_->NotifyTileStateChanged(tile);
1001 } 1002 }
1002 1003
1003 DCHECK(IsReadyToActivate()); 1004 DCHECK(IsReadyToActivate());
1004 ready_to_activate_check_notifier_.Schedule(); 1005 ready_to_activate_check_notifier_.Schedule();
1005 } 1006 }
1006 1007
1007 TileManager::MemoryUsage::MemoryUsage() : memory_bytes_(0), resource_count_(0) { 1008 TileManager::MemoryUsage::MemoryUsage() : memory_bytes_(0), resource_count_(0) {
1008 } 1009 }
1009 1010
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 result -= other; 1049 result -= other;
1049 return result; 1050 return result;
1050 } 1051 }
1051 1052
1052 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 1053 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
1053 return memory_bytes_ > limit.memory_bytes_ || 1054 return memory_bytes_ > limit.memory_bytes_ ||
1054 resource_count_ > limit.resource_count_; 1055 resource_count_ > limit.resource_count_;
1055 } 1056 }
1056 1057
1057 } // namespace cc 1058 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_draw_info.cc ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698