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

Unified Diff: gpu/command_buffer/client/cmd_buffer_helper.cc

Issue 7253052: Execute all GL commands up to the put offset reported by a flush. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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: gpu/command_buffer/client/cmd_buffer_helper.cc
===================================================================
--- gpu/command_buffer/client/cmd_buffer_helper.cc (revision 91774)
+++ gpu/command_buffer/client/cmd_buffer_helper.cc (working copy)
@@ -16,8 +16,6 @@
total_entry_count_(0),
usable_entry_count_(0),
token_(0),
- last_token_read_(-1),
- get_(0),
put_(0),
last_put_sent_(0) {
}
@@ -40,7 +38,6 @@
total_entry_count_ = num_ring_buffer_entries;
usable_entry_count_ = total_entry_count_ - kJumpEntries;
put_ = state.put_offset;
- SynchronizeState(state);
return true;
}
@@ -49,8 +46,7 @@
bool CommandBufferHelper::FlushSync() {
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;
}
@@ -68,7 +64,7 @@
// has shutdown.
if (!FlushSync())
return false;
- } while (put_ != get_);
+ } while (put_ != get_offset());
return true;
}
@@ -87,7 +83,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_;
}
@@ -100,8 +96,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;
}
@@ -112,11 +108,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
@@ -130,9 +121,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())
@@ -148,7 +139,7 @@
while (AvailableEntries() < count) {
jbates 2011/07/11 18:39:50 Looks like this loop is no longer needed because o
apatrick_chromium 2011/07/11 21:25:45 It should actually be a FlushSync. Fixed.
// Do not loop forever if the flush fails, meaning the command buffer
// reader has shutdown.
- if (!FlushSync())
+ if (!Finish())
return;
}
}
@@ -156,7 +147,8 @@
// reader is known to be idle.
int32 pending =
(put_ + usable_entry_count_ - last_put_sent_) % usable_entry_count_;
- int32 limit = usable_entry_count_ / ((get_ == last_put_sent_) ? 16 : 2);
+ int32 limit = usable_entry_count_ /
+ ((get_offset() == last_put_sent_) ? 16 : 2);
if (pending > limit) {
Flush();
}
@@ -176,13 +168,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

Powered by Google App Engine
This is Rietveld 408576698