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

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

Issue 1273163004: Revert of cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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);
50 49
51 ContextProvider::ScopedContextLock scoped_context(context_provider); 50 // The context lock must be held while accessing the context on a
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();
52 56
53 gfx::Rect playback_rect = raster_full_rect; 57 gfx::Rect playback_rect = raster_full_rect;
54 if (resource_has_previous_content_) { 58 if (resource_has_previous_content_) {
55 playback_rect.Intersect(raster_dirty_rect); 59 playback_rect.Intersect(raster_dirty_rect);
56 } 60 }
57 DCHECK(!playback_rect.IsEmpty()) 61 DCHECK(!playback_rect.IsEmpty())
58 << "Why are we rastering a tile that's not dirty?"; 62 << "Why are we rastering a tile that's not dirty?";
59 63
60 // TODO(danakj): Implement partial raster with raster_dirty_rect. 64 // TODO(danakj): Implement partial raster with raster_dirty_rect.
61 // Rasterize source into resource. 65 // Rasterize source into resource.
62 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect, 66 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect,
63 playback_rect, scale); 67 playback_rect, scale);
64 68
65 // Barrier to sync worker context output to cc context. 69 // Barrier to sync worker context output to cc context.
66 scoped_context.ContextGL()->OrderingBarrierCHROMIUM(); 70 context_provider->ContextGL()->OrderingBarrierCHROMIUM();
71
72 // Allow compositor thread to bind to context_provider.
73 context_provider->DetachFromThread();
67 } 74 }
68 75
69 private: 76 private:
70 GpuRasterizer* rasterizer_; 77 GpuRasterizer* rasterizer_;
71 ResourceProvider::ScopedWriteLockGr lock_; 78 ResourceProvider::ScopedWriteLockGr lock_;
72 bool resource_has_previous_content_; 79 bool resource_has_previous_content_;
73 80
74 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); 81 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl);
75 }; 82 };
76 83
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 void GpuTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) { 246 void GpuTileTaskWorkerPool::OnTaskSetFinished(TaskSet task_set) {
240 TRACE_EVENT1("cc", "GpuTileTaskWorkerPool::OnTaskSetFinished", "task_set", 247 TRACE_EVENT1("cc", "GpuTileTaskWorkerPool::OnTaskSetFinished", "task_set",
241 task_set); 248 task_set);
242 249
243 DCHECK(tasks_pending_[task_set]); 250 DCHECK(tasks_pending_[task_set]);
244 tasks_pending_[task_set] = false; 251 tasks_pending_[task_set] = false;
245 client_->DidFinishRunningTileTasks(task_set); 252 client_->DidFinishRunningTileTasks(task_set);
246 } 253 }
247 254
248 } // namespace cc 255 } // 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