diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 19:31:09 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 19:31:09 +0000 |
commit | 41f31d14541d147658b5f2c4b85a8046ab602062 (patch) | |
tree | 47dd585acc505fc4377b6469cb27ca3accf0b8bc /content/common | |
parent | 8ebf9b135df2b2a79cf130d39a48185b8f851338 (diff) | |
download | chromium_src-41f31d14541d147658b5f2c4b85a8046ab602062.zip chromium_src-41f31d14541d147658b5f2c4b85a8046ab602062.tar.gz chromium_src-41f31d14541d147658b5f2c4b85a8046ab602062.tar.bz2 |
Add CommandBuffer::SetGetBuffer
As well as remove CommandBuffer::GetRingBuffer and
change CommandBuffer::Initialize
Before this change the service allocated and managed the command buffer.
After this change the client uses CreateTransferBuffer, GetTransferBuffer,
end potentially DeleteTransferBufffer to manage the command buffer.
Another CL will actually make the client delete the command buffer
on demand.
TEST=unit tests and run some samples and a NaCl 3D game
BUG=103989
Review URL: http://codereview.chromium.org/8566059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 24 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.h | 5 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 8 |
3 files changed, 16 insertions, 21 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index af478e0..6a8b4af 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -87,6 +87,8 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, OnInitialize); + IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, + OnSetGetBuffer); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, OnSetParent); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); @@ -159,8 +161,6 @@ void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) { } void GpuCommandBufferStub::OnInitialize( - base::SharedMemoryHandle ring_buffer, - int32 size, IPC::Message* reply_message) { DCHECK(!command_buffer_.get()); @@ -168,19 +168,7 @@ void GpuCommandBufferStub::OnInitialize( command_buffer_.reset(new gpu::CommandBufferService); -#if defined(OS_WIN) - // Windows dups the shared memory handle it receives into the current process - // and closes it when this variable goes out of scope. - base::SharedMemory shared_memory(ring_buffer, - false, - channel_->renderer_process()); -#else - // POSIX receives a dup of the shared memory handle and closes the dup when - // this variable goes out of scope. - base::SharedMemory shared_memory(ring_buffer, false); -#endif - - if (!command_buffer_->Initialize(&shared_memory, size)) { + if (!command_buffer_->Initialize()) { DLOG(ERROR) << "CommandBufferService failed to initialize.\n"; OnInitializeFailed(reply_message); return; @@ -287,6 +275,12 @@ void GpuCommandBufferStub::OnInitialize( "offscreen", surface_->IsOffscreen()); } +void GpuCommandBufferStub::OnSetGetBuffer( + int32 shm_id, IPC::Message* reply_message) { + scheduler_->SetGetBuffer(shm_id); + Send(reply_message); +} + void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, uint32 parent_texture_id, IPC::Message* reply_message) { diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index f581593..2124192 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -90,9 +90,8 @@ class GpuCommandBufferStub void OnInitializeFailed(IPC::Message* reply_message); // Message handlers: - void OnInitialize(base::SharedMemoryHandle ring_buffer, - int32 size, - IPC::Message* reply_message); + void OnInitialize(IPC::Message* reply_message); + void OnSetGetBuffer(int32 shm_id, IPC::Message* reply_message); void OnSetParent(int32 parent_route_id, uint32 parent_texture_id, IPC::Message* reply_message); diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index e5cab60..7099747 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -311,11 +311,13 @@ IPC_MESSAGE_CONTROL0(GpuChannelMsg_CloseChannel) // Initialize a command buffer with the given number of command entries. // Returns the shared memory handle for the command buffer mapped to the // calling process. -IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize, - base::SharedMemoryHandle /* ring_buffer */, - int32 /* size */, +IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_Initialize, bool /* result */) +// Sets the shared memory buffer used for commands. +IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer, + int32 /* shm_id */) + // Sets the parent command buffer. This allows the parent and child to share // textures. IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_SetParent, |