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

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: Created 5 years, 1 month 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 | 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 506d1d97954cd14f49c1a8422c5987a6519288c3..3b2c0cd79b5ac05008e08b76a1f7fbd6cc9d1080 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -1135,26 +1135,35 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
TransferableResourceArray* list) {
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) {
TransferableResource resource;
TransferResource(gl, *it, &resource);
- need_sync_token |= (!resource.mailbox_holder.sync_token.HasData() &&
- !resource.is_software);
+ if (!resource.is_software &&
+ !resource.mailbox_holder.sync_token.HasData()) {
+ if (!new_sync_token.HasData()) {
+ const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
+ gl->OrderingBarrierCHROMIUM();
+ GenUnverifiedSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData());
+ unverified_sync_tokens.push_back(new_sync_token.GetData());
piman 2015/11/26 02:32:44 Actually, the VerifySyncTokensCHROMIUM below will
David Yen 2015/12/08 00:57:56 Done.
+ }
+ resource.mailbox_holder.sync_token = new_sync_token;
+ } else if (!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());
- for (TransferableResourceArray::iterator it = list->begin();
- it != list->end();
- ++it) {
- if (!it->mailbox_holder.sync_token.HasData())
- it->mailbox_holder.sync_token = sync_token;
- }
+
+ if (!unverified_sync_tokens.empty()) {
+ gl->VerifySyncTokensCHROMIUM(unverified_sync_tokens.data(),
+ unverified_sync_tokens.size());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698