| Index: mojo/gles2/command_buffer_client_impl.cc
|
| diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc
|
| index e2191235abbdb752af985fbe45129840dd56b529..b9aa5028b298edf6538734fb148a33d2ac5fb533 100644
|
| --- a/mojo/gles2/command_buffer_client_impl.cc
|
| +++ b/mojo/gles2/command_buffer_client_impl.cc
|
| @@ -12,6 +12,7 @@
|
| #include "components/mus/gles2/command_buffer_type_conversions.h"
|
| #include "components/mus/gles2/mojo_buffer_backing.h"
|
| #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
|
| +#include "gpu/command_buffer/common/sync_token.h"
|
| #include "gpu/command_buffer/service/image_factory.h"
|
| #include "mojo/platform_handle/platform_handle_functions.h"
|
|
|
| @@ -53,7 +54,9 @@ class CommandBufferClientImpl::SyncClientImpl
|
| public:
|
| SyncClientImpl(mus::mojom::CommandBufferSyncClientPtr* ptr,
|
| const MojoAsyncWaiter* async_waiter)
|
| - : initialized_successfully_(false), binding_(this, ptr, async_waiter) {}
|
| + : initialized_successfully_(false),
|
| + command_buffer_id_(0),
|
| + binding_(this, ptr, async_waiter) {}
|
|
|
| bool WaitForInitialization() {
|
| base::ThreadRestrictions::ScopedAllowWait wait;
|
| @@ -75,11 +78,19 @@ class CommandBufferClientImpl::SyncClientImpl
|
| return gpu::Capabilities();
|
| }
|
|
|
| + uint64_t GetCommandBufferID() const {
|
| + return command_buffer_id_;
|
| + }
|
| +
|
| private:
|
| // CommandBufferSyncClient methods:
|
| void DidInitialize(bool success,
|
| + int32_t command_buffer_namespace,
|
| + uint64_t command_buffer_id,
|
| mus::mojom::GpuCapabilitiesPtr capabilities) override {
|
| + DCHECK_EQ(command_buffer_namespace, gpu::CommandBufferNamespace::MOJO);
|
| initialized_successfully_ = success;
|
| + command_buffer_id_ = command_buffer_id;
|
| capabilities_ = capabilities.Pass();
|
| }
|
| void DidMakeProgress(mus::mojom::CommandBufferStatePtr state) override {
|
| @@ -87,6 +98,7 @@ class CommandBufferClientImpl::SyncClientImpl
|
| }
|
|
|
| bool initialized_successfully_;
|
| + uint64_t command_buffer_id_;
|
| mus::mojom::GpuCapabilitiesPtr capabilities_;
|
| mus::mojom::CommandBufferStatePtr command_buffer_state_;
|
| mojo::Binding<mus::mojom::CommandBufferSyncClient> binding_;
|
| @@ -403,11 +415,7 @@ gpu::CommandBufferNamespace CommandBufferClientImpl::GetNamespaceID() const {
|
| }
|
|
|
| uint64_t CommandBufferClientImpl::GetCommandBufferID() const {
|
| - // TODO (rjkroege): This must correspond to the command buffer ID on the
|
| - // server side. Most likely a combination of the client-specific integer and
|
| - // the connect id.
|
| - NOTIMPLEMENTED();
|
| - return 0;
|
| + return sync_client_impl_->GetCommandBufferID();
|
| }
|
|
|
| uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() {
|
| @@ -433,7 +441,16 @@ void CommandBufferClientImpl::SignalSyncToken(const gpu::SyncToken& sync_token,
|
|
|
| bool CommandBufferClientImpl::CanWaitUnverifiedSyncToken(
|
| const gpu::SyncToken* sync_token) {
|
| - // All sync tokens must be flushed before being waited on.
|
| + // Right now, MOJO_LOCAL is only used by trusted code, so it is safe to wait
|
| + // on a sync token in MOJO_LOCAL command buffer.
|
| + if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO_LOCAL)
|
| + return true;
|
| +
|
| + // It is also safe to wait on the same context.
|
| + if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO &&
|
| + sync_token->command_buffer_id() == GetCommandBufferID())
|
| + return true;
|
| +
|
| return false;
|
| }
|
|
|
|
|