diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-27 01:18:35 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-27 01:18:35 +0000 |
commit | 744e079897d430c91b18352c8e200bbeeadffe8b (patch) | |
tree | 2d75297b938cd2e21586455340240c5b9e88bf32 /ppapi | |
parent | 7ba34a0114537b08164b4f44943ec5c25aac9417 (diff) | |
download | chromium_src-744e079897d430c91b18352c8e200bbeeadffe8b.zip chromium_src-744e079897d430c91b18352c8e200bbeeadffe8b.tar.gz chromium_src-744e079897d430c91b18352c8e200bbeeadffe8b.tar.bz2 |
Make *CommandBufferProxy* implement GpuControl
GpuControl is where we will pipe out-of-band stuff, that is currently done in
each of the WGC3D implementations, but we want to move down into
GLES2Implementation.
This is essentially just a refactoring, since the current GpuControl only deals
with GpuMemoryBuffer that's not available out-of-process, but we can then add
things like GenerateMailboxes, Ensure/DiscardBackbuffer or callback stuff on
top.
BUG=181120
R=dmichael@chromium.org, sievers@chromium.org
Review URL: https://codereview.chromium.org/24711002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/ppapi_command_buffer_proxy.cc | 17 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_command_buffer_proxy.h | 45 | ||||
-rw-r--r-- | ppapi/proxy/ppb_graphics_3d_proxy.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppb_graphics_3d_proxy.h | 4 | ||||
-rw-r--r-- | ppapi/shared_impl/ppb_graphics_3d_shared.cc | 3 | ||||
-rw-r--r-- | ppapi/shared_impl/ppb_graphics_3d_shared.h | 2 |
6 files changed, 56 insertions, 19 deletions
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc index 88528f2..d748678 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -204,6 +204,23 @@ uint32 PpapiCommandBufferProxy::InsertSyncPoint() { return sync_point; } +bool PpapiCommandBufferProxy::SupportsGpuMemoryBuffer() { + return false; +} + +gfx::GpuMemoryBuffer* PpapiCommandBufferProxy::CreateGpuMemoryBuffer( + size_t width, + size_t height, + unsigned internalformat, + int32* id) { + NOTREACHED(); + return NULL; +} + +void PpapiCommandBufferProxy::DestroyGpuMemoryBuffer(int32 id) { + NOTREACHED(); +} + bool PpapiCommandBufferProxy::Send(IPC::Message* msg) { DCHECK(last_state_.error == gpu::error::kNoError); diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h index 6ea6f65..603ea36 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/containers/hash_tables.h" #include "gpu/command_buffer/common/command_buffer.h" +#include "gpu/command_buffer/common/gpu_control.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/shared_impl/host_resource.h" @@ -20,28 +21,40 @@ namespace proxy { class ProxyChannel; -class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer { +class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy + : public gpu::CommandBuffer, + public gpu::GpuControl { public: PpapiCommandBufferProxy(const HostResource& resource, ProxyChannel* channel); virtual ~PpapiCommandBufferProxy(); // gpu::CommandBuffer implementation: - virtual bool Initialize(); - virtual State GetState(); - virtual State GetLastState(); - virtual int32 GetLastToken(); - virtual void Flush(int32 put_offset); - virtual State FlushSync(int32 put_offset, int32 last_known_get); - virtual void SetGetBuffer(int32 transfer_buffer_id); - virtual void SetGetOffset(int32 get_offset); - virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id); - virtual void DestroyTransferBuffer(int32 id); - virtual gpu::Buffer GetTransferBuffer(int32 id); - virtual void SetToken(int32 token); - virtual void SetParseError(gpu::error::Error error); - virtual void SetContextLostReason(gpu::error::ContextLostReason reason); - virtual uint32 InsertSyncPoint(); + virtual bool Initialize() OVERRIDE; + virtual State GetState() OVERRIDE; + virtual State GetLastState() OVERRIDE; + virtual int32 GetLastToken() OVERRIDE; + virtual void Flush(int32 put_offset) OVERRIDE; + virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; + virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE; + virtual void SetGetOffset(int32 get_offset) OVERRIDE; + virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id) OVERRIDE; + virtual void DestroyTransferBuffer(int32 id) OVERRIDE; + virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE; + virtual void SetToken(int32 token) OVERRIDE; + virtual void SetParseError(gpu::error::Error error) OVERRIDE; + virtual void SetContextLostReason(gpu::error::ContextLostReason reason) + OVERRIDE; + virtual uint32 InsertSyncPoint() OVERRIDE; + + // gpu::GpuControl implementation: + virtual bool SupportsGpuMemoryBuffer() OVERRIDE; + virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( + size_t width, + size_t height, + unsigned internalformat, + int32* id) OVERRIDE; + virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; private: bool Send(IPC::Message* msg); diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc index 204466b..ba988fd22 100644 --- a/ppapi/proxy/ppb_graphics_3d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc @@ -245,6 +245,10 @@ gpu::CommandBuffer* Graphics3D::GetCommandBuffer() { return locking_command_buffer_.get(); } +gpu::GpuControl* Graphics3D::GetGpuControl() { + return command_buffer_.get(); +} + int32 Graphics3D::DoSwapBuffers() { // gles2_impl()->SwapBuffers() results in CommandBuffer calls, and we already // have the proxy lock. diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h index ffda80c..8f6b40f 100644 --- a/ppapi/proxy/ppb_graphics_3d_proxy.h +++ b/ppapi/proxy/ppb_graphics_3d_proxy.h @@ -24,6 +24,7 @@ class HostResource; namespace proxy { class SerializedHandle; +class PpapiCommandBufferProxy; class Graphics3D : public PPB_Graphics3D_Shared { public: @@ -52,12 +53,13 @@ class Graphics3D : public PPB_Graphics3D_Shared { // PPB_Graphics3D_Shared overrides. virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; + virtual gpu::GpuControl* GetGpuControl() OVERRIDE; virtual int32 DoSwapBuffers() OVERRIDE; virtual void PushAlreadyLocked() OVERRIDE; virtual void PopAlreadyLocked() OVERRIDE; int num_already_locked_calls_; - scoped_ptr<gpu::CommandBuffer> command_buffer_; + scoped_ptr<PpapiCommandBufferProxy> command_buffer_; scoped_ptr<LockingCommandBuffer> locking_command_buffer_; DISALLOW_COPY_AND_ASSIGN(Graphics3D); diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc index e24a13c..1f412d8 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc @@ -129,8 +129,7 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl( share_gles2 ? share_gles2->share_group() : NULL, transfer_buffer_.get(), true, - NULL // Do not use GpuMemoryBuffers. - )); + GetGpuControl())); if (!gles2_impl_->Initialize( transfer_buffer_size, diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.h b/ppapi/shared_impl/ppb_graphics_3d_shared.h index 482cb4c..c51c99b 100644 --- a/ppapi/shared_impl/ppb_graphics_3d_shared.h +++ b/ppapi/shared_impl/ppb_graphics_3d_shared.h @@ -15,6 +15,7 @@ namespace gpu { class CommandBuffer; +class GpuControl; class TransferBuffer; namespace gles2 { class GLES2CmdHelper; @@ -85,6 +86,7 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared virtual ~PPB_Graphics3D_Shared(); virtual gpu::CommandBuffer* GetCommandBuffer() = 0; + virtual gpu::GpuControl* GetGpuControl() = 0; virtual int32 DoSwapBuffers() = 0; bool HasPendingSwap() const; |