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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2727573003: gpu: Add sync token dependencies to flush metadata. (Closed)
Patch Set: use verified sync token Created 3 years, 10 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: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 8b272ded6592b8d749c78945809964b34fe39c6a..c98bb6d4bbe6ba06fd212f5d117b2e6231902bc8 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -378,19 +378,15 @@ void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token,
const base::Closure& callback) {
if (sync_token.HasData() &&
(sync_token.verified_flush() ||
- gpu_control_->CanWaitUnverifiedSyncToken(&sync_token))) {
-
- gpu::SyncToken intermediate_sync_token = sync_token;
-
- // Mark the intermediate sync token as verified if we can wait on
- // unverified sync tokens.
- intermediate_sync_token.SetVerifyFlush();
+ gpu_control_->CanWaitUnverifiedSyncToken(sync_token))) {
+ // We can only send verified sync tokens across IPC.
+ gpu::SyncToken verified_sync_token = sync_token;
+ verified_sync_token.SetVerifyFlush();
gpu_control_->SignalSyncToken(
- intermediate_sync_token,
+ verified_sync_token,
base::Bind(&GLES2Implementation::RunIfContextNotLost,
- weak_ptr_factory_.GetWeakPtr(),
- callback));
+ weak_ptr_factory_.GetWeakPtr(), callback));
} else {
// Invalid sync token, just call the callback immediately.
callback.Run();
@@ -399,7 +395,7 @@ void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token,
// This may be called from any thread. It's safe to access gpu_control_ without
// the lock because it is const.
-bool GLES2Implementation::IsSyncTokenSignalled(
+bool GLES2Implementation::IsSyncTokenSignaled(
const gpu::SyncToken& sync_token) {
// Check that the sync token belongs to this context.
DCHECK_EQ(gpu_control_->GetNamespaceID(), sync_token.namespace_id());
@@ -6115,7 +6111,7 @@ void GLES2Implementation::VerifySyncTokensCHROMIUM(GLbyte **sync_tokens,
memcpy(&sync_token, sync_tokens[i], sizeof(sync_token));
if (sync_token.HasData() && !sync_token.verified_flush()) {
- if (!gpu_control_->CanWaitUnverifiedSyncToken(&sync_token)) {
+ if (!gpu_control_->CanWaitUnverifiedSyncToken(sync_token)) {
SetGLError(GL_INVALID_VALUE, "glVerifySyncTokensCHROMIUM",
"Cannot verify sync token using this context.");
return;
@@ -6149,25 +6145,30 @@ void GLES2Implementation::VerifySyncTokensCHROMIUM(GLbyte **sync_tokens,
}
}
-void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
- if (sync_token) {
- // Copy the data over before data access to ensure alignment.
- SyncToken sync_token_data;
- memcpy(&sync_token_data, sync_token, sizeof(SyncToken));
- if (sync_token_data.HasData()) {
- if (!sync_token_data.verified_flush() &&
- !gpu_control_->CanWaitUnverifiedSyncToken(&sync_token_data)) {
- SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM",
- "Cannot wait on sync_token which has not been verified");
- return;
- }
+void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token_data) {
+ if (!sync_token_data)
+ return;
- helper_->WaitSyncTokenCHROMIUM(
- static_cast<GLint>(sync_token_data.namespace_id()),
- sync_token_data.command_buffer_id().GetUnsafeValue(),
- sync_token_data.release_count());
- }
+ // Copy the data over before data access to ensure alignment.
+ SyncToken sync_token;
+ memcpy(&sync_token, sync_token_data, sizeof(SyncToken));
+
+ if (!sync_token.HasData())
+ return;
+
+ if (!sync_token.verified_flush() &&
+ !gpu_control_->CanWaitUnverifiedSyncToken(sync_token)) {
+ SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM",
+ "Cannot wait on sync_token which has not been verified");
+ return;
}
+
+ gpu_control_->WaitSyncToken(sync_token);
jbauman 2017/03/09 02:00:09 I think this should actually go after the call to
sunnyps 2017/03/10 03:26:20 Nice catch!
+
+ helper_->WaitSyncTokenCHROMIUM(
+ static_cast<GLint>(sync_token.namespace_id()),
+ sync_token.command_buffer_id().GetUnsafeValue(),
+ sync_token.release_count());
}
namespace {

Powered by Google App Engine
This is Rietveld 408576698