OLD | NEW |
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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 const Resource* resource, | 30 const Resource* resource, |
31 uint64_t resource_content_id, | 31 uint64_t resource_content_id, |
32 uint64_t previous_content_id) | 32 uint64_t previous_content_id) |
33 : rasterizer_(rasterizer), | 33 : rasterizer_(rasterizer), |
34 lock_(rasterizer->resource_provider(), resource->id()), | 34 lock_(rasterizer->resource_provider(), resource->id()), |
35 resource_has_previous_content_( | 35 resource_has_previous_content_( |
36 resource_content_id && resource_content_id == previous_content_id) { | 36 resource_content_id && resource_content_id == previous_content_id) { |
37 } | 37 } |
38 | 38 |
39 // Overridden from RasterBuffer: | 39 // Overridden from RasterBuffer: |
40 void Playback(const RasterSource* raster_source, | 40 void Playback( |
41 const gfx::Rect& raster_full_rect, | 41 const RasterSource* raster_source, |
42 const gfx::Rect& raster_dirty_rect, | 42 const gfx::Rect& raster_full_rect, |
43 uint64_t new_content_id, | 43 const gfx::Rect& raster_dirty_rect, |
44 float scale, | 44 uint64_t new_content_id, |
45 bool include_images) override { | 45 float scale, |
| 46 const RasterSource::PlaybackSettings& playback_settings) override { |
46 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); | 47 TRACE_EVENT0("cc", "RasterBufferImpl::Playback"); |
47 // GPU raster doesn't do low res tiles, so should always include images. | 48 // GPU raster doesn't do low res tiles, so should always include images. |
48 DCHECK(include_images); | 49 DCHECK(!playback_settings.skip_images); |
49 ContextProvider* context_provider = rasterizer_->resource_provider() | 50 ContextProvider* context_provider = rasterizer_->resource_provider() |
50 ->output_surface() | 51 ->output_surface() |
51 ->worker_context_provider(); | 52 ->worker_context_provider(); |
52 DCHECK(context_provider); | 53 DCHECK(context_provider); |
53 | 54 |
54 ContextProvider::ScopedContextLock scoped_context(context_provider); | 55 ContextProvider::ScopedContextLock scoped_context(context_provider); |
55 | 56 |
56 gfx::Rect playback_rect = raster_full_rect; | 57 gfx::Rect playback_rect = raster_full_rect; |
57 if (resource_has_previous_content_) { | 58 if (resource_has_previous_content_) { |
58 playback_rect.Intersect(raster_dirty_rect); | 59 playback_rect.Intersect(raster_dirty_rect); |
59 } | 60 } |
60 DCHECK(!playback_rect.IsEmpty()) | 61 DCHECK(!playback_rect.IsEmpty()) |
61 << "Why are we rastering a tile that's not dirty?"; | 62 << "Why are we rastering a tile that's not dirty?"; |
62 | 63 |
63 // TODO(danakj): Implement partial raster with raster_dirty_rect. | 64 // TODO(danakj): Implement partial raster with raster_dirty_rect. |
64 // Rasterize source into resource. | 65 // Rasterize source into resource. |
65 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect, | 66 rasterizer_->RasterizeSource(&lock_, raster_source, raster_full_rect, |
66 playback_rect, scale); | 67 playback_rect, scale, playback_settings); |
67 | 68 |
68 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); | 69 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); |
69 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); | 70 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); |
70 | 71 |
71 // Barrier to sync worker context output to cc context. | 72 // Barrier to sync worker context output to cc context. |
72 gl->OrderingBarrierCHROMIUM(); | 73 gl->OrderingBarrierCHROMIUM(); |
73 | 74 |
74 // Generate sync token after the barrier for cross context synchronization. | 75 // Generate sync token after the barrier for cross context synchronization. |
75 gpu::SyncToken sync_token; | 76 gpu::SyncToken sync_token; |
76 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 77 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 185 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( |
185 rasterizer_.get(), resource, resource_content_id, previous_content_id)); | 186 rasterizer_.get(), resource, resource_content_id, previous_content_id)); |
186 } | 187 } |
187 | 188 |
188 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( | 189 void GpuTileTaskWorkerPool::ReleaseBufferForRaster( |
189 scoped_ptr<RasterBuffer> buffer) { | 190 scoped_ptr<RasterBuffer> buffer) { |
190 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 191 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
191 } | 192 } |
192 | 193 |
193 } // namespace cc | 194 } // namespace cc |
OLD | NEW |