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

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: Reverted mojo readme, changed wait() to take a pointer Created 5 years, 2 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..56e74866ee31ad43d2c187d9b6a04cb7bfd2711c 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());
@@ -62,12 +65,14 @@ 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_) {
FlushInternal();
+ }
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 +192,18 @@ uint64_t PpapiCommandBufferProxy::GetCommandBufferID() const {
return command_buffer_id_;
}
+uint64_t PpapiCommandBufferProxy::GenerateFenceSyncRelease() {
+ return next_fence_sync_release_++;
+}
+
+bool PpapiCommandBufferProxy::IsFenceSyncRelease(uint64_t release) {
+ return release != 0 && release < next_fence_sync_release_;
+}
+
+bool PpapiCommandBufferProxy::IsFenceSyncFlushed(uint64_t release) {
+ return release <= flushed_fence_sync_release_;
+}
+
uint32 PpapiCommandBufferProxy::InsertSyncPoint() {
uint32 sync_point = 0;
if (last_state_.error == gpu::error::kNoError) {
@@ -294,6 +311,7 @@ void PpapiCommandBufferProxy::FlushInternal() {
DCHECK(last_state_.error == gpu::error::kNoError);
DCHECK(flush_info_->flush_pending);
+ DCHECK_GE(pending_fence_sync_release_, flushed_fence_sync_release_);
IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush(
ppapi::API_ID_PPB_GRAPHICS_3D, flush_info_->resource,
@@ -307,6 +325,7 @@ void PpapiCommandBufferProxy::FlushInternal() {
flush_info_->flush_pending = false;
flush_info_->resource.SetHostResource(0, 0);
+ flushed_fence_sync_release_ = pending_fence_sync_release_;
}
} // namespace proxy

Powered by Google App Engine
This is Rietveld 408576698