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

Unified Diff: cc/resources/resource_provider.cc

Issue 1479673003: Verify resource provider sync tokens before sending to parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test so it doesn't expect dummy fence sync Created 4 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 | « no previous file | cc/resources/resource_provider_unittest.cc » ('j') | 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 c6e5c915d161a24cb33e303ea2291b8023a2a35a..f1a4cf2e0d37f413298158a4566a18edc41a2704 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -1140,6 +1140,9 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
DCHECK(thread_checker_.CalledOnValidThread());
GLES2Interface* gl = ContextGL();
bool need_sync_token = false;
+
+ gpu::SyncToken new_sync_token;
+ std::vector<GLbyte*> unverified_sync_tokens;
for (ResourceIdArray::const_iterator it = resources.begin();
it != resources.end();
++it) {
@@ -1147,17 +1150,36 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
TransferResource(gl, *it, &resource);
need_sync_token |= (!resource.mailbox_holder.sync_token.HasData() &&
!resource.is_software);
+
+ if (resource.mailbox_holder.sync_token.HasData() &&
+ !resource.mailbox_holder.sync_token.verified_flush()) {
+ unverified_sync_tokens.push_back(
+ resource.mailbox_holder.sync_token.GetData());
+ }
+
++resources_.find(*it)->second.exported_count;
list->push_back(resource);
}
+
if (need_sync_token &&
output_surface_->capabilities().delegated_sync_points_required) {
- gpu::SyncToken sync_token(gl->InsertSyncPointCHROMIUM());
+ const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
+ gl->OrderingBarrierCHROMIUM();
+ gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData());
+ unverified_sync_tokens.push_back(new_sync_token.GetData());
+ }
+
+ if (!unverified_sync_tokens.empty()) {
+ gl->VerifySyncTokensCHROMIUM(unverified_sync_tokens.data(),
+ unverified_sync_tokens.size());
+ }
+
+ if (new_sync_token.HasData()) {
for (TransferableResourceArray::iterator it = list->begin();
it != list->end();
++it) {
if (!it->mailbox_holder.sync_token.HasData())
- it->mailbox_holder.sync_token = sync_token;
+ it->mailbox_holder.sync_token = new_sync_token;
}
}
}
« no previous file with comments | « no previous file | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698