| 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_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 5 #ifndef CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| 6 #define CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 6 #define CC_RASTER_ONE_COPY_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/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/raster/raster_buffer_provider.h" | 12 #include "cc/raster/raster_buffer_provider.h" |
| 13 #include "cc/resources/resource_provider.h" | 13 #include "cc/resources/resource_provider.h" |
| 14 #include "gpu/command_buffer/common/sync_token.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 struct StagingBuffer; | 17 struct StagingBuffer; |
| 17 class StagingBufferPool; | 18 class StagingBufferPool; |
| 18 class ResourcePool; | 19 class ResourcePool; |
| 19 | 20 |
| 20 class CC_EXPORT OneCopyRasterBufferProvider : public RasterBufferProvider { | 21 class CC_EXPORT OneCopyRasterBufferProvider : public RasterBufferProvider { |
| 21 public: | 22 public: |
| 22 ~OneCopyRasterBufferProvider() override; | 23 ~OneCopyRasterBufferProvider() override; |
| 23 | 24 |
| 24 static std::unique_ptr<RasterBufferProvider> Create( | 25 static std::unique_ptr<RasterBufferProvider> Create( |
| 25 base::SequencedTaskRunner* task_runner, | 26 base::SequencedTaskRunner* task_runner, |
| 26 ContextProvider* context_provider, | 27 ContextProvider* context_provider, |
| 27 ResourceProvider* resource_provider, | 28 ResourceProvider* resource_provider, |
| 28 int max_copy_texture_chromium_size, | 29 int max_copy_texture_chromium_size, |
| 29 bool use_partial_raster, | 30 bool use_partial_raster, |
| 30 int max_staging_buffer_usage_in_bytes, | 31 int max_staging_buffer_usage_in_bytes, |
| 31 ResourceFormat preferred_tile_format); | 32 ResourceFormat preferred_tile_format, |
| 33 bool async_worker_context_enabled); |
| 32 | 34 |
| 33 // Overridden from RasterBufferProvider: | 35 // Overridden from RasterBufferProvider: |
| 34 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 36 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
| 35 const Resource* resource, | 37 const Resource* resource, |
| 36 uint64_t resource_content_id, | 38 uint64_t resource_content_id, |
| 37 uint64_t previous_content_id) override; | 39 uint64_t previous_content_id) override; |
| 38 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; | 40 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; |
| 39 void OrderingBarrier() override; | 41 void OrderingBarrier() override; |
| 40 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 42 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
| 41 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | 43 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 52 const RasterSource::PlaybackSettings& playback_settings, | 54 const RasterSource::PlaybackSettings& playback_settings, |
| 53 uint64_t previous_content_id, | 55 uint64_t previous_content_id, |
| 54 uint64_t new_content_id); | 56 uint64_t new_content_id); |
| 55 | 57 |
| 56 protected: | 58 protected: |
| 57 OneCopyRasterBufferProvider(base::SequencedTaskRunner* task_runner, | 59 OneCopyRasterBufferProvider(base::SequencedTaskRunner* task_runner, |
| 58 ResourceProvider* resource_provider, | 60 ResourceProvider* resource_provider, |
| 59 int max_copy_texture_chromium_size, | 61 int max_copy_texture_chromium_size, |
| 60 bool use_partial_raster, | 62 bool use_partial_raster, |
| 61 int max_staging_buffer_usage_in_bytes, | 63 int max_staging_buffer_usage_in_bytes, |
| 62 ResourceFormat preferred_tile_format); | 64 ResourceFormat preferred_tile_format, |
| 65 bool async_worker_context_enabled); |
| 63 | 66 |
| 64 private: | 67 private: |
| 65 void PlaybackToStagingBuffer( | 68 void PlaybackToStagingBuffer( |
| 66 StagingBuffer* staging_buffer, | 69 StagingBuffer* staging_buffer, |
| 67 const Resource* resource, | 70 const Resource* resource, |
| 68 const RasterSource* raster_source, | 71 const RasterSource* raster_source, |
| 69 const gfx::Rect& raster_full_rect, | 72 const gfx::Rect& raster_full_rect, |
| 70 const gfx::Rect& raster_dirty_rect, | 73 const gfx::Rect& raster_dirty_rect, |
| 71 float scale, | 74 float scale, |
| 72 const RasterSource::PlaybackSettings& playback_settings, | 75 const RasterSource::PlaybackSettings& playback_settings, |
| 73 uint64_t previous_content_id, | 76 uint64_t previous_content_id, |
| 74 uint64_t new_content_id); | 77 uint64_t new_content_id); |
| 75 void CopyOnWorkerThread(StagingBuffer* staging_buffer, | 78 void CopyOnWorkerThread(StagingBuffer* staging_buffer, |
| 76 const Resource* resource, | 79 const Resource* resource, |
| 77 ResourceProvider::ScopedWriteLockGL* resource_lock, | 80 ResourceProvider::ScopedWriteLockGL* resource_lock, |
| 78 const RasterSource* raster_source, | 81 const RasterSource* raster_source, |
| 79 uint64_t previous_content_id, | 82 uint64_t previous_content_id, |
| 80 uint64_t new_content_id); | 83 uint64_t new_content_id); |
| 81 | 84 |
| 82 ResourceProvider* const resource_provider_; | 85 ResourceProvider* const resource_provider_; |
| 83 const int max_bytes_per_copy_operation_; | 86 const int max_bytes_per_copy_operation_; |
| 84 bool use_partial_raster_; | 87 bool use_partial_raster_; |
| 85 | 88 |
| 86 // Context lock must be acquired when accessing this member. | 89 // Context lock must be acquired when accessing this member. |
| 87 int bytes_scheduled_since_last_flush_; | 90 int bytes_scheduled_since_last_flush_; |
| 88 | 91 |
| 89 ResourceFormat preferred_tile_format_; | 92 ResourceFormat preferred_tile_format_; |
| 90 std::unique_ptr<StagingBufferPool> staging_pool_; | 93 std::unique_ptr<StagingBufferPool> staging_pool_; |
| 91 | 94 |
| 95 bool async_worker_context_enabled_; |
| 96 gpu::SyncToken sync_token_; |
| 97 |
| 92 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); | 98 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); |
| 93 }; | 99 }; |
| 94 | 100 |
| 95 } // namespace cc | 101 } // namespace cc |
| 96 | 102 |
| 97 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ | 103 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ |
| OLD | NEW |