| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/ipc/client/command_buffer_proxy_impl.h" | 5 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 bool requires_sync_token = false; | 420 bool requires_sync_token = false; |
| 421 gfx::GpuMemoryBufferHandle handle = | 421 gfx::GpuMemoryBufferHandle handle = |
| 422 channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(), | 422 channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(), |
| 423 &requires_sync_token); | 423 &requires_sync_token); |
| 424 | 424 |
| 425 uint64_t image_fence_sync = 0; | 425 uint64_t image_fence_sync = 0; |
| 426 if (requires_sync_token) { | 426 if (requires_sync_token) { |
| 427 image_fence_sync = GenerateFenceSyncRelease(); | 427 image_fence_sync = GenerateFenceSyncRelease(); |
| 428 | 428 |
| 429 // Make sure fence syncs were flushed before CreateImage() was called. | 429 // Make sure fence syncs were flushed before CreateImage() was called. |
| 430 DCHECK_LE(image_fence_sync - 1, flushed_fence_sync_release_); | 430 DCHECK_EQ(image_fence_sync, flushed_fence_sync_release_ + 1); |
| 431 } | 431 } |
| 432 | 432 |
| 433 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(), | 433 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(), |
| 434 capabilities_)); | 434 capabilities_)); |
| 435 DCHECK(gpu::IsImageSizeValidForGpuMemoryBufferFormat( | 435 DCHECK(gpu::IsImageSizeValidForGpuMemoryBufferFormat( |
| 436 gfx::Size(width, height), gpu_memory_buffer->GetFormat())); | 436 gfx::Size(width, height), gpu_memory_buffer->GetFormat())); |
| 437 DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat( | 437 DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
| 438 internal_format, gpu_memory_buffer->GetFormat())); | 438 internal_format, gpu_memory_buffer->GetFormat())); |
| 439 | 439 |
| 440 GpuCommandBufferMsg_CreateImage_Params params; | 440 GpuCommandBufferMsg_CreateImage_Params params; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 gpu::CommandBufferId CommandBufferProxyImpl::GetCommandBufferID() const { | 523 gpu::CommandBufferId CommandBufferProxyImpl::GetCommandBufferID() const { |
| 524 return command_buffer_id_; | 524 return command_buffer_id_; |
| 525 } | 525 } |
| 526 | 526 |
| 527 int32_t CommandBufferProxyImpl::GetExtraCommandBufferData() const { | 527 int32_t CommandBufferProxyImpl::GetExtraCommandBufferData() const { |
| 528 return stream_id_; | 528 return stream_id_; |
| 529 } | 529 } |
| 530 | 530 |
| 531 uint64_t CommandBufferProxyImpl::GenerateFenceSyncRelease() { | 531 uint64_t CommandBufferProxyImpl::GenerateFenceSyncRelease() { |
| 532 CheckLock(); |
| 532 return next_fence_sync_release_++; | 533 return next_fence_sync_release_++; |
| 533 } | 534 } |
| 534 | 535 |
| 535 bool CommandBufferProxyImpl::IsFenceSyncRelease(uint64_t release) { | 536 bool CommandBufferProxyImpl::IsFenceSyncRelease(uint64_t release) { |
| 537 CheckLock(); |
| 536 return release != 0 && release < next_fence_sync_release_; | 538 return release != 0 && release < next_fence_sync_release_; |
| 537 } | 539 } |
| 538 | 540 |
| 539 bool CommandBufferProxyImpl::IsFenceSyncFlushed(uint64_t release) { | 541 bool CommandBufferProxyImpl::IsFenceSyncFlushed(uint64_t release) { |
| 542 CheckLock(); |
| 540 return release != 0 && release <= flushed_fence_sync_release_; | 543 return release != 0 && release <= flushed_fence_sync_release_; |
| 541 } | 544 } |
| 542 | 545 |
| 543 bool CommandBufferProxyImpl::IsFenceSyncFlushReceived(uint64_t release) { | 546 bool CommandBufferProxyImpl::IsFenceSyncFlushReceived(uint64_t release) { |
| 544 CheckLock(); | 547 CheckLock(); |
| 545 if (last_state_.error != gpu::error::kNoError) | 548 if (last_state_.error != gpu::error::kNoError) |
| 546 return false; | 549 return false; |
| 547 | 550 |
| 548 if (release <= verified_fence_sync_release_) | 551 if (release <= verified_fence_sync_release_) |
| 549 return true; | 552 return true; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 } | 723 } |
| 721 | 724 |
| 722 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { | 725 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { |
| 723 std::unique_ptr<base::AutoLock> lock; | 726 std::unique_ptr<base::AutoLock> lock; |
| 724 if (lock_) | 727 if (lock_) |
| 725 lock.reset(new base::AutoLock(*lock_)); | 728 lock.reset(new base::AutoLock(*lock_)); |
| 726 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); | 729 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); |
| 727 } | 730 } |
| 728 | 731 |
| 729 } // namespace gpu | 732 } // namespace gpu |
| OLD | NEW |