diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-22 23:28:15 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-22 23:28:15 +0000 |
commit | 7477ea6f6a173b586622fd276433a346760ffbf4 (patch) | |
tree | 678229a49ae5c4bb1a54a61374466cdddf57db59 /chrome/plugin | |
parent | e4f7cec0a45a803faf00875a070090b165ff1fc5 (diff) | |
download | chromium_src-7477ea6f6a173b586622fd276433a346760ffbf4.zip chromium_src-7477ea6f6a173b586622fd276433a346760ffbf4.tar.gz chromium_src-7477ea6f6a173b586622fd276433a346760ffbf4.tar.bz2 |
Added Pepper 3D device that instantiates the GPU plugin and sends GLES2 commands to it via a command buffer.
Added API for managing buffers to Pepper 3D device.
Removed DCHECK from WebPluginImpl::SetWindow that checks against a windowless plugin being given a window handle. Please check this! Now an initially windowless plugin instance gets a handle when it requests a Pepper 3D context. Perhaps the window handle should be concealed from the underlying plugin isntance.
Removed enable_gpu gyp variable and C macro. GPU code is always built on windows but not mac or linux. It is enabled at runtime with the --enable-gpu-plugin switch.
Redesigned CommandBuffer interface so it exposes shared memory through a Buffer. This was necessary because Pepper has no notion of shared memory handles. The Buffer exposes the shared memory as both a handle (through base::SharedMemory) and the mapped address and size.
Refactored CommandBufferEngine so mapped shared memory addresses and sizes are returned with a single call rather than two separate calls.
Added 3D demo to pepper test plugin.
TEST=try servers
BUG=none
Review URL: http://codereview.chromium.org/367002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35185 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r-- | chrome/plugin/command_buffer_stub.cc | 44 | ||||
-rw-r--r-- | chrome/plugin/command_buffer_stub.h | 3 | ||||
-rw-r--r-- | chrome/plugin/plugin_main.cc | 3 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.cc | 2 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.h | 2 |
5 files changed, 34 insertions, 20 deletions
diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc index 632e868..d7dbf9f 100644 --- a/chrome/plugin/command_buffer_stub.cc +++ b/chrome/plugin/command_buffer_stub.cc @@ -8,6 +8,8 @@ #include "chrome/plugin/command_buffer_stub.h" #include "chrome/plugin/plugin_channel.h" +using gpu::Buffer; + CommandBufferStub::CommandBufferStub(PluginChannel* channel, gfx::NativeView view) : channel_(channel), @@ -42,23 +44,25 @@ void CommandBufferStub::OnInitialize(int32 size, // Assume service is responsible for duplicating the handle from the calling // process. base::ProcessHandle peer_handle; - if (base::OpenProcessHandle(channel_->peer_pid(), &peer_handle)) + if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle)) return; command_buffer_.reset(new gpu::CommandBufferService); // Initialize the CommandBufferService and GPUProcessor. - base::SharedMemory* shared_memory = command_buffer_->Initialize(size); - if (shared_memory) { - processor_ = new gpu::GPUProcessor(command_buffer_.get()); - if (processor_->Initialize(view_)) { - command_buffer_->SetPutOffsetChangeCallback( - NewCallback(processor_.get(), - &gpu::GPUProcessor::ProcessCommands)); - shared_memory->ShareToProcess(peer_handle, ring_buffer); - } else { - processor_ = NULL; - command_buffer_.reset(); + if (command_buffer_->Initialize(size)) { + Buffer buffer = command_buffer_->GetRingBuffer(); + if (buffer.shared_memory) { + processor_ = new gpu::GPUProcessor(command_buffer_.get()); + if (processor_->Initialize(view_)) { + command_buffer_->SetPutOffsetChangeCallback( + NewCallback(processor_.get(), + &gpu::GPUProcessor::ProcessCommands)); + buffer.shared_memory->ShareToProcess(peer_handle, ring_buffer); + } else { + processor_ = NULL; + command_buffer_.reset(); + } } } @@ -85,19 +89,23 @@ void CommandBufferStub::OnDestroyTransferBuffer(int32 id) { command_buffer_->DestroyTransferBuffer(id); } -void CommandBufferStub::OnGetTransferBuffer(int32 id, - base::SharedMemoryHandle* transfer_buffer) { +void CommandBufferStub::OnGetTransferBuffer( + int32 id, + base::SharedMemoryHandle* transfer_buffer, + size_t* size) { *transfer_buffer = 0; + *size = 0; // Assume service is responsible for duplicating the handle to the calling // process. base::ProcessHandle peer_handle; - if (base::OpenProcessHandle(channel_->peer_pid(), &peer_handle)) + if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle)) return; - base::SharedMemory* shared_memory = command_buffer_->GetTransferBuffer(id); - if (shared_memory) { - shared_memory->ShareToProcess(peer_handle, transfer_buffer); + Buffer buffer = command_buffer_->GetTransferBuffer(id); + if (buffer.shared_memory) { + buffer.shared_memory->ShareToProcess(peer_handle, transfer_buffer); + *size = buffer.shared_memory->max_size(); } base::CloseProcessHandle(peer_handle); diff --git a/chrome/plugin/command_buffer_stub.h b/chrome/plugin/command_buffer_stub.h index 2a167c3..c7d765e 100644 --- a/chrome/plugin/command_buffer_stub.h +++ b/chrome/plugin/command_buffer_stub.h @@ -43,7 +43,8 @@ class CommandBufferStub : public IPC::Channel::Listener, void OnCreateTransferBuffer(int32 size, int32* id); void OnDestroyTransferBuffer(int32 id); void OnGetTransferBuffer(int32 id, - base::SharedMemoryHandle* transfer_buffer); + base::SharedMemoryHandle* transfer_buffer, + size_t* size); void OnGetToken(int32* token); void OnResetParseError(int32* parse_error); void OnGetErrorStatus(bool* error_status); diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc index 5863621..319ccce 100644 --- a/chrome/plugin/plugin_main.cc +++ b/chrome/plugin/plugin_main.cc @@ -15,6 +15,7 @@ #include "chrome/common/child_process.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/gpu_plugin.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/main_function_params.h" #include "chrome/plugin/plugin_thread.h" @@ -112,6 +113,8 @@ int PluginMain(const MainFunctionParams& parameters) { } #endif + chrome::RegisterInternalGPUPlugin(); + MessageLoop::current()->Run(); } diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index b2b4b33..49c535c 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -369,7 +369,7 @@ void WebPluginDelegateStub::OnCreateCommandBuffer(int* route_id) { *route_id = command_buffer_stub_->route_id(); #else *route_id = 0; -#endif +#endif // ENABLE_GPU } void WebPluginDelegateStub::CreateSharedBuffer( diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h index d5d3ab0..34358fa 100644 --- a/chrome/plugin/webplugin_delegate_stub.h +++ b/chrome/plugin/webplugin_delegate_stub.h @@ -6,6 +6,8 @@ #define CHROME_PLUGIN_WEBPLUGIN_DELEGATE_STUB_H_ #include <queue> +#include <string> +#include <vector> #include "base/gfx/rect.h" #include "base/ref_counted.h" |