| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( | 462 channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( |
| 463 gfx::Size(width, height), | 463 gfx::Size(width, height), |
| 464 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), | 464 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), |
| 465 gfx::BufferUsage::SCANOUT)); | 465 gfx::BufferUsage::SCANOUT)); |
| 466 if (!buffer) | 466 if (!buffer) |
| 467 return -1; | 467 return -1; |
| 468 | 468 |
| 469 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); | 469 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); |
| 470 } | 470 } |
| 471 | 471 |
| 472 uint32 CommandBufferProxyImpl::CreateStreamTexture(uint32 texture_id) { | 472 int32 CommandBufferProxyImpl::CreateStreamTexture(uint32 texture_id) { |
| 473 CheckLock(); | 473 CheckLock(); |
| 474 if (last_state_.error != gpu::error::kNoError) | 474 if (last_state_.error != gpu::error::kNoError) |
| 475 return 0; | 475 return 0; |
| 476 | 476 |
| 477 int32 stream_id = channel_->GenerateRouteID(); | 477 int32 stream_id = channel_->GenerateRouteID(); |
| 478 bool succeeded = false; | 478 bool succeeded = false; |
| 479 Send(new GpuCommandBufferMsg_CreateStreamTexture( | 479 Send(new GpuCommandBufferMsg_CreateStreamTexture( |
| 480 route_id_, texture_id, stream_id, &succeeded)); | 480 route_id_, texture_id, stream_id, &succeeded)); |
| 481 if (!succeeded) { | 481 if (!succeeded) { |
| 482 DLOG(ERROR) << "GpuCommandBufferMsg_CreateStreamTexture returned failure"; | 482 DLOG(ERROR) << "GpuCommandBufferMsg_CreateStreamTexture returned failure"; |
| 483 return 0; | 483 return 0; |
| 484 } | 484 } |
| 485 return stream_id; | 485 return stream_id; |
| 486 } | 486 } |
| 487 | 487 |
| 488 void CommandBufferProxyImpl::SetStreamTextureSize(uint32 texture_id, |
| 489 int32 stream_id, |
| 490 size_t width, |
| 491 size_t height) { |
| 492 CheckLock(); |
| 493 if (last_state_.error != gpu::error::kNoError) |
| 494 return; |
| 495 |
| 496 Send(new GpuCommandBufferMsg_SetStreamTextureSize(route_id_, texture_id, |
| 497 stream_id, width, height)); |
| 498 } |
| 499 |
| 488 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { | 500 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { |
| 489 lock_ = lock; | 501 lock_ = lock; |
| 490 } | 502 } |
| 491 | 503 |
| 492 bool CommandBufferProxyImpl::IsGpuChannelLost() { | 504 bool CommandBufferProxyImpl::IsGpuChannelLost() { |
| 493 return !channel_ || channel_->IsLost(); | 505 return !channel_ || channel_->IsLost(); |
| 494 } | 506 } |
| 495 | 507 |
| 496 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const { | 508 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const { |
| 497 return gpu::CommandBufferNamespace::GPU_IO; | 509 return gpu::CommandBufferNamespace::GPU_IO; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 } | 750 } |
| 739 } | 751 } |
| 740 | 752 |
| 741 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, | 753 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 742 base::TimeDelta interval) { | 754 base::TimeDelta interval) { |
| 743 if (!update_vsync_parameters_completion_callback_.is_null()) | 755 if (!update_vsync_parameters_completion_callback_.is_null()) |
| 744 update_vsync_parameters_completion_callback_.Run(timebase, interval); | 756 update_vsync_parameters_completion_callback_.Run(timebase, interval); |
| 745 } | 757 } |
| 746 | 758 |
| 747 } // namespace content | 759 } // namespace content |
| OLD | NEW |