| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 538 |
| 539 void CommandBufferProxyImpl::DestroyImage(int32_t id) { | 539 void CommandBufferProxyImpl::DestroyImage(int32_t id) { |
| 540 CheckLock(); | 540 CheckLock(); |
| 541 base::AutoLock lock(last_state_lock_); | 541 base::AutoLock lock(last_state_lock_); |
| 542 if (last_state_.error != gpu::error::kNoError) | 542 if (last_state_.error != gpu::error::kNoError) |
| 543 return; | 543 return; |
| 544 | 544 |
| 545 Send(new GpuCommandBufferMsg_DestroyImage(route_id_, id)); | 545 Send(new GpuCommandBufferMsg_DestroyImage(route_id_, id)); |
| 546 } | 546 } |
| 547 | 547 |
| 548 int32_t CommandBufferProxyImpl::CreateGpuMemoryBufferImage( | |
| 549 size_t width, | |
| 550 size_t height, | |
| 551 unsigned internal_format, | |
| 552 unsigned usage) { | |
| 553 CheckLock(); | |
| 554 std::unique_ptr<gfx::GpuMemoryBuffer> buffer( | |
| 555 channel_->gpu_memory_buffer_manager()->CreateGpuMemoryBuffer( | |
| 556 gfx::Size(width, height), | |
| 557 gpu::DefaultBufferFormatForImageFormat(internal_format), | |
| 558 gfx::BufferUsage::SCANOUT, gpu::kNullSurfaceHandle)); | |
| 559 if (!buffer) | |
| 560 return -1; | |
| 561 | |
| 562 int32_t result = | |
| 563 CreateImage(buffer->AsClientBuffer(), width, height, internal_format); | |
| 564 return result; | |
| 565 } | |
| 566 | |
| 567 uint32_t CommandBufferProxyImpl::CreateStreamTexture(uint32_t texture_id) { | 548 uint32_t CommandBufferProxyImpl::CreateStreamTexture(uint32_t texture_id) { |
| 568 CheckLock(); | 549 CheckLock(); |
| 569 base::AutoLock lock(last_state_lock_); | 550 base::AutoLock lock(last_state_lock_); |
| 570 if (last_state_.error != gpu::error::kNoError) | 551 if (last_state_.error != gpu::error::kNoError) |
| 571 return 0; | 552 return 0; |
| 572 | 553 |
| 573 int32_t stream_id = channel_->GenerateRouteID(); | 554 int32_t stream_id = channel_->GenerateRouteID(); |
| 574 bool succeeded = false; | 555 bool succeeded = false; |
| 575 Send(new GpuCommandBufferMsg_CreateStreamTexture(route_id_, texture_id, | 556 Send(new GpuCommandBufferMsg_CreateStreamTexture(route_id_, texture_id, |
| 576 stream_id, &succeeded)); | 557 stream_id, &succeeded)); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 return; | 927 return; |
| 947 channel_->FlushPendingStream(stream_id_); | 928 channel_->FlushPendingStream(stream_id_); |
| 948 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_)); | 929 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_)); |
| 949 channel_->RemoveRoute(route_id_); | 930 channel_->RemoveRoute(route_id_); |
| 950 channel_ = nullptr; | 931 channel_ = nullptr; |
| 951 if (gpu_control_client_) | 932 if (gpu_control_client_) |
| 952 gpu_control_client_->OnGpuControlLostContext(); | 933 gpu_control_client_->OnGpuControlLostContext(); |
| 953 } | 934 } |
| 954 | 935 |
| 955 } // namespace gpu | 936 } // namespace gpu |
| OLD | NEW |