diff options
author | piman <piman@chromium.org> | 2014-11-06 18:30:01 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-07 02:30:28 +0000 |
commit | 360175c06135c8b85095283c280e9e568b80e41b (patch) | |
tree | 70074d77755f766dc5c81f298aa4bf10fde4d68b | |
parent | 6ebc782bb4feeb62fb40319cd462e0409db06620 (diff) | |
download | chromium_src-360175c06135c8b85095283c280e9e568b80e41b.zip chromium_src-360175c06135c8b85095283c280e9e568b80e41b.tar.gz chromium_src-360175c06135c8b85095283c280e9e568b80e41b.tar.bz2 |
Implement PpapiCommandBufferProxy::GetCapabilities
This is just piping gpu::Capabilities through the initialization patch.
For that, I needed to move the IPC traits for gpu::Capabilities from
content/ to gpu/ipc/ so that we can use it in ppapi/proxy.
BUG=325391
Review URL: https://codereview.chromium.org/706533002
Cr-Commit-Position: refs/heads/master@{#303164}
-rw-r--r-- | content/common/gpu/gpu_messages.h | 17 | ||||
-rw-r--r-- | content/renderer/pepper/ppb_graphics_3d_impl.cc | 9 | ||||
-rw-r--r-- | content/renderer/pepper/ppb_graphics_3d_impl.h | 6 | ||||
-rw-r--r-- | content/renderer/pepper/resource_creation_impl.cc | 3 | ||||
-rw-r--r-- | content/renderer/pepper/resource_creation_impl.h | 1 | ||||
-rw-r--r-- | gpu/ipc/gpu_command_buffer_traits.cc | 19 | ||||
-rw-r--r-- | gpu/ipc/gpu_command_buffer_traits.h | 3 | ||||
-rw-r--r-- | gpu/ipc/gpu_command_buffer_traits_multi.h | 29 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_command_buffer_proxy.cc | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_command_buffer_proxy.h | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppb_graphics_3d_proxy.cc | 12 | ||||
-rw-r--r-- | ppapi/proxy/ppb_graphics_3d_proxy.h | 6 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.cc | 1 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.h | 1 | ||||
-rw-r--r-- | ppapi/thunk/resource_creation_api.h | 5 |
16 files changed, 95 insertions, 30 deletions
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index f26aabf..839de2d 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -195,23 +195,6 @@ IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo) IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities) - IPC_STRUCT_TRAITS_MEMBER(post_sub_buffer) - IPC_STRUCT_TRAITS_MEMBER(egl_image_external) - IPC_STRUCT_TRAITS_MEMBER(texture_format_bgra8888) - IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1) - IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1_npot) - IPC_STRUCT_TRAITS_MEMBER(texture_rectangle) - IPC_STRUCT_TRAITS_MEMBER(iosurface) - IPC_STRUCT_TRAITS_MEMBER(texture_usage) - IPC_STRUCT_TRAITS_MEMBER(texture_storage) - IPC_STRUCT_TRAITS_MEMBER(discard_framebuffer) - IPC_STRUCT_TRAITS_MEMBER(sync_query) - IPC_STRUCT_TRAITS_MEMBER(image) - IPC_STRUCT_TRAITS_MEMBER(blend_equation_advanced) - IPC_STRUCT_TRAITS_MEMBER(blend_equation_advanced_coherent) -IPC_STRUCT_TRAITS_END() - IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats) IPC_STRUCT_TRAITS_MEMBER(video_memory) IPC_STRUCT_TRAITS_MEMBER(has_duplicates) diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc index 7111f56..12d1db9 100644 --- a/content/renderer/pepper/ppb_graphics_3d_impl.cc +++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc @@ -85,6 +85,7 @@ PP_Resource PPB_Graphics3D_Impl::CreateRaw( PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state_handle) { PPB_Graphics3D_API* share_api = NULL; if (share_context) { @@ -95,7 +96,8 @@ PP_Resource PPB_Graphics3D_Impl::CreateRaw( } scoped_refptr<PPB_Graphics3D_Impl> graphics_3d( new PPB_Graphics3D_Impl(instance)); - if (!graphics_3d->InitRaw(share_api, attrib_list, shared_state_handle)) + if (!graphics_3d->InitRaw(share_api, attrib_list, capabilities, + shared_state_handle)) return 0; return graphics_3d->GetReference(); } @@ -211,7 +213,7 @@ int32 PPB_Graphics3D_Impl::DoSwapBuffers() { bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list) { - if (!InitRaw(share_context, attrib_list, NULL)) + if (!InitRaw(share_context, attrib_list, NULL, NULL)) return false; gpu::gles2::GLES2Implementation* share_gles2 = NULL; @@ -226,6 +228,7 @@ bool PPB_Graphics3D_Impl::Init(PPB_Graphics3D_API* share_context, bool PPB_Graphics3D_Impl::InitRaw( PPB_Graphics3D_API* share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state_handle) { PepperPluginInstanceImpl* plugin_instance = HostGlobals::Get()->GetInstance(pp_instance()); @@ -297,6 +300,8 @@ bool PPB_Graphics3D_Impl::InitRaw( return false; if (shared_state_handle) *shared_state_handle = command_buffer_->GetSharedStateHandle(); + if (capabilities) + *capabilities = command_buffer_->GetCapabilities(); mailbox_ = gpu::Mailbox::Generate(); if (!command_buffer_->ProduceFrontBuffer(mailbox_)) return false; diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.h b/content/renderer/pepper/ppb_graphics_3d_impl.h index ee9b2b0..5fcd163 100644 --- a/content/renderer/pepper/ppb_graphics_3d_impl.h +++ b/content/renderer/pepper/ppb_graphics_3d_impl.h @@ -11,6 +11,10 @@ #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" #include "ppapi/shared_impl/resource.h" +namespace gpu { +struct Capabilities; +} + namespace content { class CommandBufferProxyImpl; class GpuChannelHost; @@ -24,6 +28,7 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared { PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state_handle); // PPB_Graphics3D_API trusted implementation. @@ -74,6 +79,7 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared { bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); bool InitRaw(PPB_Graphics3D_API* share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state_handle); // Notifications received from the GPU process. diff --git a/content/renderer/pepper/resource_creation_impl.cc b/content/renderer/pepper/resource_creation_impl.cc index bb0b9f1..4a69325 100644 --- a/content/renderer/pepper/resource_creation_impl.cc +++ b/content/renderer/pepper/resource_creation_impl.cc @@ -113,9 +113,10 @@ PP_Resource ResourceCreationImpl::CreateGraphics3DRaw( PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state) { return PPB_Graphics3D_Impl::CreateRaw(instance, share_context, attrib_list, - shared_state); + capabilities, shared_state); } PP_Resource ResourceCreationImpl::CreateHostResolver(PP_Instance instance) { diff --git a/content/renderer/pepper/resource_creation_impl.h b/content/renderer/pepper/resource_creation_impl.h index d1884b9..52c44fc 100644 --- a/content/renderer/pepper/resource_creation_impl.h +++ b/content/renderer/pepper/resource_creation_impl.h @@ -54,6 +54,7 @@ class ResourceCreationImpl : public ppapi::thunk::ResourceCreationAPI { PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state) override; PP_Resource CreateHostResolver(PP_Instance instance) override; PP_Resource CreateHostResolverPrivate(PP_Instance instance) override; diff --git a/gpu/ipc/gpu_command_buffer_traits.cc b/gpu/ipc/gpu_command_buffer_traits.cc index 46395fb..1b30034 100644 --- a/gpu/ipc/gpu_command_buffer_traits.cc +++ b/gpu/ipc/gpu_command_buffer_traits.cc @@ -3,8 +3,27 @@ // found in the LICENSE file. #include "gpu/ipc/gpu_command_buffer_traits.h" + #include "gpu/command_buffer/common/mailbox_holder.h" +// Generate param traits write methods. +#include "ipc/param_traits_write_macros.h" +namespace IPC { +#include "gpu/ipc/gpu_command_buffer_traits_multi.h" +} // namespace IPC + +// Generate param traits read methods. +#include "ipc/param_traits_read_macros.h" +namespace IPC { +#include "gpu/ipc/gpu_command_buffer_traits_multi.h" +} // namespace IPC + +// Generate param traits log methods. +#include "ipc/param_traits_log_macros.h" +namespace IPC { +#include "gpu/ipc/gpu_command_buffer_traits_multi.h" +} // namespace IPC + namespace IPC { void ParamTraits<gpu::CommandBuffer::State> ::Write(Message* m, diff --git a/gpu/ipc/gpu_command_buffer_traits.h b/gpu/ipc/gpu_command_buffer_traits.h index ce854d2..3451639 100644 --- a/gpu/ipc/gpu_command_buffer_traits.h +++ b/gpu/ipc/gpu_command_buffer_traits.h @@ -5,9 +5,10 @@ #ifndef GPU_IPC_GPU_PARAM_TRAITS_H_ #define GPU_IPC_GPU_PARAM_TRAITS_H_ -#include "ipc/ipc_message_utils.h" #include "gpu/command_buffer/common/command_buffer.h" #include "gpu/gpu_export.h" +#include "gpu/ipc/gpu_command_buffer_traits_multi.h" +#include "ipc/ipc_message_utils.h" namespace gpu { struct Mailbox; diff --git a/gpu/ipc/gpu_command_buffer_traits_multi.h b/gpu/ipc/gpu_command_buffer_traits_multi.h new file mode 100644 index 0000000..a2b2006 --- /dev/null +++ b/gpu/ipc/gpu_command_buffer_traits_multi.h @@ -0,0 +1,29 @@ +// Copyright 2014 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. + +// Multiply-included message file, hence no include guard here. +#include "gpu/command_buffer/common/capabilities.h" +#include "gpu/gpu_export.h" +#include "ipc/ipc_message_utils.h" +#include "ipc/param_traits_macros.h" + +#undef IPC_MESSAGE_EXPORT +#define IPC_MESSAGE_EXPORT GPU_EXPORT + +IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities) + IPC_STRUCT_TRAITS_MEMBER(post_sub_buffer) + IPC_STRUCT_TRAITS_MEMBER(egl_image_external) + IPC_STRUCT_TRAITS_MEMBER(texture_format_bgra8888) + IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1) + IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1_npot) + IPC_STRUCT_TRAITS_MEMBER(texture_rectangle) + IPC_STRUCT_TRAITS_MEMBER(iosurface) + IPC_STRUCT_TRAITS_MEMBER(texture_usage) + IPC_STRUCT_TRAITS_MEMBER(texture_storage) + IPC_STRUCT_TRAITS_MEMBER(discard_framebuffer) + IPC_STRUCT_TRAITS_MEMBER(sync_query) + IPC_STRUCT_TRAITS_MEMBER(image) + IPC_STRUCT_TRAITS_MEMBER(blend_equation_advanced) + IPC_STRUCT_TRAITS_MEMBER(blend_equation_advanced_coherent) +IPC_STRUCT_TRAITS_END() diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc index 7a2783a..95500b4 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -16,8 +16,10 @@ namespace proxy { PpapiCommandBufferProxy::PpapiCommandBufferProxy( const ppapi::HostResource& resource, ProxyChannel* channel, + const gpu::Capabilities& capabilities, const SerializedHandle& shared_state) - : resource_(resource), + : capabilities_(capabilities), + resource_(resource), channel_(channel) { shared_state_shm_.reset( new base::SharedMemory(shared_state.shmem(), false)); @@ -190,9 +192,7 @@ void PpapiCommandBufferProxy::SetSurfaceVisible(bool visible) { } gpu::Capabilities PpapiCommandBufferProxy::GetCapabilities() { - // TODO(boliu): Need to implement this to use cc in Pepper. Tracked in - // crbug.com/325391. - return gpu::Capabilities(); + return capabilities_; } int32 PpapiCommandBufferProxy::CreateImage(ClientBuffer buffer, diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h index 23b38e0..b277baf 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -29,6 +29,7 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, public: PpapiCommandBufferProxy(const HostResource& resource, ProxyChannel* channel, + const gpu::Capabilities& capabilities, const SerializedHandle& shared_state); virtual ~PpapiCommandBufferProxy(); @@ -75,6 +76,7 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, // The shared memory area used to update state. gpu::CommandBufferSharedState* shared_state() const; + gpu::Capabilities capabilities_; State last_state_; scoped_ptr<base::SharedMemory> shared_state_shm_; diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index caf8287..484e6c7 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -870,11 +870,12 @@ IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBCore_ReleaseResource, ppapi::HostResource) // PPB_Graphics3D. -IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBGraphics3D_Create, +IPC_SYNC_MESSAGE_ROUTED3_3(PpapiHostMsg_PPBGraphics3D_Create, PP_Instance /* instance */, ppapi::HostResource /* share_context */, std::vector<int32_t> /* attrib_list */, ppapi::HostResource /* result */, + gpu::Capabilities /* capabilities */, ppapi::proxy::SerializedHandle /* shared_state */) IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBGraphics3D_SetGetBuffer, ppapi::HostResource /* context */, diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc index 4e6398d..e55e9ca 100644 --- a/ppapi/proxy/ppb_graphics_3d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc @@ -53,13 +53,14 @@ Graphics3D::~Graphics3D() { } bool Graphics3D::Init(gpu::gles2::GLES2Implementation* share_gles2, + const gpu::Capabilities& capabilities, const SerializedHandle& shared_state) { PluginDispatcher* dispatcher = PluginDispatcher::GetForResource(this); if (!dispatcher) return false; - command_buffer_.reset( - new PpapiCommandBufferProxy(host_resource(), dispatcher, shared_state)); + command_buffer_.reset(new PpapiCommandBufferProxy( + host_resource(), dispatcher, capabilities, shared_state)); return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize, share_gles2); @@ -168,15 +169,16 @@ PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource( attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); HostResource result; + gpu::Capabilities capabilities; ppapi::proxy::SerializedHandle shared_state; dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create(API_ID_PPB_GRAPHICS_3D, - instance, share_host, attribs, &result, &shared_state)); + instance, share_host, attribs, &result, &capabilities, &shared_state)); if (result.is_null()) return 0; scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result)); - if (!graphics_3d->Init(share_gles2, shared_state)) + if (!graphics_3d->Init(share_gles2, capabilities, shared_state)) return 0; return graphics_3d->GetReference(); } @@ -222,6 +224,7 @@ void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, HostResource share_context, const std::vector<int32_t>& attribs, HostResource* result, + gpu::Capabilities* capabilities, SerializedHandle* shared_state) { shared_state->set_null_shmem(); if (attribs.empty() || @@ -240,6 +243,7 @@ void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, enter.functions()->CreateGraphics3DRaw(instance, share_context.host_resource(), &attribs.front(), + capabilities, &handle)); if (!result->is_null()) { shared_state->set_shmem(TransportSHMHandle(dispatcher(), handle), diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h index 2f3f4fb..848281e 100644 --- a/ppapi/proxy/ppb_graphics_3d_proxy.h +++ b/ppapi/proxy/ppb_graphics_3d_proxy.h @@ -18,6 +18,10 @@ #include "ppapi/shared_impl/resource.h" #include "ppapi/utility/completion_callback_factory.h" +namespace gpu { +struct Capabilities; +} + namespace ppapi { class HostResource; @@ -33,6 +37,7 @@ class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared { virtual ~Graphics3D(); bool Init(gpu::gles2::GLES2Implementation* share_gles2, + const gpu::Capabilities& capabilities, const SerializedHandle& shared_state); // Graphics3DTrusted API. These are not implemented in the proxy. @@ -81,6 +86,7 @@ class PPB_Graphics3D_Proxy : public InterfaceProxy { HostResource share_context, const std::vector<int32_t>& attribs, HostResource* result, + gpu::Capabilities* capabilities, SerializedHandle* handle); void OnMsgSetGetBuffer(const HostResource& context, int32 id); diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index 5f014bf..99e890b1 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -253,6 +253,7 @@ PP_Resource ResourceCreationProxy::CreateGraphics3DRaw( PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state) { // Not proxied. The raw creation function is used only in the implementation // of the proxy on the host side. diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index c77c451..a3e633e 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -120,6 +120,7 @@ class ResourceCreationProxy : public InterfaceProxy, PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state) override; virtual PP_Resource CreateHostResolver(PP_Instance instance) override; virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) override; diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index 99697c4..11dcc82 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -32,6 +32,10 @@ struct PP_NetAddress_IPv6; struct PP_NetAddress_Private; struct PP_Size; +namespace gpu { +struct Capabilities; +} + namespace ppapi { struct FileRefCreateInfo; @@ -134,6 +138,7 @@ class ResourceCreationAPI { PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list, + gpu::Capabilities* capabilities, base::SharedMemoryHandle* shared_state) = 0; virtual PP_Resource CreateHostResolver(PP_Instance instance) = 0; virtual PP_Resource CreateHostResolverPrivate(PP_Instance instance) = 0; |