Commit 1ef068c2 authored by jbauman@chromium.org's avatar jbauman@chromium.org

Make echo message per-command-buffer

If this isn't a channel message, it will be easier to delay specific unscheduled command buffers rather than delaying the entire channel.

BUG=112349
TEST=


Review URL: http://codereview.chromium.org/9567028

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124665 0039d316-1c4b-4281-b951-d872f2087c98
parent 61e2b3cc
...@@ -349,7 +349,8 @@ bool CommandBufferProxy::Echo(const base::Closure& callback) { ...@@ -349,7 +349,8 @@ bool CommandBufferProxy::Echo(const base::Closure& callback) {
return false; return false;
} }
if (!Send(new GpuChannelMsg_Echo(GpuCommandBufferMsg_EchoAck(route_id_)))) { if (!Send(new GpuCommandBufferMsg_Echo(route_id_,
GpuCommandBufferMsg_EchoAck(route_id_)))) {
return false; return false;
} }
......
...@@ -73,10 +73,8 @@ bool GpuChannel::OnMessageReceived(const IPC::Message& message) { ...@@ -73,10 +73,8 @@ bool GpuChannel::OnMessageReceived(const IPC::Message& message) {
} }
// Control messages are not deferred and can be handled out of order with // Control messages are not deferred and can be handled out of order with
// respect to routed ones. Except for Echo, which must be deferred in order // respect to routed ones.
// to respect the asynchronous Mac SwapBuffers. if (message.routing_id() == MSG_ROUTING_CONTROL)
if (message.routing_id() == MSG_ROUTING_CONTROL &&
message.type() != GpuChannelMsg_Echo::ID)
return OnControlMessageReceived(message); return OnControlMessageReceived(message);
if (message.type() == GpuCommandBufferMsg_GetStateFast::ID) { if (message.type() == GpuCommandBufferMsg_GetStateFast::ID) {
...@@ -229,7 +227,6 @@ bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { ...@@ -229,7 +227,6 @@ bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
OnCreateOffscreenCommandBuffer) OnCreateOffscreenCommandBuffer)
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer,
OnDestroyCommandBuffer) OnDestroyCommandBuffer)
IPC_MESSAGE_HANDLER(GpuChannelMsg_Echo, OnEcho);
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_WillGpuSwitchOccur, IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_WillGpuSwitchOccur,
OnWillGpuSwitchOccur) OnWillGpuSwitchOccur)
IPC_MESSAGE_HANDLER(GpuChannelMsg_CloseChannel, OnCloseChannel) IPC_MESSAGE_HANDLER(GpuChannelMsg_CloseChannel, OnCloseChannel)
...@@ -250,9 +247,7 @@ void GpuChannel::HandleMessage() { ...@@ -250,9 +247,7 @@ void GpuChannel::HandleMessage() {
processed_get_state_fast_ = processed_get_state_fast_ =
(message->type() == GpuCommandBufferMsg_GetStateFast::ID); (message->type() == GpuCommandBufferMsg_GetStateFast::ID);
// Handle deferred control messages. // Handle deferred control messages.
if (message->routing_id() == MSG_ROUTING_CONTROL) if (!router_.RouteMessage(*message)) {
OnControlMessageReceived(*message);
else if (!router_.RouteMessage(*message)) {
// Respond to sync messages even if router failed to route. // Respond to sync messages even if router failed to route.
if (message->is_sync()) { if (message->is_sync()) {
IPC::Message* reply = IPC::SyncMessage::GenerateReply(&*message); IPC::Message* reply = IPC::SyncMessage::GenerateReply(&*message);
...@@ -374,10 +369,6 @@ void GpuChannel::OnDestroyCommandBuffer(int32 route_id, ...@@ -374,10 +369,6 @@ void GpuChannel::OnDestroyCommandBuffer(int32 route_id,
Send(reply_message); Send(reply_message);
} }
void GpuChannel::OnEcho(const IPC::Message& message) {
TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho");
Send(new IPC::Message(message));
}
void GpuChannel::OnWillGpuSwitchOccur(bool is_creating_context, void GpuChannel::OnWillGpuSwitchOccur(bool is_creating_context,
gfx::GpuPreference gpu_preference, gfx::GpuPreference gpu_preference,
......
...@@ -127,8 +127,6 @@ class GpuChannel : public IPC::Channel::Listener, ...@@ -127,8 +127,6 @@ class GpuChannel : public IPC::Channel::Listener,
IPC::Message* reply_message); IPC::Message* reply_message);
void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message);
void OnEcho(const IPC::Message& message);
void OnWillGpuSwitchOccur(bool is_creating_context, void OnWillGpuSwitchOccur(bool is_creating_context,
gfx::GpuPreference gpu_preference, gfx::GpuPreference gpu_preference,
IPC::Message* reply_message); IPC::Message* reply_message);
......
...@@ -103,6 +103,7 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { ...@@ -103,6 +103,7 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
OnSetSharedStateBuffer); OnSetSharedStateBuffer);
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent,
OnSetParent); OnSetParent);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho);
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState);
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast,
OnGetStateFast); OnGetStateFast);
...@@ -141,6 +142,11 @@ bool GpuCommandBufferStub::HasMoreWork() { ...@@ -141,6 +142,11 @@ bool GpuCommandBufferStub::HasMoreWork() {
return scheduler_.get() && scheduler_->HasMoreWork(); return scheduler_.get() && scheduler_->HasMoreWork();
} }
void GpuCommandBufferStub::OnEcho(const IPC::Message& message) {
TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho");
Send(new IPC::Message(message));
}
void GpuCommandBufferStub::Destroy() { void GpuCommandBufferStub::Destroy() {
// The scheduler has raw references to the decoder and the command buffer so // The scheduler has raw references to the decoder and the command buffer so
// destroy it before those. // destroy it before those.
......
...@@ -298,10 +298,6 @@ IPC_SYNC_MESSAGE_CONTROL2_1(GpuChannelMsg_CreateOffscreenCommandBuffer, ...@@ -298,10 +298,6 @@ IPC_SYNC_MESSAGE_CONTROL2_1(GpuChannelMsg_CreateOffscreenCommandBuffer,
IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer, IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
int32 /* instance_id */) int32 /* instance_id */)
// Request that the GPU process reply with the given message.
IPC_MESSAGE_CONTROL1(GpuChannelMsg_Echo,
IPC::Message /* reply */)
// Asks the GPU process whether the creation or destruction of a // Asks the GPU process whether the creation or destruction of a
// command buffer on the given GPU (integrated or discrete) will cause // command buffer on the given GPU (integrated or discrete) will cause
// the system to switch which GPU it is using. All contexts that share // the system to switch which GPU it is using. All contexts that share
...@@ -425,6 +421,11 @@ IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetWindowSize, ...@@ -425,6 +421,11 @@ IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetWindowSize,
IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed, IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed,
gpu::error::ContextLostReason /* reason */) gpu::error::ContextLostReason /* reason */)
// Request that the GPU process reply with the given message. Reply may be
// delayed.
IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Echo,
IPC::Message /* reply */)
// Response to a GpuChannelMsg_Echo message. // Response to a GpuChannelMsg_Echo message.
IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EchoAck) IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EchoAck)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment