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 /third_party | |
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 'third_party')
-rw-r--r-- | third_party/npapi/bindings/npapi_extensions.h | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h index 67c8ca9..ac57613 100644 --- a/third_party/npapi/bindings/npapi_extensions.h +++ b/third_party/npapi/bindings/npapi_extensions.h @@ -21,6 +21,12 @@ typedef void NPUserData; /* unique id for each device interface */ typedef int32 NPDeviceID; + +typedef struct _NPDeviceBuffer { + void* ptr; + size_t size; +} NPDeviceBuffer; + /* completion callback for flush device */ typedef void (*NPDeviceFlushContextCallbackPtr)( NPP instace, @@ -67,6 +73,25 @@ typedef NPError (*NPDeviceFlushContextPtr)( typedef NPError (*NPDeviceDestroyContextPtr)( NPP instance, NPDeviceContext* context); +/* Create a buffer associated with a particular context. The usage of the */ +/* buffer is device specific. The lifetime of the buffer is scoped with the */ +/* lifetime of the context. */ +typedef NPError (*NPDeviceCreateBufferPtr)( + NPP instance, + NPDeviceContext* context, + size_t size, + int32* id); +/* Destroy a buffer associated with a particular context. */ +typedef NPError (*NPDeviceDestroyBufferPtr)( + NPP instance, + NPDeviceContext* context, + int32 id); +/* Map a buffer id to its address. */ +typedef NPError (*NPDeviceMapBufferPtr)( + NPP instance, + NPDeviceContext* context, + int32 id, + NPDeviceBuffer* buffer); /* forward decl typdef structs */ typedef struct NPDevice NPDevice; @@ -81,6 +106,9 @@ struct NPDevice { NPDeviceGetStateContextPtr getStateContext; NPDeviceFlushContextPtr flushContext; NPDeviceDestroyContextPtr destroyContext; + NPDeviceCreateBufferPtr createBuffer; + NPDeviceDestroyBufferPtr destroyBuffer; + NPDeviceMapBufferPtr mapBuffer; }; /* returns NULL if deviceID unavailable / unrecognized */ @@ -225,13 +253,36 @@ typedef struct _NPDeviceContext2D #define NPPepper3DDevice 2 typedef struct _NPDeviceContext3DConfig { + int32 commandBufferEntries; } NPDeviceContext3DConfig; +typedef enum { + // The offset the command buffer service has read to. + NPDeviceContext3DState_GetOffset, + // The offset the plugin instance has written to. + NPDeviceContext3DState_PutOffset, + // The last token processed by the command buffer service. + NPDeviceContext3DState_Token, + // The most recent parse error. Getting this value resets the parse error + // if it recoverable. + NPDeviceContext3DState_ParseError, + // Wether the command buffer has encountered an unrecoverable error. + NPDeviceContext3DState_ErrorStatus, +} NPDeviceContext3DState; + typedef struct _NPDeviceContext3D { void* reserved; - void* buffer; - int32 bufferLength; + + // Buffer in which commands are stored. + void* commandBuffer; + int32 commandBufferEntries; + + // Offset in command buffer reader has reached. Synchronized on flush. + int32 getOffset; + + // Offset in command buffer writer has reached. Synchronized on flush. + int32 putOffset; } NPDeviceContext3D; #endif /* _NP_EXTENSIONS_H_ */ |