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

Unified Diff: cc/resources/resource_provider.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mock gpu video accelerator factory Created 5 years, 2 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
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 15c4dee459fc207444321184f25a0809f50ae0b5..16eb6fb967c8c22640d4e6645f12b0596d468238 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -565,6 +565,7 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it,
if (resource->origin == Resource::EXTERNAL) {
DCHECK(resource->mailbox.IsValid());
GLuint sync_point = resource->mailbox.sync_point();
+ gpu::SyncToken sync_token;
if (resource->type == RESOURCE_TYPE_GL_TEXTURE) {
DCHECK(resource->mailbox.IsTexture());
lost_resource |= lost_output_surface_;
@@ -581,8 +582,8 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it,
resource->shared_bitmap = nullptr;
resource->pixels = nullptr;
}
- resource->release_callback_impl.Run(
- sync_point, lost_resource, blocking_main_thread_task_runner_);
+ resource->release_callback_impl.Run(sync_point, sync_token, lost_resource,
+ blocking_main_thread_task_runner_);
}
if (resource->gl_id) {
GLES2Interface* gl = ContextGL();
@@ -693,6 +694,7 @@ const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) {
// Mailbox sync_points must be processed by a call to
// WaitSyncPointIfNeeded() prior to calling LockForRead().
DCHECK(!resource->mailbox.sync_point());
+ DCHECK(!resource->mailbox.sync_token().HasData());
GLES2Interface* gl = ContextGL();
DCHECK(gl);
@@ -1142,8 +1144,9 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
++it) {
TransferableResource resource;
TransferResource(gl, *it, &resource);
- if (!resource.mailbox_holder.sync_point && !resource.is_software)
- need_sync_point = true;
+ need_sync_point |= (!resource.mailbox_holder.sync_point &&
+ !resource.mailbox_holder.sync_token.HasData() &&
+ !resource.is_software);
++resources_.find(*it)->second.exported_count;
list->push_back(resource);
}
@@ -1198,9 +1201,9 @@ void ResourceProvider::ReceiveFromChild(
local_id, Resource(0, it->size, Resource::DELEGATED,
it->mailbox_holder.texture_target, it->filter,
TEXTURE_HINT_IMMUTABLE, it->format));
- resource->mailbox = TextureMailbox(it->mailbox_holder.mailbox,
- it->mailbox_holder.texture_target,
- it->mailbox_holder.sync_point);
+ resource->mailbox = TextureMailbox(
+ it->mailbox_holder.mailbox, it->mailbox_holder.texture_target,
+ it->mailbox_holder.sync_point, it->mailbox_holder.sync_token);
resource->read_lock_fences_enabled = it->read_lock_fences_enabled;
resource->is_overlay_candidate = it->is_overlay_candidate;
}
@@ -1258,14 +1261,16 @@ void ResourceProvider::ReceiveReturnsFromParent(
if (resource->exported_count)
continue;
- if (returned.sync_point) {
+ if (returned.sync_point || returned.sync_token.HasData()) {
DCHECK(!resource->has_shared_bitmap_id);
if (resource->origin == Resource::INTERNAL) {
DCHECK(resource->gl_id);
- gl->WaitSyncPointCHROMIUM(returned.sync_point);
+ gl->WaitSyncPointCHROMIUM(returned.sync_point,
+ returned.sync_token.GetConstData());
} else {
DCHECK(!resource->gl_id);
- resource->mailbox.set_sync_point(returned.sync_point);
+ resource->mailbox.set_sync_point(returned.sync_point,
+ returned.sync_token);
}
}
@@ -1338,7 +1343,8 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
resource->mailbox_holder.mailbox = source->mailbox.mailbox();
resource->mailbox_holder.texture_target = source->mailbox.target();
resource->mailbox_holder.sync_point = source->mailbox.sync_point();
- source->mailbox.set_sync_point(0);
+ resource->mailbox_holder.sync_token = source->mailbox.sync_token();
+ source->mailbox.set_sync_point(0, gpu::SyncToken());
}
}
@@ -1407,8 +1413,10 @@ void ResourceProvider::DeleteAndReturnUnusedResourcesToChild(
ReturnedResource returned;
returned.id = child_id;
returned.sync_point = resource.mailbox.sync_point();
- if (!returned.sync_point && resource.type == RESOURCE_TYPE_GL_TEXTURE)
- need_sync_point = true;
+ returned.sync_token = resource.mailbox.sync_token();
+ need_sync_point |=
+ (!returned.sync_point && !returned.sync_token.HasData() &&
+ resource.type == RESOURCE_TYPE_GL_TEXTURE);
returned.count = resource.imported_count;
returned.lost = is_lost;
to_return.push_back(returned);
@@ -1553,13 +1561,15 @@ void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) {
DCHECK(resource->allocated);
if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id)
return;
- if (!resource->mailbox.sync_point())
- return;
- DCHECK(resource->mailbox.IsValid());
- GLES2Interface* gl = ContextGL();
- DCHECK(gl);
- gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point());
- resource->mailbox.set_sync_point(0);
+ if (resource->mailbox.sync_point() ||
+ resource->mailbox.sync_token().HasData()) {
+ DCHECK(resource->mailbox.IsValid());
+ GLES2Interface* gl = ContextGL();
+ DCHECK(gl);
+ gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point(),
+ resource->mailbox.sync_token().GetConstData());
+ resource->mailbox.set_sync_point(0, gpu::SyncToken());
+ }
}
GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) {

Powered by Google App Engine
This is Rietveld 408576698