| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 void Initialize(); | 103 void Initialize(); |
| 104 | 104 |
| 105 void DidLoseContextProvider() { lost_context_provider_ = true; } | 105 void DidLoseContextProvider() { lost_context_provider_ = true; } |
| 106 | 106 |
| 107 int max_texture_size() const { return max_texture_size_; } | 107 int max_texture_size() const { return max_texture_size_; } |
| 108 ResourceFormat best_texture_format() const { return best_texture_format_; } | 108 ResourceFormat best_texture_format() const { return best_texture_format_; } |
| 109 ResourceFormat best_render_buffer_format() const { | 109 ResourceFormat best_render_buffer_format() const { |
| 110 return best_render_buffer_format_; | 110 return best_render_buffer_format_; |
| 111 } | 111 } |
| 112 ResourceFormat YuvResourceFormat(int bits) const; | |
| 113 bool use_sync_query() const { return use_sync_query_; } | 112 bool use_sync_query() const { return use_sync_query_; } |
| 114 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { | 113 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { |
| 115 return gpu_memory_buffer_manager_; | 114 return gpu_memory_buffer_manager_; |
| 116 } | 115 } |
| 117 size_t num_resources() const { return resources_.size(); } | 116 size_t num_resources() const { return resources_.size(); } |
| 118 | 117 |
| 119 bool IsResourceFormatSupported(ResourceFormat format) const; | 118 bool IsResourceFormatSupported(ResourceFormat format) const; |
| 120 | 119 |
| 121 // Checks whether a resource is in use by a consumer. | 120 // Checks whether a resource is in use by a consumer. |
| 122 bool InUseByConsumer(ResourceId id); | 121 bool InUseByConsumer(ResourceId id); |
| 123 | 122 |
| 124 bool IsLost(ResourceId id); | 123 bool IsLost(ResourceId id); |
| 125 | 124 |
| 126 void LoseResourceForTesting(ResourceId id); | 125 void LoseResourceForTesting(ResourceId id); |
| 127 void EnableReadLockFencesForTesting(ResourceId id); | 126 void EnableReadLockFencesForTesting(ResourceId id); |
| 128 | 127 |
| 129 // Producer interface. | 128 // Producer interface. |
| 130 | 129 |
| 131 ResourceType default_resource_type() const { return default_resource_type_; } | 130 ResourceType default_resource_type() const { return default_resource_type_; } |
| 132 ResourceType GetResourceType(ResourceId id); | 131 ResourceType GetResourceType(ResourceId id); |
| 133 GLenum GetResourceTextureTarget(ResourceId id); | 132 GLenum GetResourceTextureTarget(ResourceId id); |
| 133 ResourceFormat GetResourceFormat(ResourceId id); |
| 134 bool IsImmutable(ResourceId id); | 134 bool IsImmutable(ResourceId id); |
| 135 TextureHint GetTextureHint(ResourceId id); | 135 TextureHint GetTextureHint(ResourceId id); |
| 136 | 136 |
| 137 // Creates a resource of the default resource type. | 137 // Creates a resource of the default resource type. |
| 138 ResourceId CreateResource(const gfx::Size& size, | 138 ResourceId CreateResource(const gfx::Size& size, |
| 139 TextureHint hint, | 139 TextureHint hint, |
| 140 ResourceFormat format, | 140 ResourceFormat format, |
| 141 const gfx::ColorSpace& color_space); | 141 const gfx::ColorSpace& color_space); |
| 142 | 142 |
| 143 // Creates a resource for a particular texture target (the distinction between | 143 // Creates a resource for a particular texture target (the distinction between |
| 144 // texture targets has no effect in software mode). | 144 // texture targets has no effect in software mode). |
| 145 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, | 145 ResourceId CreateGpuMemoryBufferResource(const gfx::Size& size, |
| 146 TextureHint hint, | 146 TextureHint hint, |
| 147 ResourceFormat format, | 147 ResourceFormat format, |
| 148 gfx::BufferUsage usage, | 148 gfx::BufferUsage usage, |
| 149 const gfx::ColorSpace& color_space); | 149 const gfx::ColorSpace& color_space); |
| 150 | 150 |
| 151 // Wraps an external texture mailbox into a GL resource. | 151 // Wraps an external texture mailbox into a GL resource. |
| 152 ResourceId CreateResourceFromTextureMailbox( | 152 ResourceId CreateResourceFromTextureMailbox( |
| 153 const TextureMailbox& mailbox, | 153 const TextureMailbox& mailbox, |
| 154 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); | 154 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl); |
| 155 | 155 |
| 156 ResourceId CreateResourceFromTextureMailbox( | 156 ResourceId CreateResourceFromTextureMailbox( |
| 157 const TextureMailbox& mailbox, | 157 const TextureMailbox& mailbox, |
| 158 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, | 158 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
| 159 bool read_lock_fences_enabled); | 159 bool read_lock_fences_enabled); |
| 160 | 160 |
| 161 ResourceId CreateResourceFromTextureMailbox( |
| 162 const TextureMailbox& mailbox, |
| 163 ResourceFormat format, |
| 164 std::unique_ptr<SingleReleaseCallbackImpl> release_callback_impl, |
| 165 bool read_lock_fences_enabled); |
| 166 |
| 161 void DeleteResource(ResourceId id); | 167 void DeleteResource(ResourceId id); |
| 162 | 168 |
| 163 // Update pixels from image, copying source_rect (in image) to dest_offset (in | 169 // Update pixels from image, copying source_rect (in image) to dest_offset (in |
| 164 // the resource). | 170 // the resource). |
| 165 void CopyToResource(ResourceId id, | 171 void CopyToResource(ResourceId id, |
| 166 const uint8_t* image, | 172 const uint8_t* image, |
| 167 const gfx::Size& image_size); | 173 const gfx::Size& image_size); |
| 168 | 174 |
| 169 // Generates sync tokesn for resources which need a sync token. | 175 // Generates sync tokesn for resources which need a sync token. |
| 170 void GenerateSyncTokenForResource(ResourceId resource_id); | 176 void GenerateSyncTokenForResource(ResourceId resource_id); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 int next_child_; | 696 int next_child_; |
| 691 ChildMap children_; | 697 ChildMap children_; |
| 692 | 698 |
| 693 const bool delegated_sync_points_required_; | 699 const bool delegated_sync_points_required_; |
| 694 | 700 |
| 695 ResourceType default_resource_type_; | 701 ResourceType default_resource_type_; |
| 696 bool use_texture_storage_ext_; | 702 bool use_texture_storage_ext_; |
| 697 bool use_texture_format_bgra_; | 703 bool use_texture_format_bgra_; |
| 698 bool use_texture_usage_hint_; | 704 bool use_texture_usage_hint_; |
| 699 bool use_compressed_texture_etc1_; | 705 bool use_compressed_texture_etc1_; |
| 700 ResourceFormat yuv_resource_format_; | |
| 701 ResourceFormat yuv_highbit_resource_format_; | |
| 702 int max_texture_size_; | 706 int max_texture_size_; |
| 703 ResourceFormat best_texture_format_; | 707 ResourceFormat best_texture_format_; |
| 704 ResourceFormat best_render_buffer_format_; | 708 ResourceFormat best_render_buffer_format_; |
| 705 const bool enable_color_correct_rendering_ = false; | 709 const bool enable_color_correct_rendering_ = false; |
| 706 | 710 |
| 707 base::ThreadChecker thread_checker_; | 711 base::ThreadChecker thread_checker_; |
| 708 | 712 |
| 709 scoped_refptr<Fence> current_read_lock_fence_; | 713 scoped_refptr<Fence> current_read_lock_fence_; |
| 710 | 714 |
| 711 const size_t id_allocation_chunk_size_; | 715 const size_t id_allocation_chunk_size_; |
| 712 std::unique_ptr<IdAllocator> texture_id_allocator_; | 716 std::unique_ptr<IdAllocator> texture_id_allocator_; |
| 713 std::unique_ptr<IdAllocator> buffer_id_allocator_; | 717 std::unique_ptr<IdAllocator> buffer_id_allocator_; |
| 714 | 718 |
| 715 bool use_sync_query_; | 719 bool use_sync_query_; |
| 716 BufferToTextureTargetMap buffer_to_texture_target_map_; | 720 BufferToTextureTargetMap buffer_to_texture_target_map_; |
| 717 | 721 |
| 718 // A process-unique ID used for disambiguating memory dumps from different | 722 // A process-unique ID used for disambiguating memory dumps from different |
| 719 // resource providers. | 723 // resource providers. |
| 720 int tracing_id_; | 724 int tracing_id_; |
| 721 | 725 |
| 722 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 726 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 723 }; | 727 }; |
| 724 | 728 |
| 725 } // namespace cc | 729 } // namespace cc |
| 726 | 730 |
| 727 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 731 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |