Introduce command buffer control thread
This CL introduce a control thread for the GPU command buffer. We listen on the
command buffer pipe on a control thread so that we can respond to messages with
low latency. Currently, we don't have any special low-latency processing on the
control thread, but the plan is to implement sync points on the control thread.
Instead, we just forward all the messages to the driver thread by re-wrapping
the arguments in base::Callbacks.
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/739493002
diff --git a/mojo/services/gles2/command_buffer_driver.cc b/mojo/services/gles2/command_buffer_driver.cc
index 86534bb..8e30349 100644
--- a/mojo/services/gles2/command_buffer_driver.cc
+++ b/mojo/services/gles2/command_buffer_driver.cc
@@ -181,8 +181,14 @@
command_buffer_->DestroyTransferBuffer(id);
}
+void CommandBufferDriver::Echo(const Callback<void()>& callback) {
+ callback.Run();
+}
+
void CommandBufferDriver::SetContextLostCallback(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const base::Callback<void(int32_t)>& callback) {
+ context_lost_task_runner_ = task_runner;
context_lost_callback_ = callback;
}
@@ -196,8 +202,10 @@
}
void CommandBufferDriver::OnContextLost(uint32_t reason) {
- if (!context_lost_callback_.is_null())
- context_lost_callback_.Run(reason);
+ if (!context_lost_callback_.is_null()) {
+ context_lost_task_runner_->PostTask(
+ FROM_HERE, base::Bind(context_lost_callback_, reason));
+ }
}
} // namespace mojo