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

Side by Side Diff: cc/raster/one_copy_raster_buffer_provider.h

Issue 1951193002: cc: Add mailbox support to ResourceProvider write locks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker_context_stream
Patch Set: rebase Created 4 years, 6 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
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 #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/raster/staging_buffer_pool.h" 13 #include "cc/raster/staging_buffer_pool.h"
14 #include "cc/resources/resource_provider.h" 14 #include "cc/resources/resource_provider.h"
15 #include "gpu/command_buffer/common/sync_token.h"
15 16
16 namespace cc { 17 namespace cc {
17 struct StagingBuffer; 18 struct StagingBuffer;
18 class StagingBufferPool; 19 class StagingBufferPool;
19 class ResourcePool; 20 class ResourcePool;
20 21
21 class CC_EXPORT OneCopyRasterBufferProvider : public RasterBufferProvider { 22 class CC_EXPORT OneCopyRasterBufferProvider : public RasterBufferProvider {
22 public: 23 public:
23 OneCopyRasterBufferProvider(base::SequencedTaskRunner* task_runner, 24 OneCopyRasterBufferProvider(base::SequencedTaskRunner* task_runner,
24 ContextProvider* compositor_context_provider, 25 ContextProvider* compositor_context_provider,
25 ContextProvider* worker_context_provider, 26 ContextProvider* worker_context_provider,
26 ResourceProvider* resource_provider, 27 ResourceProvider* resource_provider,
27 int max_copy_texture_chromium_size, 28 int max_copy_texture_chromium_size,
28 bool use_partial_raster, 29 bool use_partial_raster,
29 int max_staging_buffer_usage_in_bytes, 30 int max_staging_buffer_usage_in_bytes,
30 ResourceFormat preferred_tile_format); 31 ResourceFormat preferred_tile_format,
32 bool async_worker_context_enabled);
31 ~OneCopyRasterBufferProvider() override; 33 ~OneCopyRasterBufferProvider() override;
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;
42 void Shutdown() override; 44 void Shutdown() override;
43 45
44 // Playback raster source and copy result into |resource|. 46 // Playback raster source and copy result into |resource|.
45 void PlaybackAndCopyOnWorkerThread( 47 void PlaybackAndCopyOnWorkerThread(
46 const Resource* resource, 48 const Resource* resource,
47 ResourceProvider::ScopedWriteLockGL* resource_lock, 49 ResourceProvider::ScopedWriteLockGL* resource_lock,
50 const gpu::SyncToken& sync_token,
48 const RasterSource* raster_source, 51 const RasterSource* raster_source,
49 const gfx::Rect& raster_full_rect, 52 const gfx::Rect& raster_full_rect,
50 const gfx::Rect& raster_dirty_rect, 53 const gfx::Rect& raster_dirty_rect,
51 float scale, 54 float scale,
52 const RasterSource::PlaybackSettings& playback_settings, 55 const RasterSource::PlaybackSettings& playback_settings,
53 uint64_t previous_content_id, 56 uint64_t previous_content_id,
54 uint64_t new_content_id); 57 uint64_t new_content_id);
55 58
56 private: 59 private:
57 void PlaybackToStagingBuffer( 60 void PlaybackToStagingBuffer(
58 StagingBuffer* staging_buffer, 61 StagingBuffer* staging_buffer,
59 const Resource* resource, 62 const Resource* resource,
60 const RasterSource* raster_source, 63 const RasterSource* raster_source,
61 const gfx::Rect& raster_full_rect, 64 const gfx::Rect& raster_full_rect,
62 const gfx::Rect& raster_dirty_rect, 65 const gfx::Rect& raster_dirty_rect,
63 float scale, 66 float scale,
64 const RasterSource::PlaybackSettings& playback_settings, 67 const RasterSource::PlaybackSettings& playback_settings,
65 uint64_t previous_content_id, 68 uint64_t previous_content_id,
66 uint64_t new_content_id); 69 uint64_t new_content_id);
67 void CopyOnWorkerThread(StagingBuffer* staging_buffer, 70 void CopyOnWorkerThread(StagingBuffer* staging_buffer,
68 const Resource* resource,
69 ResourceProvider::ScopedWriteLockGL* resource_lock, 71 ResourceProvider::ScopedWriteLockGL* resource_lock,
72 const gpu::SyncToken& sync_token,
70 const RasterSource* raster_source, 73 const RasterSource* raster_source,
71 uint64_t previous_content_id, 74 uint64_t previous_content_id,
72 uint64_t new_content_id); 75 uint64_t new_content_id);
73 76
74 ContextProvider* const compositor_context_provider_; 77 ContextProvider* const compositor_context_provider_;
75 ContextProvider* const worker_context_provider_; 78 ContextProvider* const worker_context_provider_;
76 ResourceProvider* const resource_provider_; 79 ResourceProvider* const resource_provider_;
77 const int max_bytes_per_copy_operation_; 80 const int max_bytes_per_copy_operation_;
78 bool use_partial_raster_; 81 const bool use_partial_raster_;
79 82
80 // Context lock must be acquired when accessing this member. 83 // Context lock must be acquired when accessing this member.
81 int bytes_scheduled_since_last_flush_; 84 int bytes_scheduled_since_last_flush_;
82 85
83 ResourceFormat preferred_tile_format_; 86 const ResourceFormat preferred_tile_format_;
84 StagingBufferPool staging_pool_; 87 StagingBufferPool staging_pool_;
85 88
89 const bool async_worker_context_enabled_;
90
91 std::set<RasterBuffer*> pending_raster_buffers_;
92
86 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider); 93 DISALLOW_COPY_AND_ASSIGN(OneCopyRasterBufferProvider);
87 }; 94 };
88 95
89 } // namespace cc 96 } // namespace cc
90 97
91 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_ 98 #endif // CC_RASTER_ONE_COPY_RASTER_BUFFER_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698