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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 447 |
448 DISALLOW_COPY_AND_ASSIGN(SynchronousFence); | 448 DISALLOW_COPY_AND_ASSIGN(SynchronousFence); |
449 }; | 449 }; |
450 | 450 |
451 // For tests only! This prevents detecting uninitialized reads. | 451 // For tests only! This prevents detecting uninitialized reads. |
452 // Use SetPixels or LockForWrite to allocate implicitly. | 452 // Use SetPixels or LockForWrite to allocate implicitly. |
453 void AllocateForTesting(viz::ResourceId id); | 453 void AllocateForTesting(viz::ResourceId id); |
454 | 454 |
455 // For tests only! | 455 // For tests only! |
456 void CreateForTesting(viz::ResourceId id); | 456 void CreateForTesting(viz::ResourceId id); |
| 457 void SetYUVHighbitResourceFormatForTesting(viz::ResourceFormat format) { |
| 458 settings_.yuv_highbit_resource_format = format; |
| 459 } |
457 | 460 |
458 // Sets the current read fence. If a resource is locked for read | 461 // Sets the current read fence. If a resource is locked for read |
459 // and has read fences enabled, the resource will not allow writes | 462 // and has read fences enabled, the resource will not allow writes |
460 // until this fence has passed. | 463 // until this fence has passed. |
461 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } | 464 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } |
462 | 465 |
463 // Indicates if we can currently lock this resource for write. | 466 // Indicates if we can currently lock this resource for write. |
464 bool CanLockForWrite(viz::ResourceId id); | 467 bool CanLockForWrite(viz::ResourceId id); |
465 | 468 |
466 // Indicates if this resource may be used for a hardware overlay plane. | 469 // Indicates if this resource may be used for a hardware overlay plane. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, | 660 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, |
658 DeleteStyle style, | 661 DeleteStyle style, |
659 const ResourceIdArray& unused); | 662 const ResourceIdArray& unused); |
660 void DestroyChildInternal(ChildMap::iterator it, DeleteStyle style); | 663 void DestroyChildInternal(ChildMap::iterator it, DeleteStyle style); |
661 | 664 |
662 void CreateMailbox(Resource* resource); | 665 void CreateMailbox(Resource* resource); |
663 | 666 |
664 // Returns null if we do not have a viz::ContextProvider. | 667 // Returns null if we do not have a viz::ContextProvider. |
665 gpu::gles2::GLES2Interface* ContextGL() const; | 668 gpu::gles2::GLES2Interface* ContextGL() const; |
666 | 669 |
667 // Holds const settings for the ResourceProvider. Never changed after init. | 670 // Holds settings for the ResourceProvider. Never changed after init. |
668 struct Settings { | 671 struct Settings { |
669 Settings(viz::ContextProvider* compositor_context_provider, | 672 Settings(viz::ContextProvider* compositor_context_provider, |
670 bool delegated_sync_points_needed, | 673 bool delegated_sync_points_needed, |
671 bool enable_color_correct_rasterization, | 674 bool enable_color_correct_rasterization, |
672 const viz::ResourceSettings& resource_settings); | 675 const viz::ResourceSettings& resource_settings); |
673 | 676 |
674 int max_texture_size = 0; | 677 int max_texture_size = 0; |
675 bool use_texture_storage_ext = false; | 678 bool use_texture_storage_ext = false; |
676 bool use_texture_format_bgra = false; | 679 bool use_texture_format_bgra = false; |
677 bool use_texture_usage_hint = false; | 680 bool use_texture_usage_hint = false; |
678 bool use_sync_query = false; | 681 bool use_sync_query = false; |
679 ResourceType default_resource_type = RESOURCE_TYPE_GL_TEXTURE; | 682 ResourceType default_resource_type = RESOURCE_TYPE_GL_TEXTURE; |
680 viz::ResourceFormat yuv_resource_format = viz::LUMINANCE_8; | 683 viz::ResourceFormat yuv_resource_format = viz::LUMINANCE_8; |
681 viz::ResourceFormat yuv_highbit_resource_format = viz::LUMINANCE_8; | 684 viz::ResourceFormat yuv_highbit_resource_format = viz::LUMINANCE_8; |
682 viz::ResourceFormat best_texture_format = viz::RGBA_8888; | 685 viz::ResourceFormat best_texture_format = viz::RGBA_8888; |
683 viz::ResourceFormat best_render_buffer_format = viz::RGBA_8888; | 686 viz::ResourceFormat best_render_buffer_format = viz::RGBA_8888; |
684 bool enable_color_correct_rasterization = false; | 687 bool enable_color_correct_rasterization = false; |
685 bool delegated_sync_points_required = false; | 688 bool delegated_sync_points_required = false; |
686 } const settings_; | 689 } settings_; |
687 | 690 |
688 ResourceMap resources_; | 691 ResourceMap resources_; |
689 ChildMap children_; | 692 ChildMap children_; |
690 | 693 |
691 // Keep track of whether deleted resources should be batched up or returned | 694 // Keep track of whether deleted resources should be batched up or returned |
692 // immediately. | 695 // immediately. |
693 bool batch_return_resources_ = false; | 696 bool batch_return_resources_ = false; |
694 // Maps from a child id to the set of resources to be returned to it. | 697 // Maps from a child id to the set of resources to be returned to it. |
695 base::small_map<std::map<int, ResourceIdArray>> batched_returning_resources_; | 698 base::small_map<std::map<int, ResourceIdArray>> batched_returning_resources_; |
696 | 699 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 // A process-unique ID used for disambiguating memory dumps from different | 758 // A process-unique ID used for disambiguating memory dumps from different |
756 // resource providers. | 759 // resource providers. |
757 int tracing_id_; | 760 int tracing_id_; |
758 | 761 |
759 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 762 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
760 }; | 763 }; |
761 | 764 |
762 } // namespace cc | 765 } // namespace cc |
763 | 766 |
764 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 767 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |