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

Side by Side Diff: cc/raster/gpu_tile_task_worker_pool.cc

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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/output/output_surface.cc ('k') | cc/raster/one_copy_tile_task_worker_pool.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/raster/gpu_tile_task_worker_pool.h" 5 #include "cc/raster/gpu_tile_task_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/playback/raster_source.h" 10 #include "cc/playback/raster_source.h"
(...skipping 28 matching lines...) Expand all
39 const gfx::Rect& raster_dirty_rect, 39 const gfx::Rect& raster_dirty_rect,
40 uint64_t new_content_id, 40 uint64_t new_content_id,
41 float scale, 41 float scale,
42 bool include_images) override { 42 bool include_images) override {
43 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); 43 TRACE_EVENT0("cc", "RasterBufferImpl::Playback");
44 // GPU raster doesn't do low res tiles, so should always include images. 44 // GPU raster doesn't do low res tiles, so should always include images.
45 DCHECK(include_images); 45 DCHECK(include_images);
46 ContextProvider* context_provider = rasterizer_->resource_provider() 46 ContextProvider* context_provider = rasterizer_->resource_provider()
47 ->output_surface() 47 ->output_surface()
48 ->worker_context_provider(); 48 ->worker_context_provider();
49 DCHECK(context_provider);
49 50
50 // The context lock must be held while accessing the context on a 51 ContextProvider::ScopedContextLock scoped_context(context_provider);
51 // worker thread.
52 base::AutoLock context_lock(*context_provider->GetLock());
53
54 // Allow this worker thread to bind to context_provider.
55 context_provider->DetachFromThread();
56 52
57 gfx::Rect playback_rect = raster_full_rect; 53 gfx::Rect playback_rect = raster_full_rect;
58 if (resource_has_previous_content_) { 54 if (resource_has_previous_content_) {
59 playback_rect.Intersect(raster_dirty_rect); 55 playback_rect.Intersect(raster_dirty_rect);
60 } 56 }
61 DCHECK(!playback_rect.IsEmpty()) 57 DCHECK(!playback_rect.IsEmpty())
62 << "Why are we rastering a tile that's not dirty?"; 58 << "Why are we rastering a tile that's not dirty?";
63 59
64 // TODO(danakj): Implement partial raster with raster_dirty_rect. 60 // TODO(danakj): Implement partial raster with raster_dirty_rect.
65 // Rasterize source into resource. 61 // Rasterize source into resource.
66 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect, 62 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect,
67 playback_rect, scale); 63 playback_rect, scale);
68 64
69 // Barrier to sync worker context output to cc context. 65 // Barrier to sync worker context output to cc context.
70 context_provider->ContextGL()->OrderingBarrierCHROMIUM(); 66 scoped_context.ContextGL()->OrderingBarrierCHROMIUM();
71
72 // Allow compositor thread to bind to context_provider.
73 context_provider->DetachFromThread();
74 } 67 }
75 68
76 private: 69 private:
77 GpuRasterizer* rasterizer_; 70 GpuRasterizer* rasterizer_;
78 ResourceProvider::ScopedWriteLockGr lock_; 71 ResourceProvider::ScopedWriteLockGr lock_;
79 bool resource_has_previous_content_; 72 bool resource_has_previous_content_;
80 73
81 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); 74 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl);
82 }; 75 };
83 76
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void GpuTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { 239 void GpuTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) {
247 TRACE_EVENT1("cc", "GpuTileTaskWorkerPool::OnTaskSetFinished", "task_set", 240 TRACE_EVENT1("cc", "GpuTileTaskWorkerPool::OnTaskSetFinished", "task_set",
248 task_set); 241 task_set);
249 242
250 DCHECK(tasks_pending_[task_set]); 243 DCHECK(tasks_pending_[task_set]);
251 tasks_pending_[task_set] = false; 244 tasks_pending_[task_set] = false;
252 client_->DidFinishRunningTileTasks(task_set); 245 client_->DidFinishRunningTileTasks(task_set);
253 } 246 }
254 247
255 } // namespace cc 248 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface.cc ('k') | cc/raster/one_copy_tile_task_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698