| Index: gpu/command_buffer/client/cmd_buffer_helper.cc
|
| ===================================================================
|
| --- gpu/command_buffer/client/cmd_buffer_helper.cc (revision 92876)
|
| +++ gpu/command_buffer/client/cmd_buffer_helper.cc (working copy)
|
| @@ -21,8 +21,6 @@
|
| total_entry_count_(0),
|
| usable_entry_count_(0),
|
| token_(0),
|
| - last_token_read_(-1),
|
| - get_(0),
|
| put_(0),
|
| last_put_sent_(0),
|
| commands_issued_(0),
|
| @@ -47,7 +45,6 @@
|
| total_entry_count_ = num_ring_buffer_entries;
|
| usable_entry_count_ = total_entry_count_ - kJumpEntries;
|
| put_ = state.put_offset;
|
| - SynchronizeState(state);
|
| return true;
|
| }
|
|
|
| @@ -57,8 +54,7 @@
|
| bool CommandBufferHelper::FlushSync() {
|
| time(&last_flush_time_);
|
| last_put_sent_ = put_;
|
| - CommandBuffer::State state = command_buffer_->FlushSync(put_, get_);
|
| - SynchronizeState(state);
|
| + CommandBuffer::State state = command_buffer_->FlushSync(put_, get_offset());
|
| return state.error == error::kNoError;
|
| }
|
|
|
| @@ -77,7 +73,7 @@
|
| // has shutdown.
|
| if (!FlushSync())
|
| return false;
|
| - } while (put_ != get_);
|
| + } while (put_ != get_offset());
|
|
|
| return true;
|
| }
|
| @@ -96,7 +92,7 @@
|
| TRACE_EVENT0("gpu", "CommandBufferHelper::InsertToken(wrapped)");
|
| // we wrapped
|
| Finish();
|
| - GPU_DCHECK_EQ(token_, last_token_read_);
|
| + GPU_DCHECK_EQ(token_, last_token_read());
|
| }
|
| return token_;
|
| }
|
| @@ -109,8 +105,8 @@
|
| if (token < 0)
|
| return;
|
| if (token > token_) return; // we wrapped
|
| - while (last_token_read_ < token) {
|
| - if (get_ == put_) {
|
| + while (last_token_read() < token) {
|
| + if (get_offset() == put_) {
|
| GPU_LOG(FATAL) << "Empty command buffer while waiting on a token.";
|
| return;
|
| }
|
| @@ -121,11 +117,6 @@
|
| }
|
| }
|
|
|
| -void CommandBufferHelper::YieldScheduler() {
|
| - cmd::YieldScheduler& cmd = GetCmdSpace<cmd::YieldScheduler>();
|
| - cmd.Init();
|
| -}
|
| -
|
| // Waits for available entries, basically waiting until get >= put + count + 1.
|
| // It actually waits for contiguous entries, so it may need to wrap the buffer
|
| // around, adding a jump. Thus this function may change the value of put_. The
|
| @@ -139,9 +130,9 @@
|
| // need to make sure get wraps first, actually that get is 1 or more (since
|
| // put will wrap to 0 after we add the jump).
|
| GPU_DCHECK_LE(1, put_);
|
| - if (get_ > put_ || get_ == 0) {
|
| + if (get_offset() > put_ || get_offset() == 0) {
|
| TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries");
|
| - while (get_ > put_ || get_ == 0) {
|
| + while (get_offset() > put_ || get_offset() == 0) {
|
| // Do not loop forever if the flush fails, meaning the command buffer
|
| // reader has shutdown.
|
| if (!FlushSync())
|
| @@ -185,13 +176,7 @@
|
|
|
| error::Error CommandBufferHelper::GetError() {
|
| CommandBuffer::State state = command_buffer_->GetState();
|
| - SynchronizeState(state);
|
| return static_cast<error::Error>(state.error);
|
| }
|
|
|
| -void CommandBufferHelper::SynchronizeState(const CommandBuffer::State& state) {
|
| - get_ = state.get_offset;
|
| - last_token_read_ = state.token;
|
| -}
|
| -
|
| } // namespace gpu
|
|
|