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 20 matching lines...) Expand all Loading... |
31 #include "cc/resources/release_callback_impl.h" | 31 #include "cc/resources/release_callback_impl.h" |
32 #include "cc/resources/resource_format.h" | 32 #include "cc/resources/resource_format.h" |
33 #include "cc/resources/return_callback.h" | 33 #include "cc/resources/return_callback.h" |
34 #include "cc/resources/shared_bitmap.h" | 34 #include "cc/resources/shared_bitmap.h" |
35 #include "cc/resources/single_release_callback_impl.h" | 35 #include "cc/resources/single_release_callback_impl.h" |
36 #include "cc/resources/texture_mailbox.h" | 36 #include "cc/resources/texture_mailbox.h" |
37 #include "cc/resources/transferable_resource.h" | 37 #include "cc/resources/transferable_resource.h" |
38 #include "third_party/khronos/GLES2/gl2.h" | 38 #include "third_party/khronos/GLES2/gl2.h" |
39 #include "third_party/khronos/GLES2/gl2ext.h" | 39 #include "third_party/khronos/GLES2/gl2ext.h" |
40 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
| 41 #include "ui/gfx/buffer_types.h" |
41 #include "ui/gfx/color_space.h" | 42 #include "ui/gfx/color_space.h" |
42 #include "ui/gfx/geometry/size.h" | 43 #include "ui/gfx/geometry/size.h" |
43 #include "ui/gfx/gpu_memory_buffer.h" | 44 #include "ui/gfx/gpu_memory_buffer.h" |
44 | 45 |
45 namespace gpu { | 46 namespace gpu { |
46 class GpuMemoryBufferManager; | 47 class GpuMemoryBufferManager; |
47 namespace gles { | 48 namespace gles { |
48 class GLES2Interface; | 49 class GLES2Interface; |
49 } | 50 } |
50 } | 51 } |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // and has read fences enabled, the resource will not allow writes | 482 // and has read fences enabled, the resource will not allow writes |
482 // until this fence has passed. | 483 // until this fence has passed. |
483 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } | 484 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } |
484 | 485 |
485 // Indicates if we can currently lock this resource for write. | 486 // Indicates if we can currently lock this resource for write. |
486 bool CanLockForWrite(ResourceId id); | 487 bool CanLockForWrite(ResourceId id); |
487 | 488 |
488 // Indicates if this resource may be used for a hardware overlay plane. | 489 // Indicates if this resource may be used for a hardware overlay plane. |
489 bool IsOverlayCandidate(ResourceId id); | 490 bool IsOverlayCandidate(ResourceId id); |
490 | 491 |
| 492 // Return the format of the underlying buffer that can be used for scanout. |
| 493 gfx::BufferFormat GetBufferFormat(ResourceId id); |
| 494 |
491 #if defined(OS_ANDROID) | 495 #if defined(OS_ANDROID) |
492 // Indicates if this resource is backed by an Android SurfaceTexture, and thus | 496 // Indicates if this resource is backed by an Android SurfaceTexture, and thus |
493 // can't really be promoted to an overlay. | 497 // can't really be promoted to an overlay. |
494 bool IsBackedBySurfaceTexture(ResourceId id); | 498 bool IsBackedBySurfaceTexture(ResourceId id); |
495 | 499 |
496 // Indicates if this resource wants to receive promotion hints. | 500 // Indicates if this resource wants to receive promotion hints. |
497 bool WantsPromotionHint(ResourceId id); | 501 bool WantsPromotionHint(ResourceId id); |
498 | 502 |
499 // Return the number of resources that request promotion hints. | 503 // Return the number of resources that request promotion hints. |
500 size_t CountPromotionHintRequestsForTesting(); | 504 size_t CountPromotionHintRequestsForTesting(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 GLenum original_filter; | 629 GLenum original_filter; |
626 GLenum filter; | 630 GLenum filter; |
627 unsigned image_id; | 631 unsigned image_id; |
628 unsigned bound_image_id; | 632 unsigned bound_image_id; |
629 TextureHint hint; | 633 TextureHint hint; |
630 ResourceType type; | 634 ResourceType type; |
631 | 635 |
632 // GpuMemoryBuffer resource allocation needs to know how the resource will | 636 // GpuMemoryBuffer resource allocation needs to know how the resource will |
633 // be used. | 637 // be used. |
634 gfx::BufferUsage usage; | 638 gfx::BufferUsage usage; |
| 639 // This is the the actual format of the underlaying GpuMemoryBuffer, if any, |
| 640 // and might not correspond to ResourceFormat. This format is needed to |
| 641 // scanout the buffer as HW overlay. |
| 642 gfx::BufferFormat buffer_format; |
| 643 // Resource format is the format as seen from the compositor and might not |
| 644 // correspond to buffer_format (e.g: A resouce that was created from a YUV |
| 645 // buffer could be seen as RGB from the compositor/GL.) |
635 ResourceFormat format; | 646 ResourceFormat format; |
636 SharedBitmapId shared_bitmap_id; | 647 SharedBitmapId shared_bitmap_id; |
637 SharedBitmap* shared_bitmap; | 648 SharedBitmap* shared_bitmap; |
638 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; | 649 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; |
639 gfx::ColorSpace color_space; | 650 gfx::ColorSpace color_space; |
640 | 651 |
641 private: | 652 private: |
642 SynchronizationState synchronization_state_ = SYNCHRONIZED; | 653 SynchronizationState synchronization_state_ = SYNCHRONIZED; |
643 bool needs_sync_token_ = false; | 654 bool needs_sync_token_ = false; |
644 TextureMailbox mailbox_; | 655 TextureMailbox mailbox_; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 // Set of resource Ids that would like to be notified about promotion hints. | 771 // Set of resource Ids that would like to be notified about promotion hints. |
761 ResourceIdSet wants_promotion_hints_set_; | 772 ResourceIdSet wants_promotion_hints_set_; |
762 #endif | 773 #endif |
763 | 774 |
764 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 775 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
765 }; | 776 }; |
766 | 777 |
767 } // namespace cc | 778 } // namespace cc |
768 | 779 |
769 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 780 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |