Chromium Code Reviews| Index: ppapi/proxy/ppapi_command_buffer_proxy.cc |
| diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc |
| index c430c784d167347e85536a6ca85d8b373fab2c3d..b7676dbcd3a3bb2207526fc30e09860c8d47bc4b 100644 |
| --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc |
| +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc |
| @@ -22,7 +22,10 @@ PpapiCommandBufferProxy::PpapiCommandBufferProxy( |
| : command_buffer_id_(command_buffer_id), |
| capabilities_(capabilities), |
| resource_(resource), |
| - dispatcher_(dispatcher) { |
| + dispatcher_(dispatcher), |
| + next_fence_sync_release_(1), |
| + pending_fence_sync_release_(0), |
| + flushed_fence_sync_release_(0) { |
| shared_state_shm_.reset( |
| new base::SharedMemory(shared_state.shmem(), false)); |
| shared_state_shm_->Map(shared_state.size()); |
| @@ -56,18 +59,23 @@ void PpapiCommandBufferProxy::Flush(int32 put_offset) { |
| OrderingBarrier(put_offset); |
| FlushInternal(); |
| + flushed_fence_sync_release_ = next_fence_sync_release_ - 1; |
| } |
| void PpapiCommandBufferProxy::OrderingBarrier(int32 put_offset) { |
| if (last_state_.error != gpu::error::kNoError) |
| return; |
| - if (flush_info_->flush_pending && flush_info_->resource != resource_) |
| + if (flush_info_->flush_pending && flush_info_->resource != resource_) { |
| + DCHECK(pending_fence_sync_release_ > flushed_fence_sync_release_); |
| FlushInternal(); |
| + flushed_fence_sync_release_ = pending_fence_sync_release_; |
| + } |
| flush_info_->flush_pending = true; |
| flush_info_->resource = resource_; |
| flush_info_->put_offset = put_offset; |
| + pending_fence_sync_release_ = next_fence_sync_release_ - 1; |
| } |
| void PpapiCommandBufferProxy::WaitForTokenInRange(int32 start, int32 end) { |
| @@ -187,6 +195,18 @@ uint64_t PpapiCommandBufferProxy::GetCommandBufferID() const { |
| return command_buffer_id_; |
| } |
| +uint32_t PpapiCommandBufferProxy::GenerateFenceSyncRelease() { |
| + return next_fence_sync_release_++; |
| +} |
| + |
| +bool PpapiCommandBufferProxy::IsFenceSyncRelease(uint32_t release) { |
| + return release != 0 && release < next_fence_sync_release_; |
| +} |
| + |
| +bool PpapiCommandBufferProxy::IsFenceSyncFlushed(uint32_t release) { |
|
piman
2015/09/26 00:09:51
Same as GpuChannelHost, you need to FlushInternal
David Yen
2015/09/28 17:38:18
Same as previous comment, I would rather rely on t
|
| + return release <= flushed_fence_sync_release_; |
| +} |
| + |
| uint32 PpapiCommandBufferProxy::InsertSyncPoint() { |
| uint32 sync_point = 0; |
| if (last_state_.error == gpu::error::kNoError) { |