OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_RESOURCES_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ |
6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 bool IsLost(ResourceId id); | 124 bool IsLost(ResourceId id); |
125 | 125 |
126 void LoseResourceForTesting(ResourceId id); | 126 void LoseResourceForTesting(ResourceId id); |
127 void EnableReadLockFencesForTesting(ResourceId id); | 127 void EnableReadLockFencesForTesting(ResourceId id); |
128 | 128 |
129 // Producer interface. | 129 // Producer interface. |
130 | 130 |
131 ResourceType default_resource_type() const { return default_resource_type_; } | 131 ResourceType default_resource_type() const { return default_resource_type_; } |
132 ResourceType GetResourceType(ResourceId id); | 132 ResourceType GetResourceType(ResourceId id); |
133 GLenum GetResourceTextureTarget(ResourceId id); | 133 GLenum GetResourceTextureTarget(ResourceId id); |
| 134 ResourceFormat GetResourceFormat(ResourceId id); |
134 bool IsImmutable(ResourceId id); | 135 bool IsImmutable(ResourceId id); |
135 TextureHint GetTextureHint(ResourceId id); | 136 TextureHint GetTextureHint(ResourceId id); |
136 | 137 |
137 // Creates a resource of the default resource type. | 138 // Creates a resource of the default resource type. |
138 ResourceId CreateResource(const gfx::Size& size, | 139 ResourceId CreateResource(const gfx::Size& size, |
139 TextureHint hint, | 140 TextureHint hint, |
140 ResourceFormat format, | 141 ResourceFormat format, |
141 const gfx::ColorSpace& color_space); | 142 const gfx::ColorSpace& color_space); |
142 | 143 |
143 // Creates a resource for a particular texture target (the distinction between | 144 // Creates a resource for a particular texture target (the distinction between |
144 // texture targets has no effect in software mode). | 145 // texture targets has no effect in software mode). |
145 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, | 146 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, |
146 TextureHint hint, | 147 TextureHint hint, |
147 ResourceFormat format, | 148 ResourceFormat format, |
148 gfx::BufferUsage usage, | 149 gfx::BufferUsage usage, |
149 const gfx::ColorSpace& color_space); | 150 const gfx::ColorSpace& color_space); |
150 | 151 |
151 // Wraps an external texture mailbox into a GL resource. | 152 // Wraps an external texture mailbox into a GL resource. |
152 ResourceId CreateResourceFromTextureMailbox( | 153 ResourceId CreateResourceFromTextureMailbox( |
153 const TextureMailbox& mailbox, | 154 const TextureMailbox& mailbox, |
154 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); | 155 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); |
155 | 156 |
156 ResourceId CreateResourceFromTextureMailbox( | 157 ResourceId CreateResourceFromTextureMailbox( |
157 const TextureMailbox& mailbox, | 158 const TextureMailbox& mailbox, |
158 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, | 159 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
159 bool read_lock_fences_enabled); | 160 bool read_lock_fences_enabled); |
160 | 161 |
| 162 ResourceId CreateResourceFromTextureMailbox( |
| 163 const TextureMailbox& mailbox, |
| 164 ResourceFormat format, |
| 165 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
| 166 bool read_lock_fences_enabled); |
| 167 |
161 void DeleteResource(ResourceId id); | 168 void DeleteResource(ResourceId id); |
162 | 169 |
163 // Update pixels from image, copying source_rect (in image) to dest_offset (in | 170 // Update pixels from image, copying source_rect (in image) to dest_offset (in |
164 // the resource). | 171 // the resource). |
165 void CopyToResource(ResourceId id, | 172 void CopyToResource(ResourceId id, |
166 const uint8_t* image, | 173 const uint8_t* image, |
167 const gfx::Size& image_size); | 174 const gfx::Size& image_size); |
168 | 175 |
169 // Generates sync tokesn for resources which need a sync token. | 176 // Generates sync tokesn for resources which need a sync token. |
170 void GenerateSyncTokenForResource(ResourceId resource_id); | 177 void GenerateSyncTokenForResource(ResourceId resource_id); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 464 |
458 DISALLOW_COPY_AND_ASSIGN(SynchronousFence); | 465 DISALLOW_COPY_AND_ASSIGN(SynchronousFence); |
459 }; | 466 }; |
460 | 467 |
461 // For tests only! This prevents detecting uninitialized reads. | 468 // For tests only! This prevents detecting uninitialized reads. |
462 // Use SetPixels or LockForWrite to allocate implicitly. | 469 // Use SetPixels or LockForWrite to allocate implicitly. |
463 void AllocateForTesting(ResourceId id); | 470 void AllocateForTesting(ResourceId id); |
464 | 471 |
465 // For tests only! | 472 // For tests only! |
466 void CreateForTesting(ResourceId id); | 473 void CreateForTesting(ResourceId id); |
| 474 void SetYUVHighbitResourceFormatForTesting(ResourceFormat format) { |
| 475 yuv_highbit_resource_format_ = format; |
| 476 } |
467 | 477 |
468 // Sets the current read fence. If a resource is locked for read | 478 // Sets the current read fence. If a resource is locked for read |
469 // and has read fences enabled, the resource will not allow writes | 479 // and has read fences enabled, the resource will not allow writes |
470 // until this fence has passed. | 480 // until this fence has passed. |
471 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } | 481 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } |
472 | 482 |
473 // Indicates if we can currently lock this resource for write. | 483 // Indicates if we can currently lock this resource for write. |
474 bool CanLockForWrite(ResourceId id); | 484 bool CanLockForWrite(ResourceId id); |
475 | 485 |
476 // Indicates if this resource may be used for a hardware overlay plane. | 486 // Indicates if this resource may be used for a hardware overlay plane. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 // A process-unique ID used for disambiguating memory dumps from different | 726 // A process-unique ID used for disambiguating memory dumps from different |
717 // resource providers. | 727 // resource providers. |
718 int tracing_id_; | 728 int tracing_id_; |
719 | 729 |
720 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 730 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
721 }; | 731 }; |
722 | 732 |
723 } // namespace cc | 733 } // namespace cc |
724 | 734 |
725 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 735 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |