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

Unified Diff: cc/resources/resource_provider.h

Issue 2508203004: Add hints for potential overlay promotion on android. (Closed)
Patch Set: cleanup Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/resource_provider.h
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index 38d086ded899777379b128abdf11d89ead00f17a..4759b8a126cf6171e7551944882ecf31e3d5c1ed 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -64,7 +64,6 @@ class CC_EXPORT ResourceProvider
public:
using ResourceIdArray = std::vector<ResourceId>;
- using ResourceIdSet = std::unordered_set<ResourceId>;
using ResourceIdMap = std::unordered_map<ResourceId, ResourceId>;
enum TextureHint {
TEXTURE_HINT_DEFAULT = 0x0,
@@ -207,6 +206,14 @@ class CC_EXPORT ResourceProvider
void ReceiveReturnsFromParent(
const ReturnedResourceArray& transferable_resources);
+#if defined(OS_ANDROID)
+ // Send an overlay promotion hint to all resources that requested it via
+ // |want_promotion_hint|. |promotable_set| contains all the resources that
+ // should be told that they're promotable. Others will be told that they're
+ // not promotable right now.
+ void SendPromotionHints(const ResourceIdSet& promotable_set);
+#endif
+
// The following lock classes are part of the ResourceProvider API and are
// needed to read and write the resource contents. The user must ensure
// that they only use GL locks on GL resources, etc, and this is enforced
@@ -471,6 +478,13 @@ class CC_EXPORT ResourceProvider
// Indicates if this resource may be used for a hardware overlay plane.
bool IsOverlayCandidate(ResourceId id);
+#if defined(OS_ANDROID)
+ // Indicates if this resource is backed by an Android SurfaceTexture, and thus
+ // can't really be promoted to an overlay.
+ // TODO(liberato): be sure that this is sent via IPC.
+ bool IsBackedBySurfaceTexture(ResourceId id);
+#endif
+
void WaitSyncTokenIfNeeded(ResourceId id);
static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl);
@@ -574,6 +588,20 @@ class CC_EXPORT ResourceProvider
bool read_lock_fences_enabled : 1;
bool has_shared_bitmap_id : 1;
bool is_overlay_candidate : 1;
+#if defined(OS_ANDROID)
+ // Indicates whether this resource may not be overlayed on Android, since
+ // it's not backed by a SurfaceView. This may be set in combination with
+ // |is_overlay_candidate|, to find out if switching the resource to a
+ // a SurfaceView would result in overlay promotion. It's good to find this
+ // out in advance, since one has no fallback path for displaying a
+ // SurfaceView except via promoting it to an overlay. Ideally, one _could_
+ // promote SurfaceTexture via the overlay path, even if one ended up just
+ // drawing a quad in the compositor. However, for now, we use this flag to
+ // refuse to promote so that the compositor will draw the quad.
+ bool is_backed_by_surface_texture : 1;
+ // Indicates that this resource would like a promotion hint.
+ bool wants_promotion_hint : 1;
+#endif
scoped_refptr<Fence> read_lock_fence;
gfx::Size size;
Origin origin;

Powered by Google App Engine
This is Rietveld 408576698