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

Side by Side Diff: cc/resources/resource_provider.h

Issue 2122573003: media: replace LUMINANCE_F16 by RG_88 for 9/10-bit h264 videos Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more pixel test, and resolve concerns Created 4 years, 2 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 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
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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 int next_child_; 694 int next_child_;
689 ChildMap children_; 695 ChildMap children_;
690 696
691 const bool delegated_sync_points_required_; 697 const bool delegated_sync_points_required_;
692 698
693 ResourceType default_resource_type_; 699 ResourceType default_resource_type_;
694 bool use_texture_storage_ext_; 700 bool use_texture_storage_ext_;
695 bool use_texture_format_bgra_; 701 bool use_texture_format_bgra_;
696 bool use_texture_usage_hint_; 702 bool use_texture_usage_hint_;
697 bool use_compressed_texture_etc1_; 703 bool use_compressed_texture_etc1_;
698 ResourceFormat yuv_resource_format_;
699 ResourceFormat yuv_highbit_resource_format_;
700 int max_texture_size_; 704 int max_texture_size_;
701 ResourceFormat best_texture_format_; 705 ResourceFormat best_texture_format_;
702 ResourceFormat best_render_buffer_format_; 706 ResourceFormat best_render_buffer_format_;
703 const bool enable_color_correct_rendering_ = false; 707 const bool enable_color_correct_rendering_ = false;
704 708
705 base::ThreadChecker thread_checker_; 709 base::ThreadChecker thread_checker_;
706 710
707 scoped_refptr<Fence> current_read_lock_fence_; 711 scoped_refptr<Fence> current_read_lock_fence_;
708 712
709 const size_t id_allocation_chunk_size_; 713 const size_t id_allocation_chunk_size_;
710 std::unique_ptr<IdAllocator> texture_id_allocator_; 714 std::unique_ptr<IdAllocator> texture_id_allocator_;
711 std::unique_ptr<IdAllocator> buffer_id_allocator_; 715 std::unique_ptr<IdAllocator> buffer_id_allocator_;
712 716
713 bool use_sync_query_; 717 bool use_sync_query_;
714 BufferToTextureTargetMap buffer_to_texture_target_map_; 718 BufferToTextureTargetMap buffer_to_texture_target_map_;
715 719
716 // A process-unique ID used for disambiguating memory dumps from different 720 // A process-unique ID used for disambiguating memory dumps from different
717 // resource providers. 721 // resource providers.
718 int tracing_id_; 722 int tracing_id_;
719 723
720 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 724 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
721 }; 725 };
722 726
723 } // namespace cc 727 } // namespace cc
724 728
725 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 729 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698