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

Unified Diff: cc/resources/resource_provider.cc

Issue 132873006: cc: Add zero-copy texture update support to delegating renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove swap-fence related changes. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/resource_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 9b03b675571ed3e7da55f64ab83f16eafc7a6ba2..11f4eae8c4d29f4bcbd5e0ee16f466c3a13a6cdc 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -1194,6 +1194,11 @@ void ResourceProvider::ReceiveReturnsFromParent(
if (resource->exported_count)
continue;
+ // Need to wait for the current read lock fence to pass before we can
+ // recycle this resource.
+ if (resource->enable_read_lock_fences)
+ resource->read_lock_fence = current_read_lock_fence_;
+
if (resource->gl_id) {
if (returned.sync_point)
GLC(gl, gl->WaitSyncPointCHROMIUM(returned.sync_point));
@@ -1251,6 +1256,8 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
resource->filter = source->filter;
resource->size = source->size;
+ LazyCreate(source);
danakj 2014/01/16 17:55:52 Why this? You're transferring a resource that has
piman 2014/01/16 21:54:34 I don't think it's correct here, actually. This wo
reveman 2014/01/17 01:38:39 We've created and written to the GLImage but it ha
reveman 2014/01/17 01:38:39 Hm, is texture_pool not 0 in those cases? Makes se
+
if (source->shared_bitmap) {
resource->mailbox = source->shared_bitmap->id();
resource->is_software = true;
@@ -1259,12 +1266,20 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
// Don't set a sync point, the caller will do it.
DCHECK(source->gl_id);
GLC(gl, gl->BindTexture(resource->target, source->gl_id));
+ if (source->image_id) {
+ DCHECK(source->dirty_image);
+ BindImageForSampling(source);
+ }
GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox.name));
GLC(gl,
gl->ProduceTextureCHROMIUM(resource->target, resource->mailbox.name));
source->mailbox.SetName(resource->mailbox);
} else {
DCHECK(source->mailbox.IsTexture());
+ if (source->image_id && source->dirty_image) {
piman 2014/01/16 21:54:34 Add a DCHECK(source->gl_id); The only reason we'd
reveman 2014/01/17 01:38:39 Done.
+ GLC(gl, gl->BindTexture(resource->target, source->gl_id));
+ BindImageForSampling(source);
+ }
// This is either an external resource, or a compositor resource that we
// already exported. Make sure to forward the sync point that we were given.
resource->mailbox = source->mailbox.name();
@@ -1497,14 +1512,8 @@ GLenum ResourceProvider::BindForSampling(
resource->filter = filter;
}
- if (resource->image_id && resource->dirty_image) {
- // Release image currently bound to texture.
- if (resource->bound_image_id)
- gl->ReleaseTexImage2DCHROMIUM(target, resource->bound_image_id);
- gl->BindTexImage2DCHROMIUM(target, resource->image_id);
- resource->bound_image_id = resource->image_id;
- resource->dirty_image = false;
- }
+ if (resource->image_id && resource->dirty_image)
+ BindImageForSampling(resource);
return target;
}
@@ -1696,6 +1705,19 @@ void ResourceProvider::LazyAllocate(Resource* resource) {
}
}
+void ResourceProvider::BindImageForSampling(Resource* resource) {
+ GLES2Interface* gl = ContextGL();
+ DCHECK(resource->gl_id);
+ DCHECK(resource->image_id);
+
+ // Release image currently bound to texture.
+ if (resource->bound_image_id)
+ gl->ReleaseTexImage2DCHROMIUM(resource->target, resource->bound_image_id);
+ gl->BindTexImage2DCHROMIUM(resource->target, resource->image_id);
+ resource->bound_image_id = resource->image_id;
+ resource->dirty_image = false;
+}
+
void ResourceProvider::EnableReadLockFences(ResourceProvider::ResourceId id,
bool enable) {
Resource* resource = GetResource(id);
« no previous file with comments | « cc/resources/resource_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698