| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // and has read fences enabled, the resource will not allow writes | 471 // and has read fences enabled, the resource will not allow writes |
| 472 // until this fence has passed. | 472 // until this fence has passed. |
| 473 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } | 473 void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } |
| 474 | 474 |
| 475 // Indicates if we can currently lock this resource for write. | 475 // Indicates if we can currently lock this resource for write. |
| 476 bool CanLockForWrite(ResourceId id); | 476 bool CanLockForWrite(ResourceId id); |
| 477 | 477 |
| 478 // Indicates if this resource may be used for a hardware overlay plane. | 478 // Indicates if this resource may be used for a hardware overlay plane. |
| 479 bool IsOverlayCandidate(ResourceId id); | 479 bool IsOverlayCandidate(ResourceId id); |
| 480 | 480 |
| 481 #if defined(OS_ANDROID) |
| 482 // Indicates if this resource is backed by an Android SurfaceTexture, and thus |
| 483 // can't really be promoted to an overlay. |
| 484 // TODO(liberato): be sure that this is sent via IPC. |
| 485 bool IsBackedBySurfaceTexture(ResourceId id); |
| 486 #endif |
| 487 |
| 481 void WaitSyncTokenIfNeeded(ResourceId id); | 488 void WaitSyncTokenIfNeeded(ResourceId id); |
| 482 | 489 |
| 483 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); | 490 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
| 484 | 491 |
| 485 void ValidateResource(ResourceId id) const; | 492 void ValidateResource(ResourceId id) const; |
| 486 | 493 |
| 487 GLenum GetImageTextureTarget(gfx::BufferUsage usage, ResourceFormat format); | 494 GLenum GetImageTextureTarget(gfx::BufferUsage usage, ResourceFormat format); |
| 488 | 495 |
| 489 // base::trace_event::MemoryDumpProvider implementation. | 496 // base::trace_event::MemoryDumpProvider implementation. |
| 490 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 497 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 int imported_count; | 581 int imported_count; |
| 575 int exported_count; | 582 int exported_count; |
| 576 bool dirty_image : 1; | 583 bool dirty_image : 1; |
| 577 bool locked_for_write : 1; | 584 bool locked_for_write : 1; |
| 578 bool lost : 1; | 585 bool lost : 1; |
| 579 bool marked_for_deletion : 1; | 586 bool marked_for_deletion : 1; |
| 580 bool allocated : 1; | 587 bool allocated : 1; |
| 581 bool read_lock_fences_enabled : 1; | 588 bool read_lock_fences_enabled : 1; |
| 582 bool has_shared_bitmap_id : 1; | 589 bool has_shared_bitmap_id : 1; |
| 583 bool is_overlay_candidate : 1; | 590 bool is_overlay_candidate : 1; |
| 591 #if defined(OS_ANDROID) |
| 592 // Indicates whether this resource may not be overlayed on Android, since |
| 593 // it's |
| 594 // not backed by a SurfaceView. This may be set in combination with |
| 595 // |is_overlay_candidate|, to find out if switching the resource to a |
| 596 // a SurfaceView would result in overlay promotion. It's good to find this |
| 597 // out in advance, since one has no fallback path for displaying a |
| 598 // SurfaceView except via promoting it to an overlay. Ideally, one _could_ |
| 599 // promote SurfaceTexture via the overlay path, even if one ended up just |
| 600 // drawing a quad in the compositor. However, for now, we use this flag to |
| 601 // refuse to promote so that the compositor will draw the quad. |
| 602 bool is_backed_by_surface_texture : 1; |
| 603 #endif |
| 584 scoped_refptr<Fence> read_lock_fence; | 604 scoped_refptr<Fence> read_lock_fence; |
| 585 gfx::Size size; | 605 gfx::Size size; |
| 586 Origin origin; | 606 Origin origin; |
| 587 GLenum target; | 607 GLenum target; |
| 588 // TODO(skyostil): Use a separate sampler object for filter state. | 608 // TODO(skyostil): Use a separate sampler object for filter state. |
| 589 GLenum original_filter; | 609 GLenum original_filter; |
| 590 GLenum filter; | 610 GLenum filter; |
| 591 unsigned image_id; | 611 unsigned image_id; |
| 592 unsigned bound_image_id; | 612 unsigned bound_image_id; |
| 593 TextureHint hint; | 613 TextureHint hint; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 // A process-unique ID used for disambiguating memory dumps from different | 738 // A process-unique ID used for disambiguating memory dumps from different |
| 719 // resource providers. | 739 // resource providers. |
| 720 int tracing_id_; | 740 int tracing_id_; |
| 721 | 741 |
| 722 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 742 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 723 }; | 743 }; |
| 724 | 744 |
| 725 } // namespace cc | 745 } // namespace cc |
| 726 | 746 |
| 727 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 747 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |