| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/gles2/command_buffer_client_impl.h" | 5 #include "mojo/gles2/command_buffer_client_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 CommandBufferDelegate::~CommandBufferDelegate() {} | 47 CommandBufferDelegate::~CommandBufferDelegate() {} |
| 48 | 48 |
| 49 void CommandBufferDelegate::ContextLost() {} | 49 void CommandBufferDelegate::ContextLost() {} |
| 50 | 50 |
| 51 class CommandBufferClientImpl::SyncClientImpl | 51 class CommandBufferClientImpl::SyncClientImpl |
| 52 : public mus::mojom::CommandBufferSyncClient { | 52 : public mus::mojom::CommandBufferSyncClient { |
| 53 public: | 53 public: |
| 54 SyncClientImpl(mus::mojom::CommandBufferSyncClientPtr* ptr, | 54 SyncClientImpl(mus::mojom::CommandBufferSyncClientPtr* ptr, |
| 55 const MojoAsyncWaiter* async_waiter) | 55 const MojoAsyncWaiter* async_waiter) |
| 56 : initialized_successfully_(false), binding_(this, ptr, async_waiter) {} | 56 : initialized_successfully_(false), |
| 57 command_buffer_id_(0), |
| 58 binding_(this, ptr, async_waiter) {} |
| 57 | 59 |
| 58 bool WaitForInitialization() { | 60 bool WaitForInitialization() { |
| 59 if (!binding_.WaitForIncomingMethodCall()) | 61 if (!binding_.WaitForIncomingMethodCall()) |
| 60 return false; | 62 return false; |
| 61 return initialized_successfully_; | 63 return initialized_successfully_; |
| 62 } | 64 } |
| 63 | 65 |
| 64 mus::mojom::CommandBufferStatePtr WaitForProgress() { | 66 mus::mojom::CommandBufferStatePtr WaitForProgress() { |
| 65 if (!binding_.WaitForIncomingMethodCall()) | 67 if (!binding_.WaitForIncomingMethodCall()) |
| 66 return mus::mojom::CommandBufferStatePtr(); | 68 return mus::mojom::CommandBufferStatePtr(); |
| 67 return command_buffer_state_.Pass(); | 69 return command_buffer_state_.Pass(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 gpu::Capabilities GetCapabilities() { | 72 gpu::Capabilities GetCapabilities() { |
| 71 if (capabilities_) | 73 if (capabilities_) |
| 72 return capabilities_.To<gpu::Capabilities>(); | 74 return capabilities_.To<gpu::Capabilities>(); |
| 73 return gpu::Capabilities(); | 75 return gpu::Capabilities(); |
| 74 } | 76 } |
| 75 | 77 |
| 78 uint64_t GetCommandBufferID() const { |
| 79 return command_buffer_id_; |
| 80 } |
| 81 |
| 76 private: | 82 private: |
| 77 // CommandBufferSyncClient methods: | 83 // CommandBufferSyncClient methods: |
| 78 void DidInitialize(bool success, | 84 void DidInitialize(bool success, |
| 85 int32_t command_buffer_namespace, |
| 86 uint64_t command_buffer_id, |
| 79 mus::mojom::GpuCapabilitiesPtr capabilities) override { | 87 mus::mojom::GpuCapabilitiesPtr capabilities) override { |
| 88 CHECK_EQ(command_buffer_namespace, gpu::CommandBufferNamespace::MOJO); |
| 80 initialized_successfully_ = success; | 89 initialized_successfully_ = success; |
| 90 command_buffer_id_ = command_buffer_id; |
| 81 capabilities_ = capabilities.Pass(); | 91 capabilities_ = capabilities.Pass(); |
| 82 } | 92 } |
| 83 void DidMakeProgress(mus::mojom::CommandBufferStatePtr state) override { | 93 void DidMakeProgress(mus::mojom::CommandBufferStatePtr state) override { |
| 84 command_buffer_state_ = state.Pass(); | 94 command_buffer_state_ = state.Pass(); |
| 85 } | 95 } |
| 86 | 96 |
| 87 bool initialized_successfully_; | 97 bool initialized_successfully_; |
| 98 uint64_t command_buffer_id_; |
| 88 mus::mojom::GpuCapabilitiesPtr capabilities_; | 99 mus::mojom::GpuCapabilitiesPtr capabilities_; |
| 89 mus::mojom::CommandBufferStatePtr command_buffer_state_; | 100 mus::mojom::CommandBufferStatePtr command_buffer_state_; |
| 90 mojo::Binding<mus::mojom::CommandBufferSyncClient> binding_; | 101 mojo::Binding<mus::mojom::CommandBufferSyncClient> binding_; |
| 91 | 102 |
| 92 DISALLOW_COPY_AND_ASSIGN(SyncClientImpl); | 103 DISALLOW_COPY_AND_ASSIGN(SyncClientImpl); |
| 93 }; | 104 }; |
| 94 | 105 |
| 95 class CommandBufferClientImpl::SyncPointClientImpl | 106 class CommandBufferClientImpl::SyncPointClientImpl |
| 96 : public mus::mojom::CommandBufferSyncPointClient { | 107 : public mus::mojom::CommandBufferSyncPointClient { |
| 97 public: | 108 public: |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 bool CommandBufferClientImpl::IsGpuChannelLost() { | 407 bool CommandBufferClientImpl::IsGpuChannelLost() { |
| 397 // This is only possible for out-of-process command buffers. | 408 // This is only possible for out-of-process command buffers. |
| 398 return false; | 409 return false; |
| 399 } | 410 } |
| 400 | 411 |
| 401 gpu::CommandBufferNamespace CommandBufferClientImpl::GetNamespaceID() const { | 412 gpu::CommandBufferNamespace CommandBufferClientImpl::GetNamespaceID() const { |
| 402 return gpu::CommandBufferNamespace::MOJO; | 413 return gpu::CommandBufferNamespace::MOJO; |
| 403 } | 414 } |
| 404 | 415 |
| 405 uint64_t CommandBufferClientImpl::GetCommandBufferID() const { | 416 uint64_t CommandBufferClientImpl::GetCommandBufferID() const { |
| 406 // TODO (rjkroege): This must correspond to the command buffer ID on the | 417 return sync_client_impl_->GetCommandBufferID(); |
| 407 // server side. Most likely a combination of the client-specific integer and | |
| 408 // the connect id. | |
| 409 NOTIMPLEMENTED(); | |
| 410 return 0; | |
| 411 } | 418 } |
| 412 | 419 |
| 413 uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() { | 420 uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() { |
| 414 return next_fence_sync_release_++; | 421 return next_fence_sync_release_++; |
| 415 } | 422 } |
| 416 | 423 |
| 417 bool CommandBufferClientImpl::IsFenceSyncRelease(uint64_t release) { | 424 bool CommandBufferClientImpl::IsFenceSyncRelease(uint64_t release) { |
| 418 return release != 0 && release < next_fence_sync_release_; | 425 return release != 0 && release < next_fence_sync_release_; |
| 419 } | 426 } |
| 420 | 427 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 431 // TODO(dyen) | 438 // TODO(dyen) |
| 432 } | 439 } |
| 433 | 440 |
| 434 bool CommandBufferClientImpl::CanWaitUnverifiedSyncToken( | 441 bool CommandBufferClientImpl::CanWaitUnverifiedSyncToken( |
| 435 const gpu::SyncToken* sync_token) { | 442 const gpu::SyncToken* sync_token) { |
| 436 // All sync tokens must be flushed before being waited on. | 443 // All sync tokens must be flushed before being waited on. |
| 437 return false; | 444 return false; |
| 438 } | 445 } |
| 439 | 446 |
| 440 } // namespace gles2 | 447 } // namespace gles2 |
| OLD | NEW |