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 #ifndef CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ | 5 #ifndef CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ |
6 #define CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ | 6 #define CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/raster/raster_buffer_provider.h" | 11 #include "cc/raster/raster_buffer_provider.h" |
| 12 #include "cc/resources/resource_provider.h" |
| 13 #include "gpu/command_buffer/common/sync_token.h" |
12 | 14 |
13 namespace cc { | 15 namespace cc { |
14 class ContextProvider; | 16 class ContextProvider; |
15 class GpuRasterizer; | |
16 class ResourceProvider; | |
17 | 17 |
18 class CC_EXPORT GpuRasterBufferProvider : public RasterBufferProvider { | 18 class CC_EXPORT GpuRasterBufferProvider : public RasterBufferProvider { |
19 public: | 19 public: |
20 GpuRasterBufferProvider(ContextProvider* compositor_context_provider, | 20 GpuRasterBufferProvider(ContextProvider* compositor_context_provider, |
21 ContextProvider* worker_context_provider, | 21 ContextProvider* worker_context_provider, |
22 ResourceProvider* resource_provider, | 22 ResourceProvider* resource_provider, |
23 bool use_distance_field_text, | 23 bool use_distance_field_text, |
24 int gpu_rasterization_msaa_sample_count); | 24 int gpu_rasterization_msaa_sample_count, |
| 25 bool async_worker_context_enabled); |
25 ~GpuRasterBufferProvider() override; | 26 ~GpuRasterBufferProvider() override; |
26 | 27 |
27 // Overridden from RasterBufferProvider: | 28 // Overridden from RasterBufferProvider: |
28 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 29 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
29 const Resource* resource, | 30 const Resource* resource, |
30 uint64_t resource_content_id, | 31 uint64_t resource_content_id, |
31 uint64_t previous_content_id) override; | 32 uint64_t previous_content_id) override; |
32 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; | 33 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; |
33 void OrderingBarrier() override; | 34 bool OrderingBarrier() override; |
34 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 35 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
35 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | 36 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; |
36 void Shutdown() override; | 37 void Shutdown() override; |
37 | 38 |
| 39 void PlaybackOnWorkerThread( |
| 40 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 41 const gpu::SyncToken& sync_token, |
| 42 bool resource_has_previous_content, |
| 43 const RasterSource* raster_source, |
| 44 const gfx::Rect& raster_full_rect, |
| 45 const gfx::Rect& raster_dirty_rect, |
| 46 uint64_t new_content_id, |
| 47 float scale, |
| 48 const RasterSource::PlaybackSettings& playback_settings); |
| 49 |
38 private: | 50 private: |
| 51 class RasterBufferImpl : public RasterBuffer { |
| 52 public: |
| 53 RasterBufferImpl(GpuRasterBufferProvider* client, |
| 54 ResourceProvider* resource_provider, |
| 55 ResourceId resource_id, |
| 56 bool async_worker_context_enabled, |
| 57 bool resource_has_previous_content); |
| 58 ~RasterBufferImpl() override; |
| 59 |
| 60 // Overridden from RasterBuffer: |
| 61 void Playback( |
| 62 const RasterSource* raster_source, |
| 63 const gfx::Rect& raster_full_rect, |
| 64 const gfx::Rect& raster_dirty_rect, |
| 65 uint64_t new_content_id, |
| 66 float scale, |
| 67 const RasterSource::PlaybackSettings& playback_settings) override; |
| 68 |
| 69 void set_sync_token(const gpu::SyncToken& sync_token) { |
| 70 sync_token_ = sync_token; |
| 71 } |
| 72 |
| 73 private: |
| 74 GpuRasterBufferProvider* const client_; |
| 75 ResourceProvider::ScopedWriteLockGL lock_; |
| 76 const bool resource_has_previous_content_; |
| 77 |
| 78 gpu::SyncToken sync_token_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 81 }; |
| 82 |
39 ContextProvider* const compositor_context_provider_; | 83 ContextProvider* const compositor_context_provider_; |
40 std::unique_ptr<GpuRasterizer> rasterizer_; | 84 ContextProvider* const worker_context_provider_; |
| 85 ResourceProvider* const resource_provider_; |
| 86 const bool use_distance_field_text_; |
| 87 const int msaa_sample_count_; |
| 88 const bool async_worker_context_enabled_; |
| 89 |
| 90 std::set<RasterBufferImpl*> pending_raster_buffers_; |
41 | 91 |
42 DISALLOW_COPY_AND_ASSIGN(GpuRasterBufferProvider); | 92 DISALLOW_COPY_AND_ASSIGN(GpuRasterBufferProvider); |
43 }; | 93 }; |
44 | 94 |
45 } // namespace cc | 95 } // namespace cc |
46 | 96 |
47 #endif // CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ | 97 #endif // CC_RASTER_GPU_RASTER_BUFFER_PROVIDER_H_ |
OLD | NEW |