Chromium Code Reviews| Index: content/common/gpu/client/command_buffer_proxy_impl.cc |
| diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc |
| index c3c841924355e6beb7f1f3e4685d20e688248ff0..c408152ed62b12b5dd9fdd5687f2433c02e7ccce 100644 |
| --- a/content/common/gpu/client/command_buffer_proxy_impl.cc |
| +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc |
| @@ -416,10 +416,18 @@ int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer, |
| // This handle is owned by the GPU process and must be passed to it or it |
| // will leak. In otherwords, do not early out on error between here and the |
| // sending of the CreateImage IPC below. |
| - bool requires_sync_point = false; |
| + bool requires_sync_token = false; |
| gfx::GpuMemoryBufferHandle handle = |
| channel_->ShareGpuMemoryBufferToGpuProcess(gpu_memory_buffer->GetHandle(), |
| - &requires_sync_point); |
| + &requires_sync_token); |
| + |
| + uint64_t image_fence_sync = 0; |
| + if (requires_sync_token) { |
| + image_fence_sync = GenerateFenceSyncRelease(); |
| + |
| + // Make sure fence syncs were flushed before CreateImage() was called. |
| + DCHECK((image_fence_sync - 1) <= flushed_fence_sync_release_); |
|
dcheng
2015/11/04 19:22:43
DCHECK_LE
David Yen
2015/11/04 19:47:39
Done.
|
| + } |
| DCHECK(gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( |
| gpu_memory_buffer->GetFormat(), capabilities_)); |
| @@ -427,18 +435,28 @@ int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer, |
| gfx::Size(width, height), gpu_memory_buffer->GetFormat())); |
| DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
| internalformat, gpu_memory_buffer->GetFormat())); |
| - if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, |
| - new_id, |
| - handle, |
| - gfx::Size(width, height), |
| - gpu_memory_buffer->GetFormat(), |
| - internalformat))) { |
| + |
| + GpuCommandBufferMsg_CreateImage_Params params; |
| + params.id = new_id; |
| + params.gpu_memory_buffer = handle; |
| + params.size = gfx::Size(width, height); |
| + params.format = gpu_memory_buffer->GetFormat(); |
| + params.internalformat = internalformat; |
| + params.image_release_count = image_fence_sync; |
| + |
| + if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, params))) |
| return -1; |
| - } |
| - if (requires_sync_point) { |
| - gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffer, |
| - InsertSyncPoint()); |
| + if (image_fence_sync) { |
| + gpu::SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), |
| + image_fence_sync); |
| + |
| + // Force a synchronous IPC to validate sync token. |
| + channel_->ValidateFlushIDReachedServer(stream_id_, true); |
| + sync_token.SetVerifyFlush(); |
| + |
| + gpu_memory_buffer_manager->SetDestructionSyncToken(gpu_memory_buffer, |
| + sync_token); |
| } |
| return new_id; |
| @@ -530,7 +548,8 @@ bool CommandBufferProxyImpl::IsFenceSyncFlushReceived(uint64_t release) { |
| return true; |
| // Has not been validated, validate it now. |
| - UpdateVerifiedReleases(channel_->ValidateFlushIDReachedServer(stream_id_)); |
| + UpdateVerifiedReleases( |
| + channel_->ValidateFlushIDReachedServer(stream_id_, false)); |
| return release <= verified_fence_sync_release_; |
| } |