| 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 455 |
| 456 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = | 456 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = |
| 457 channel_->gpu_memory_buffer_manager(); | 457 channel_->gpu_memory_buffer_manager(); |
| 458 gfx::GpuMemoryBuffer* gpu_memory_buffer = | 458 gfx::GpuMemoryBuffer* gpu_memory_buffer = |
| 459 reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer); | 459 reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer); |
| 460 DCHECK(gpu_memory_buffer); | 460 DCHECK(gpu_memory_buffer); |
| 461 | 461 |
| 462 // This handle is owned by the GPU process and must be passed to it or it | 462 // This handle is owned by the GPU process and must be passed to it or it |
| 463 // will leak. In otherwords, do not early out on error between here and the | 463 // will leak. In otherwords, do not early out on error between here and the |
| 464 // sending of the CreateImage IPC below. | 464 // sending of the CreateImage IPC below. |
| 465 bool requires_sync_token = false; | |
| 466 gfx::GpuMemoryBufferHandle handle = | 465 gfx::GpuMemoryBufferHandle handle = |
| 467 channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(), | 466 gfx::CloneHandleForIPC(gpu_memory_buffer->GetHandle()); |
| 468 &requires_sync_token); | 467 bool requires_sync_token = handle.type == gfx::IO_SURFACE_BUFFER; |
| 469 | 468 |
| 470 uint64_t image_fence_sync = 0; | 469 uint64_t image_fence_sync = 0; |
| 471 if (requires_sync_token) { | 470 if (requires_sync_token) { |
| 472 image_fence_sync = GenerateFenceSyncRelease(); | 471 image_fence_sync = GenerateFenceSyncRelease(); |
| 473 | 472 |
| 474 // Make sure fence syncs were flushed before CreateImage() was called. | 473 // Make sure fence syncs were flushed before CreateImage() was called. |
| 475 DCHECK_EQ(image_fence_sync, flushed_fence_sync_release_ + 1); | 474 DCHECK_EQ(image_fence_sync, flushed_fence_sync_release_ + 1); |
| 476 } | 475 } |
| 477 | 476 |
| 478 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(), | 477 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(), |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 return; | 865 return; |
| 867 channel_->FlushPendingStream(stream_id_); | 866 channel_->FlushPendingStream(stream_id_); |
| 868 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_)); | 867 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_)); |
| 869 channel_->RemoveRoute(route_id_); | 868 channel_->RemoveRoute(route_id_); |
| 870 channel_ = nullptr; | 869 channel_ = nullptr; |
| 871 if (gpu_control_client_) | 870 if (gpu_control_client_) |
| 872 gpu_control_client_->OnGpuControlLostContext(); | 871 gpu_control_client_->OnGpuControlLostContext(); |
| 873 } | 872 } |
| 874 | 873 |
| 875 } // namespace gpu | 874 } // namespace gpu |
| OLD | NEW |