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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 6883179: Rework FlushSync to return early if commands have been processed since the last update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup, fix tests Created 9 years, 8 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: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 8fc0855090404157a7e7e565edde23370d9f5ccd..431f90d30bc8ed9fac4fa4c9e36e50ec0425ea47 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -56,7 +56,8 @@ GpuCommandBufferStub::GpuCommandBufferStub(
#endif // defined(OS_WIN)
renderer_id_(renderer_id),
render_view_id_(render_view_id),
- watchdog_(watchdog) {
+ watchdog_(watchdog),
+ task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
#if defined(OS_WIN)
@@ -256,7 +257,7 @@ void GpuCommandBufferStub::OnInitialize(
parent_texture_id_)) {
command_buffer_->SetPutOffsetChangeCallback(
NewCallback(scheduler_.get(),
- &gpu::GpuScheduler::ProcessCommands));
+ &gpu::GpuScheduler::PutChanged));
scheduler_->SetSwapBuffersCallback(
NewCallback(this, &GpuCommandBufferStub::OnSwapBuffers));
scheduler_->SetLatchCallback(base::Bind(
@@ -301,13 +302,16 @@ void GpuCommandBufferStub::OnGetState(gpu::CommandBuffer::State* state) {
void GpuCommandBufferStub::OnAsyncGetState() {
gpu::CommandBuffer::State state = command_buffer_->GetState();
- Send(new GpuCommandBufferMsg_UpdateState(route_id_, state));
+ IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state);
+ msg->set_unblock(true);
+ Send(msg);
}
void GpuCommandBufferStub::OnFlush(int32 put_offset,
+ int32 last_known_get,
gpu::CommandBuffer::State* state) {
GPU_TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnFlush");
- *state = command_buffer_->FlushSync(put_offset);
+ *state = command_buffer_->FlushSync(put_offset, last_known_get);
if (state->error == gpu::error::kLostContext &&
gfx::GLContext::LosesAllContextsOnContextLost())
channel_->LoseAllContexts();
@@ -315,12 +319,11 @@ void GpuCommandBufferStub::OnFlush(int32 put_offset,
void GpuCommandBufferStub::OnAsyncFlush(int32 put_offset) {
GPU_TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnAsyncFlush");
- gpu::CommandBuffer::State state = command_buffer_->FlushSync(put_offset);
- if (state.error == gpu::error::kLostContext &&
- gfx::GLContext::LosesAllContextsOnContextLost())
- channel_->LoseAllContexts();
apatrick_chromium 2011/04/27 22:52:44 Why did you remove this?
piman 2011/04/27 23:44:29 Since we're not waiting on any command to execute,
- else
- Send(new GpuCommandBufferMsg_UpdateState(route_id_, state));
+ command_buffer_->Flush(put_offset);
+ // TODO(piman): Do this everytime the scheduler finishes processing a batch of
+ // commands.
+ MessageLoop::current()->PostTask(FROM_HERE,
+ task_factory_.NewRunnableMethod(&GpuCommandBufferStub::OnAsyncGetState));
}
void GpuCommandBufferStub::OnCreateTransferBuffer(int32 size,

Powered by Google App Engine
This is Rietveld 408576698