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

Side by Side Diff: mojo/gles2/command_buffer_client_impl.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 unified diff | Download patch
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.h ('k') | mojo/gpu/mojo_gles2_impl_autogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/gles2/command_buffer_client_impl.h" 5 #include "mojo/gles2/command_buffer_client_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 const std::vector<int32_t>& attribs, 121 const std::vector<int32_t>& attribs,
122 const MojoAsyncWaiter* async_waiter, 122 const MojoAsyncWaiter* async_waiter,
123 mojo::ScopedMessagePipeHandle command_buffer_handle) 123 mojo::ScopedMessagePipeHandle command_buffer_handle)
124 : delegate_(delegate), 124 : delegate_(delegate),
125 attribs_(attribs), 125 attribs_(attribs),
126 observer_binding_(this), 126 observer_binding_(this),
127 shared_state_(NULL), 127 shared_state_(NULL),
128 last_put_offset_(-1), 128 last_put_offset_(-1),
129 next_transfer_buffer_id_(0), 129 next_transfer_buffer_id_(0),
130 next_image_id_(0), 130 next_image_id_(0),
131 next_fence_sync_release_(1),
132 flushed_fence_sync_release_(0),
131 async_waiter_(async_waiter) { 133 async_waiter_(async_waiter) {
132 command_buffer_.Bind(mojo::InterfacePtrInfo<mojo::CommandBuffer>( 134 command_buffer_.Bind(mojo::InterfacePtrInfo<mojo::CommandBuffer>(
133 command_buffer_handle.Pass(), 0u), 135 command_buffer_handle.Pass(), 0u),
134 async_waiter); 136 async_waiter);
135 command_buffer_.set_connection_error_handler( 137 command_buffer_.set_connection_error_handler(
136 [this]() { DidLoseContext(gpu::error::kUnknown); }); 138 [this]() { DidLoseContext(gpu::error::kUnknown); });
137 } 139 }
138 140
139 CommandBufferClientImpl::~CommandBufferClientImpl() {} 141 CommandBufferClientImpl::~CommandBufferClientImpl() {}
140 142
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 TryUpdateState(); 185 TryUpdateState();
184 return last_state_.token; 186 return last_state_.token;
185 } 187 }
186 188
187 void CommandBufferClientImpl::Flush(int32 put_offset) { 189 void CommandBufferClientImpl::Flush(int32 put_offset) {
188 if (last_put_offset_ == put_offset) 190 if (last_put_offset_ == put_offset)
189 return; 191 return;
190 192
191 last_put_offset_ = put_offset; 193 last_put_offset_ = put_offset;
192 command_buffer_->Flush(put_offset); 194 command_buffer_->Flush(put_offset);
195 flushed_fence_sync_release_ = next_fence_sync_release_ - 1;
193 } 196 }
194 197
195 void CommandBufferClientImpl::OrderingBarrier(int32_t put_offset) { 198 void CommandBufferClientImpl::OrderingBarrier(int32_t put_offset) {
196 // TODO(jamesr): Implement this more efficiently. 199 // TODO(jamesr): Implement this more efficiently.
197 Flush(put_offset); 200 Flush(put_offset);
198 } 201 }
199 202
200 void CommandBufferClientImpl::WaitForTokenInRange(int32 start, int32 end) { 203 void CommandBufferClientImpl::WaitForTokenInRange(int32 start, int32 end) {
201 TryUpdateState(); 204 TryUpdateState();
202 while (!InRange(start, end, last_state_.token) && 205 while (!InRange(start, end, last_state_.token) &&
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 404 }
402 405
403 uint64_t CommandBufferClientImpl::GetCommandBufferID() const { 406 uint64_t CommandBufferClientImpl::GetCommandBufferID() const {
404 // TODO (rjkroege): This must correspond to the command buffer ID on the 407 // TODO (rjkroege): This must correspond to the command buffer ID on the
405 // server side. Most likely a combination of the client-specific integer and 408 // server side. Most likely a combination of the client-specific integer and
406 // the connect id. 409 // the connect id.
407 NOTIMPLEMENTED(); 410 NOTIMPLEMENTED();
408 return 0; 411 return 0;
409 } 412 }
410 413
414 uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() {
415 return next_fence_sync_release_++;
416 }
417
418 bool CommandBufferClientImpl::IsFenceSyncRelease(uint64_t release) {
419 return release != 0 && release < next_fence_sync_release_;
420 }
421
422 bool CommandBufferClientImpl::IsFenceSyncFlushed(uint64_t release) {
423 return release != 0 && release <= flushed_fence_sync_release_;
424 }
425
411 } // namespace gles2 426 } // namespace gles2
OLDNEW
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.h ('k') | mojo/gpu/mojo_gles2_impl_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698