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 /webkit/glue/plugins | |
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 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/npapi_extension_thunk.cc | 61 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_constants_win.h | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.h | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list_win.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_3d_device_delegate.h | 14 |
6 files changed, 80 insertions, 3 deletions
diff --git a/webkit/glue/plugins/npapi_extension_thunk.cc b/webkit/glue/plugins/npapi_extension_thunk.cc index e07bff2..eee6c80 100644 --- a/webkit/glue/plugins/npapi_extension_thunk.cc +++ b/webkit/glue/plugins/npapi_extension_thunk.cc @@ -114,6 +114,26 @@ static NPError Device2DDestroyContext(NPP id, return NPERR_GENERIC_ERROR; } +static NPError Device2DCreateBuffer(NPP id, + NPDeviceContext* context, + size_t size, + int32* buffer_id) { + return NPERR_GENERIC_ERROR; +} + +static NPError Device2DDestroyBuffer(NPP id, + NPDeviceContext* context, + int32 buffer_id) { + return NPERR_GENERIC_ERROR; +} + +static NPError Device2DMapBuffer(NPP id, + NPDeviceContext* context, + int32 buffer_id, + NPDeviceBuffer* buffer) { + return NPERR_GENERIC_ERROR; +} + // 3D device API --------------------------------------------------------------- static NPError Device3DQueryCapability(NPP id, int32 capability, int32* value) { @@ -196,6 +216,41 @@ static NPError Device3DDestroyContext(NPP id, return NPERR_GENERIC_ERROR; } +static NPError Device3DCreateBuffer(NPP id, + NPDeviceContext* context, + size_t size, + int32* buffer_id) { + scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + if (plugin) { + return plugin->webplugin()->delegate()->Device3DCreateBuffer( + static_cast<NPDeviceContext3D*>(context), size, buffer_id); + } + return NPERR_GENERIC_ERROR; +} + +static NPError Device3DDestroyBuffer(NPP id, + NPDeviceContext* context, + int32 buffer_id) { + scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + if (plugin) { + return plugin->webplugin()->delegate()->Device3DDestroyBuffer( + static_cast<NPDeviceContext3D*>(context), buffer_id); + } + return NPERR_GENERIC_ERROR; +} + +static NPError Device3DMapBuffer(NPP id, + NPDeviceContext* context, + int32 buffer_id, + NPDeviceBuffer* buffer) { + scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + if (plugin) { + return plugin->webplugin()->delegate()->Device3DMapBuffer( + static_cast<NPDeviceContext3D*>(context), buffer_id, buffer); + } + return NPERR_GENERIC_ERROR; +} + // ----------------------------------------------------------------------------- static NPDevice* AcquireDevice(NPP id, NPDeviceID device_id) { @@ -207,6 +262,9 @@ static NPDevice* AcquireDevice(NPP id, NPDeviceID device_id) { Device2DGetStateContext, Device2DFlushContext, Device2DDestroyContext, + Device2DCreateBuffer, + Device2DDestroyBuffer, + Device2DMapBuffer, }; static NPDevice device_3d = { Device3DQueryCapability, @@ -216,6 +274,9 @@ static NPDevice* AcquireDevice(NPP id, NPDeviceID device_id) { Device3DGetStateContext, Device3DFlushContext, Device3DDestroyContext, + Device3DCreateBuffer, + Device3DDestroyBuffer, + Device3DMapBuffer, }; switch (device_id) { diff --git a/webkit/glue/plugins/plugin_constants_win.h b/webkit/glue/plugins/plugin_constants_win.h index b708706..9913e5d 100644 --- a/webkit/glue/plugins/plugin_constants_win.h +++ b/webkit/glue/plugins/plugin_constants_win.h @@ -36,4 +36,6 @@ #define kJavaPlugin1 L"npjp2.dll" #define kJavaPlugin2 L"npdeploytk.dll" +#define kGPUPluginMimeType "application/vnd.google.chrome.gpu-plugin" + #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIST_H_ diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc index 2109951..ec4a80b 100644 --- a/webkit/glue/plugins/plugin_list.cc +++ b/webkit/glue/plugins/plugin_list.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 822ac05..ec82fd0 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/webkit/glue/plugins/plugin_list_win.cc b/webkit/glue/plugins/plugin_list_win.cc index b762a8f..25a3be4 100644 --- a/webkit/glue/plugins/plugin_list_win.cc +++ b/webkit/glue/plugins/plugin_list_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/webkit/glue/plugins/webplugin_3d_device_delegate.h b/webkit/glue/plugins/webplugin_3d_device_delegate.h index 78dbe0e..42dc300 100644 --- a/webkit/glue/plugins/webplugin_3d_device_delegate.h +++ b/webkit/glue/plugins/webplugin_3d_device_delegate.h @@ -46,6 +46,20 @@ class WebPlugin3DDeviceDelegate { virtual NPError Device3DDestroyContext(NPDeviceContext3D* context) { return NPERR_GENERIC_ERROR; } + virtual NPError Device3DCreateBuffer(NPDeviceContext3D* context, + size_t size, + int32* id) { + return NPERR_GENERIC_ERROR; + } + virtual NPError Device3DDestroyBuffer(NPDeviceContext3D* context, + int32 id) { + return NPERR_GENERIC_ERROR; + } + virtual NPError Device3DMapBuffer(NPDeviceContext3D* context, + int32 id, + NPDeviceBuffer* buffer) { + return NPERR_GENERIC_ERROR; + } protected: WebPlugin3DDeviceDelegate() {} |