summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-27 01:18:35 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-27 01:18:35 +0000
commit744e079897d430c91b18352c8e200bbeeadffe8b (patch)
tree2d75297b938cd2e21586455340240c5b9e88bf32
parent7ba34a0114537b08164b4f44943ec5c25aac9417 (diff)
downloadchromium_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
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.cc17
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.h11
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc2
-rw-r--r--content/renderer/pepper/pepper_platform_context_3d.cc4
-rw-r--r--content/renderer/pepper/pepper_platform_context_3d.h3
-rw-r--r--content/renderer/pepper/ppb_graphics_3d_impl.cc4
-rw-r--r--content/renderer/pepper/ppb_graphics_3d_impl.h1
-rw-r--r--gpu/command_buffer/client/client_test_helper.h1
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc4
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc4
-rw-r--r--gpu/command_buffer/common/gpu_control.h3
-rw-r--r--gpu/command_buffer/service/gpu_control_service.cc4
-rw-r--r--gpu/command_buffer/service/gpu_control_service.h2
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.cc6
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.h2
-rw-r--r--gpu/gles2_conform_support/egl/display.cc4
-rw-r--r--gpu/gles2_conform_support/egl/display.h2
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.cc17
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.h45
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.cc4
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.h4
-rw-r--r--ppapi/shared_impl/ppb_graphics_3d_shared.cc3
-rw-r--r--ppapi/shared_impl/ppb_graphics_3d_shared.h2
23 files changed, 127 insertions, 22 deletions
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 9027164..3f40ca4 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -367,6 +367,23 @@ void CommandBufferProxyImpl::SetContextLostReason(
NOTREACHED();
}
+bool CommandBufferProxyImpl::SupportsGpuMemoryBuffer() {
+ return false;
+}
+
+gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer(
+ size_t width,
+ size_t height,
+ unsigned internalformat,
+ int32* id) {
+ NOTREACHED();
+ return NULL;
+}
+
+void CommandBufferProxyImpl::DestroyGpuMemoryBuffer(int32 id) {
+ NOTREACHED();
+}
+
int CommandBufferProxyImpl::GetRouteID() const {
return route_id_;
}
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h
index 05a7ac6..05c8f09 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.h
+++ b/content/common/gpu/client/command_buffer_proxy_impl.h
@@ -20,6 +20,7 @@
#include "content/common/gpu/surface_capturer.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/command_buffer_shared.h"
+#include "gpu/command_buffer/common/gpu_control.h"
#include "ipc/ipc_listener.h"
#include "media/video/video_decode_accelerator.h"
#include "ui/events/latency_info.h"
@@ -41,6 +42,7 @@ class GpuChannelHost;
// CommandBufferStub.
class CommandBufferProxyImpl
: public gpu::CommandBuffer,
+ public gpu::GpuControl,
public IPC::Listener,
public base::SupportsWeakPtr<CommandBufferProxyImpl> {
public:
@@ -97,6 +99,15 @@ class CommandBufferProxyImpl
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;
+
int GetRouteID() const;
bool Echo(const base::Closure& callback);
bool ProduceFrontBuffer(const gpu::Mailbox& mailbox);
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index 00bc642..c3a3a0c 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -470,7 +470,7 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext(
share_group,
transfer_buffer_.get(),
bind_generates_resources_,
- NULL));
+ command_buffer_.get()));
gl_ = real_gl_.get();
if (attributes_.shareResources) {
diff --git a/content/renderer/pepper/pepper_platform_context_3d.cc b/content/renderer/pepper/pepper_platform_context_3d.cc
index 33d908b..292478e 100644
--- a/content/renderer/pepper/pepper_platform_context_3d.cc
+++ b/content/renderer/pepper/pepper_platform_context_3d.cc
@@ -133,6 +133,10 @@ gpu::CommandBuffer* PlatformContext3D::GetCommandBuffer() {
return command_buffer_;
}
+gpu::GpuControl* PlatformContext3D::GetGpuControl() {
+ return command_buffer_;
+}
+
int PlatformContext3D::GetCommandBufferRouteId() {
DCHECK(command_buffer_);
return command_buffer_->GetRouteID();
diff --git a/content/renderer/pepper/pepper_platform_context_3d.h b/content/renderer/pepper/pepper_platform_context_3d.h
index 842871a..c27334b 100644
--- a/content/renderer/pepper/pepper_platform_context_3d.h
+++ b/content/renderer/pepper/pepper_platform_context_3d.h
@@ -43,6 +43,9 @@ class PlatformContext3D {
// destroyed.
gpu::CommandBuffer* GetCommandBuffer();
+ // Returns the GpuControl class that services out-of-band messages.
+ gpu::GpuControl* GetGpuControl();
+
// If the command buffer is routed in the GPU channel, return the route id.
// Otherwise return 0.
int GetCommandBufferRouteId();
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc
index b48d68a..1f11803 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -189,6 +189,10 @@ gpu::CommandBuffer* PPB_Graphics3D_Impl::GetCommandBuffer() {
return platform_context_->GetCommandBuffer();
}
+gpu::GpuControl* PPB_Graphics3D_Impl::GetGpuControl() {
+ return platform_context_->GetGpuControl();
+}
+
int32 PPB_Graphics3D_Impl::DoSwapBuffers() {
// We do not have a GLES2 implementation when using an OOP proxy.
// The plugin-side proxy is responsible for adding the SwapBuffers command
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.h b/content/renderer/pepper/ppb_graphics_3d_impl.h
index 3e1c797..2ddeb86 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.h
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.h
@@ -55,6 +55,7 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared {
virtual ~PPB_Graphics3D_Impl();
// ppapi::PPB_Graphics3D_Shared overrides.
virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
+ virtual gpu::GpuControl* GetGpuControl() OVERRIDE;
virtual int32 DoSwapBuffers() OVERRIDE;
private:
diff --git a/gpu/command_buffer/client/client_test_helper.h b/gpu/command_buffer/client/client_test_helper.h
index e9d6c36..e3c35f3 100644
--- a/gpu/command_buffer/client/client_test_helper.h
+++ b/gpu/command_buffer/client/client_test_helper.h
@@ -87,6 +87,7 @@ class MockClientGpuControl : public GpuControl {
MockClientGpuControl();
virtual ~MockClientGpuControl();
+ MOCK_METHOD0(SupportsGpuMemoryBuffer, bool());
MOCK_METHOD4(CreateGpuMemoryBuffer,
gfx::GpuMemoryBuffer*(size_t width,
size_t height,
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 0bee1ed..54e47a5 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -22,6 +22,7 @@
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/client/vertex_array_object_manager.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
+#include "gpu/command_buffer/common/gpu_control.h"
#include "gpu/command_buffer/common/trace_event.h"
#include "ui/gfx/gpu_memory_buffer.h"
@@ -113,6 +114,7 @@ GLES2Implementation::GLES2Implementation(
gpu_control_(gpu_control) {
GPU_DCHECK(helper);
GPU_DCHECK(transfer_buffer);
+ GPU_DCHECK(gpu_control);
char temp[128];
sprintf(temp, "%p", static_cast<void*>(this));
@@ -2090,7 +2092,7 @@ const GLubyte* GLES2Implementation::GetStringHelper(GLenum name) {
"GL_CHROMIUM_map_sub "
"GL_CHROMIUM_shallow_flush "
"GL_EXT_unpack_subimage";
- if (gpu_control_ != NULL) {
+ if (gpu_control_->SupportsGpuMemoryBuffer()) {
// The first space character is intentional.
str += " GL_CHROMIUM_map_image";
}
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 84fa749..e92f5e22 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -2504,6 +2504,8 @@ TEST_F(GLES2ImplementationTest, GetString) {
char buf[sizeof(kString) + 1];
memset(buf, kBad, sizeof(buf));
+ EXPECT_CALL(*gpu_control_.get(), SupportsGpuMemoryBuffer())
+ .WillOnce(Return(true));
EXPECT_CALL(*command_buffer(), OnFlush())
.WillOnce(DoAll(SetMemory(result1.ptr, uint32(sizeof(kString))),
SetMemory(mem1.ptr, kString)))
@@ -2540,6 +2542,8 @@ TEST_F(GLES2ImplementationTest, PixelStoreiGLPackReverseRowOrderANGLE) {
expected.set_bucket_size2.Init(kBucketId, 0);
expected.pixel_store.Init(GL_PACK_REVERSE_ROW_ORDER_ANGLE, 1);
+ EXPECT_CALL(*gpu_control_.get(), SupportsGpuMemoryBuffer())
+ .WillOnce(Return(false));
EXPECT_CALL(*command_buffer(), OnFlush())
.WillOnce(DoAll(SetMemory(result1.ptr, uint32(sizeof(kString))),
SetMemory(mem1.ptr, kString)))
diff --git a/gpu/command_buffer/common/gpu_control.h b/gpu/command_buffer/common/gpu_control.h
index 5534ca7..503c745 100644
--- a/gpu/command_buffer/common/gpu_control.h
+++ b/gpu/command_buffer/common/gpu_control.h
@@ -5,6 +5,7 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_GPU_CONTROL_H_
#define GPU_COMMAND_BUFFER_COMMON_GPU_CONTROL_H_
+#include "gpu/command_buffer/common/types.h"
#include "gpu/gpu_export.h"
namespace gfx {
@@ -19,6 +20,8 @@ class GPU_EXPORT GpuControl {
GpuControl() {}
virtual ~GpuControl() {}
+ virtual bool SupportsGpuMemoryBuffer() = 0;
+
// Create a gpu memory buffer of the given dimensions and format. Returns
// its ID or -1 on error.
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
diff --git a/gpu/command_buffer/service/gpu_control_service.cc b/gpu/command_buffer/service/gpu_control_service.cc
index d368ff9..64ea261 100644
--- a/gpu/command_buffer/service/gpu_control_service.cc
+++ b/gpu/command_buffer/service/gpu_control_service.cc
@@ -19,6 +19,10 @@ GpuControlService::GpuControlService(
GpuControlService::~GpuControlService() {
}
+bool GpuControlService::SupportsGpuMemoryBuffer() {
+ return gpu_memory_buffer_manager_ && gpu_memory_buffer_factory_;
+}
+
gfx::GpuMemoryBuffer* GpuControlService::CreateGpuMemoryBuffer(
size_t width,
size_t height,
diff --git a/gpu/command_buffer/service/gpu_control_service.h b/gpu/command_buffer/service/gpu_control_service.h
index a12fee46..6b781f8 100644
--- a/gpu/command_buffer/service/gpu_control_service.h
+++ b/gpu/command_buffer/service/gpu_control_service.h
@@ -22,6 +22,8 @@ class GPU_EXPORT GpuControlService : public GpuControl {
virtual ~GpuControlService();
// Overridden from GpuControl:
+ virtual bool SupportsGpuMemoryBuffer() OVERRIDE;
+
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
size_t width,
size_t height,
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 972533c..778ca7d 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -242,6 +242,7 @@ InProcessCommandBuffer::InProcessCommandBuffer()
: context_lost_(false),
share_group_id_(0),
last_put_offset_(-1),
+ supports_gpu_memory_buffer_(false),
flush_event_(false, false),
queue_(CreateSchedulerClient()) {}
@@ -406,6 +407,7 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
gpu_control_.reset(
new GpuControlService(decoder_->GetContextGroup()->image_manager(),
g_gpu_memory_buffer_factory));
+ supports_gpu_memory_buffer_ = gpu_control_->SupportsGpuMemoryBuffer();
decoder_->set_engine(gpu_scheduler_.get());
@@ -647,6 +649,10 @@ void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point,
QueueTask(WrapCallback(callback));
}
+bool InProcessCommandBuffer::SupportsGpuMemoryBuffer() {
+ return supports_gpu_memory_buffer_;
+}
+
gfx::GpuMemoryBuffer* InProcessCommandBuffer::CreateGpuMemoryBuffer(
size_t width,
size_t height,
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h
index e63e11a..96f2642 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.h
+++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -110,6 +110,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
virtual gpu::error::Error GetLastError() OVERRIDE;
// GpuControl implementation:
+ virtual bool SupportsGpuMemoryBuffer() OVERRIDE;
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
size_t width,
size_t height,
@@ -165,6 +166,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
// Members accessed on the client thread:
State last_state_;
int32 last_put_offset_;
+ bool supports_gpu_memory_buffer_;
// Accessed on both threads:
scoped_ptr<CommandBuffer> command_buffer_;
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc
index 87bd809..cdc4fdb 100644
--- a/gpu/gles2_conform_support/egl/display.cc
+++ b/gpu/gles2_conform_support/egl/display.cc
@@ -11,6 +11,7 @@
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/service/context_group.h"
+#include "gpu/command_buffer/service/gpu_control_service.h"
#include "gpu/command_buffer/service/transfer_buffer_manager.h"
#include "gpu/gles2_conform_support/egl/config.h"
#include "gpu/gles2_conform_support/egl/surface.h"
@@ -122,6 +123,7 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config,
gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(),
decoder_.get(),
NULL));
+ gpu_control_.reset(new gpu::GpuControlService(NULL, NULL));
decoder_->set_engine(gpu_scheduler_.get());
gfx::Size size(create_offscreen_width_, create_offscreen_height_);
@@ -228,7 +230,7 @@ EGLContext Display::CreateContext(EGLConfig config,
NULL,
transfer_buffer_.get(),
true,
- NULL));
+ gpu_control_.get()));
if (!context_->Initialize(
kTransferBufferSize,
diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h
index 251904c..f7c0ff3 100644
--- a/gpu/gles2_conform_support/egl/display.h
+++ b/gpu/gles2_conform_support/egl/display.h
@@ -18,6 +18,7 @@
namespace gpu {
class CommandBufferService;
+class GpuControl;
class GpuScheduler;
class TransferBuffer;
class TransferBufferManagerInterface;
@@ -83,6 +84,7 @@ class Display {
scoped_ptr<gpu::CommandBufferService> command_buffer_;
scoped_ptr<gpu::GpuScheduler> gpu_scheduler_;
scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
+ scoped_ptr<gpu::GpuControl> gpu_control_;
scoped_refptr<gfx::GLContext> gl_context_;
scoped_refptr<gfx::GLSurface> gl_surface_;
scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;
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;