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

Side by Side Diff: cc/tiles/tile_manager.h

Issue 2555743004: Delay activation/draw on GPU tile work completion (Closed)
Patch Set: rebase Created 3 years, 11 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
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 #ifndef CC_TILES_TILE_MANAGER_H_ 5 #ifndef CC_TILES_TILE_MANAGER_H_
6 #define CC_TILES_TILE_MANAGER_H_ 6 #define CC_TILES_TILE_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 BasicStateAsValue() const; 142 BasicStateAsValue() const;
143 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; 143 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const;
144 const MemoryHistory::Entry& memory_stats_from_last_assign() const { 144 const MemoryHistory::Entry& memory_stats_from_last_assign() const {
145 return memory_stats_from_last_assign_; 145 return memory_stats_from_last_assign_;
146 } 146 }
147 147
148 // Public methods for testing. 148 // Public methods for testing.
149 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { 149 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) {
150 for (size_t i = 0; i < tiles.size(); ++i) { 150 for (size_t i = 0; i < tiles.size(); ++i) {
151 TileDrawInfo& draw_info = tiles[i]->draw_info(); 151 TileDrawInfo& draw_info = tiles[i]->draw_info();
152 draw_info.resource_ = resource_pool_->AcquireResource( 152 draw_info.set_resource(resource_pool_->AcquireResource(
153 tiles[i]->desired_texture_size(), 153 tiles[i]->desired_texture_size(),
154 raster_buffer_provider_->GetResourceFormat(false), 154 raster_buffer_provider_->GetResourceFormat(false),
155 client_->GetTileColorSpace()); 155 client_->GetTileColorSpace()));
156 draw_info.set_resource_ready_for_draw();
156 } 157 }
157 } 158 }
158 159
159 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { 160 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) {
160 for (size_t i = 0; i < tiles.size(); ++i) { 161 for (size_t i = 0; i < tiles.size(); ++i) {
161 Tile* tile = tiles[i]; 162 Tile* tile = tiles[i];
162 FreeResourcesForTile(tile); 163 FreeResourcesForTile(tile);
163 } 164 }
164 } 165 }
165 166
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 scoped_refptr<TileTask> CreateTaskSetFinishedTask( 298 scoped_refptr<TileTask> CreateTaskSetFinishedTask(
298 void (TileManager::*callback)()); 299 void (TileManager::*callback)());
299 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); 300 PrioritizedWorkToSchedule AssignGpuMemoryToTiles();
300 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); 301 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule);
301 302
302 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> 303 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
303 ScheduledTasksStateAsValue() const; 304 ScheduledTasksStateAsValue() const;
304 305
305 bool UsePartialRaster() const; 306 bool UsePartialRaster() const;
306 307
308 void CheckPendingReadyToDrawTiles(bool issue_signals);
309
307 TileManagerClient* client_; 310 TileManagerClient* client_;
308 base::SequencedTaskRunner* task_runner_; 311 base::SequencedTaskRunner* task_runner_;
309 ResourcePool* resource_pool_; 312 ResourcePool* resource_pool_;
310 std::unique_ptr<TileTaskManager> tile_task_manager_; 313 std::unique_ptr<TileTaskManager> tile_task_manager_;
311 RasterBufferProvider* raster_buffer_provider_; 314 RasterBufferProvider* raster_buffer_provider_;
312 GlobalStateThatImpactsTilePriority global_state_; 315 GlobalStateThatImpactsTilePriority global_state_;
313 size_t scheduled_raster_task_limit_; 316 size_t scheduled_raster_task_limit_;
314 const bool use_partial_raster_; 317 const bool use_partial_raster_;
315 bool use_gpu_rasterization_; 318 bool use_gpu_rasterization_;
316 319
(...skipping 17 matching lines...) Expand all
334 337
335 Signals signals_; 338 Signals signals_;
336 339
337 UniqueNotifier signals_check_notifier_; 340 UniqueNotifier signals_check_notifier_;
338 341
339 bool has_scheduled_tile_tasks_; 342 bool has_scheduled_tile_tasks_;
340 343
341 uint64_t prepare_tiles_count_; 344 uint64_t prepare_tiles_count_;
342 uint64_t next_tile_id_; 345 uint64_t next_tile_id_;
343 346
347 std::unordered_set<Tile*> pending_ready_for_draw_tiles_;
vmpstr 2017/01/05 22:00:46 Is this pending ready _to_ draw tiles? Maybe some
ericrk 2017/01/09 23:05:22 Yeah, I like pending_gpu_work_tiles_
348 uint64_t pending_required_for_activation_callback_id_ = 0;
349 uint64_t pending_required_for_draw_callback_id_ = 0;
350 // If true, we should re-compute tile requirements in
351 // CheckPendingReadyToDrawTiles.
352 bool pending_tile_requirements_dirty_ = false;
353
344 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_; 354 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_;
345 std::vector<scoped_refptr<TileTask>> locked_image_tasks_; 355 std::vector<scoped_refptr<TileTask>> locked_image_tasks_;
346 const bool check_tile_priority_inversion_; 356 const bool check_tile_priority_inversion_;
347 357
358 // We need two WeakPtrFactory objects as the invalidation pattern of each is
359 // different. The |task_set_finished_weak_ptr_factory_| is invalidated any
360 // time new tasks are scheduled, preventing a race when the callback has
361 // been scheduled but not yet executed.
348 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; 362 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_;
363 // The |ready_to_draw_callback_weak_ptr_factory_| is never invalidated.
364 base::WeakPtrFactory<TileManager> ready_to_draw_callback_weak_ptr_factory_;
349 365
350 DISALLOW_COPY_AND_ASSIGN(TileManager); 366 DISALLOW_COPY_AND_ASSIGN(TileManager);
351 }; 367 };
352 368
353 } // namespace cc 369 } // namespace cc
354 370
355 #endif // CC_TILES_TILE_MANAGER_H_ 371 #endif // CC_TILES_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698