diff options
author | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 20:56:09 +0000 |
---|---|---|
committer | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 20:56:09 +0000 |
commit | f845661e6d0c182f4161fca669cf70364f9a9ebe (patch) | |
tree | 232ce014743634f05d7a6889c393afd8ecdd0b50 /cc/resources | |
parent | e2cdbb87ea16864fec2814f6562d3ec64fa4a9a4 (diff) | |
download | chromium_src-f845661e6d0c182f4161fca669cf70364f9a9ebe.zip chromium_src-f845661e6d0c182f4161fca669cf70364f9a9ebe.tar.gz chromium_src-f845661e6d0c182f4161fca669cf70364f9a9ebe.tar.bz2 |
cc: Schedule cheap raster tasks based on anticipated draw time
BUG=181586
Review URL: https://chromiumcodereview.appspot.com/12623015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources')
-rw-r--r-- | cc/resources/tile_manager.cc | 42 | ||||
-rw-r--r-- | cc/resources/tile_manager.h | 7 |
2 files changed, 23 insertions, 26 deletions
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index 153a240..61e112b 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -164,8 +164,6 @@ TileManager::TileManager( record_rendering_stats_(false), use_cheapness_estimator_(use_cheapness_estimator), use_color_estimator_(use_color_estimator), - did_schedule_cheap_tasks_(false), - allow_cheap_tasks_(true), prediction_benchmarking_(prediction_benchmarking), pending_tasks_(0), max_pending_tasks_(kMaxNumPendingTasksPerThread * num_raster_threads) { @@ -196,6 +194,7 @@ void TileManager::SetGlobalState( global_state_ = global_state; resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); ScheduleManageTiles(); + UpdateCheapTasksTimeLimit(); } void TileManager::RegisterTile(Tile* tile) { @@ -427,11 +426,6 @@ void TileManager::AbortPendingTileUploads() { } } -void TileManager::DidCompleteFrame() { - allow_cheap_tasks_ = true; - did_schedule_cheap_tasks_ = false; -} - void TileManager::ForceTileUploadToComplete(Tile* tile) { ManagedTileState& managed_tile_state = tile->managed_state(); if (managed_tile_state.raster_state == UPLOAD_STATE) { @@ -665,9 +659,6 @@ bool TileManager::CanDispatchRasterTask(Tile* tile) const { } void TileManager::DispatchMoreTasks() { - if (did_schedule_cheap_tasks_) - allow_cheap_tasks_ = false; - // Because tiles in the image decoding list have higher priorities, we // need to process those tiles first before we start to handle the tiles // in the need_to_be_rasterized queue. Note that solid/transparent tiles @@ -839,6 +830,23 @@ scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster( return resource.Pass(); } +void TileManager::SetAnticipatedDrawTime(base::TimeTicks time) { + anticipated_draw_time_ = time; + UpdateCheapTasksTimeLimit(); +} + +void TileManager::UpdateCheapTasksTimeLimit() { + base::TimeTicks limit; + if (use_cheapness_estimator_ && + global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY) { + limit = std::min( + base::TimeTicks::Now() + + base::TimeDelta::FromMilliseconds(kRunCheapTasksTimeMs), + anticipated_draw_time_); + } + raster_worker_pool_->SetRunCheapTasksTimeLimit(limit); +} + void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); @@ -847,15 +855,9 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { resource_pool_->resource_provider()->MapPixelBuffer(resource_id); ManagedTileState& managed_tile_state = tile->managed_state(); - // TODO(skyostil): Post all cheap tasks as cheap and instead use the time - // limit to control their execution. - bool is_cheap_task = - allow_cheap_tasks_ && - global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY && - managed_tile_state.picture_pile_analysis.is_cheap_to_raster; raster_worker_pool_->PostRasterTaskAndReply( tile->picture_pile(), - is_cheap_task, + managed_tile_state.picture_pile_analysis.is_cheap_to_raster, base::Bind(&TileManager::RunRasterTask, buffer, tile->content_rect(), @@ -866,12 +868,6 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { tile, base::Passed(&resource), manage_tiles_call_count_)); - if (is_cheap_task && !did_schedule_cheap_tasks_) { - raster_worker_pool_->SetRunCheapTasksTimeLimit( - base::TimeTicks::Now() + - base::TimeDelta::FromMilliseconds(kRunCheapTasksTimeMs)); - did_schedule_cheap_tasks_ = true; - } pending_tasks_++; } diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index 90ac666..85cb7c1 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -90,7 +90,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient { void CheckForCompletedTileUploads(); void AbortPendingTileUploads(); void ForceTileUploadToComplete(Tile* tile); - void DidCompleteFrame(); + void SetAnticipatedDrawTime(base::TimeTicks time); scoped_ptr<base::Value> BasicStateAsValue() const; scoped_ptr<base::Value> AllTilesAsValue() const; @@ -141,6 +141,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient { client_->ScheduleManageTiles(); manage_tiles_pending_ = true; } + void UpdateCheapTasksTimeLimit(); void DispatchMoreTasks(); void AnalyzeTile(Tile* tile); void GatherPixelRefsForTile(Tile* tile); @@ -215,14 +216,14 @@ class CC_EXPORT TileManager : public WorkerPoolClient { bool use_cheapness_estimator_; bool use_color_estimator_; - bool did_schedule_cheap_tasks_; - bool allow_cheap_tasks_; int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; bool prediction_benchmarking_; size_t pending_tasks_; size_t max_pending_tasks_; + base::TimeTicks anticipated_draw_time_; + DISALLOW_COPY_AND_ASSIGN(TileManager); }; |