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 "content/common/gpu/client/command_buffer_proxy_impl.h" | 5 #include "content/common/gpu/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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 params.image_release_count = image_fence_sync; | 448 params.image_release_count = image_fence_sync; |
449 | 449 |
450 if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, params))) | 450 if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, params))) |
451 return -1; | 451 return -1; |
452 | 452 |
453 if (image_fence_sync) { | 453 if (image_fence_sync) { |
454 gpu::SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), | 454 gpu::SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), |
455 GetCommandBufferID(), image_fence_sync); | 455 GetCommandBufferID(), image_fence_sync); |
456 | 456 |
457 // Force a synchronous IPC to validate sync token. | 457 // Force a synchronous IPC to validate sync token. |
458 channel_->ValidateFlushIDReachedServer(stream_id_, true); | 458 EnsureWorkVisible(); |
459 sync_token.SetVerifyFlush(); | 459 sync_token.SetVerifyFlush(); |
460 | 460 |
461 gpu_memory_buffer_manager->SetDestructionSyncToken(gpu_memory_buffer, | 461 gpu_memory_buffer_manager->SetDestructionSyncToken(gpu_memory_buffer, |
462 sync_token); | 462 sync_token); |
463 } | 463 } |
464 | 464 |
465 return new_id; | 465 return new_id; |
466 } | 466 } |
467 | 467 |
468 void CommandBufferProxyImpl::DestroyImage(int32_t id) { | 468 void CommandBufferProxyImpl::DestroyImage(int32_t id) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 } | 507 } |
508 | 508 |
509 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { | 509 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { |
510 lock_ = lock; | 510 lock_ = lock; |
511 } | 511 } |
512 | 512 |
513 bool CommandBufferProxyImpl::IsGpuChannelLost() { | 513 bool CommandBufferProxyImpl::IsGpuChannelLost() { |
514 return !channel_ || channel_->IsLost(); | 514 return !channel_ || channel_->IsLost(); |
515 } | 515 } |
516 | 516 |
| 517 void CommandBufferProxyImpl::EnsureWorkVisible() { |
| 518 channel_->ValidateFlushIDReachedServer(stream_id_, true); |
| 519 } |
| 520 |
517 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const { | 521 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const { |
518 return gpu::CommandBufferNamespace::GPU_IO; | 522 return gpu::CommandBufferNamespace::GPU_IO; |
519 } | 523 } |
520 | 524 |
521 uint64_t CommandBufferProxyImpl::GetCommandBufferID() const { | 525 uint64_t CommandBufferProxyImpl::GetCommandBufferID() const { |
522 return command_buffer_id_; | 526 return command_buffer_id_; |
523 } | 527 } |
524 | 528 |
525 int32_t CommandBufferProxyImpl::GetExtraCommandBufferData() const { | 529 int32_t CommandBufferProxyImpl::GetExtraCommandBufferData() const { |
526 return stream_id_; | 530 return stream_id_; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 } | 772 } |
769 } | 773 } |
770 | 774 |
771 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, | 775 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, |
772 base::TimeDelta interval) { | 776 base::TimeDelta interval) { |
773 if (!update_vsync_parameters_completion_callback_.is_null()) | 777 if (!update_vsync_parameters_completion_callback_.is_null()) |
774 update_vsync_parameters_completion_callback_.Run(timebase, interval); | 778 update_vsync_parameters_completion_callback_.Run(timebase, interval); |
775 } | 779 } |
776 | 780 |
777 } // namespace content | 781 } // namespace content |
OLD | NEW |