Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: ppapi/proxy/ppapi_command_buffer_proxy.cc

Issue 1331843005: Implemented new fence syncs which replaces the old sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to remove cmd buffer helper functios and replace with gpu control ones Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698