diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/gpu_create_command_buffer_config.h | 27 | ||||
-rw-r--r-- | chrome/common/gpu_messages.cc | 23 | ||||
-rw-r--r-- | chrome/common/gpu_messages_internal.h | 7 | ||||
-rw-r--r-- | chrome/common/gpu_param_traits.h | 10 | ||||
-rw-r--r-- | chrome/gpu/gpu_channel.cc | 19 | ||||
-rw-r--r-- | chrome/gpu/gpu_channel.h | 20 | ||||
-rw-r--r-- | chrome/gpu/gpu_command_buffer_stub.cc | 23 | ||||
-rw-r--r-- | chrome/gpu/gpu_command_buffer_stub.h | 3 | ||||
-rw-r--r-- | chrome/gpu/gpu_video_decoder_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/plugin/command_buffer_stub.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/ggl/ggl.cc | 18 | ||||
-rw-r--r-- | chrome/renderer/ggl/ggl.h | 4 | ||||
-rw-r--r-- | chrome/renderer/gpu_channel_host.cc | 19 | ||||
-rw-r--r-- | chrome/renderer/gpu_channel_host.h | 8 | ||||
-rw-r--r-- | chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc | 16 |
15 files changed, 152 insertions, 53 deletions
diff --git a/chrome/common/gpu_create_command_buffer_config.h b/chrome/common/gpu_create_command_buffer_config.h new file mode 100644 index 0000000..8a2525f --- /dev/null +++ b/chrome/common/gpu_create_command_buffer_config.h @@ -0,0 +1,27 @@ +// Copyright (c) 2010 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. + +#ifndef CHROME_COMMON_GPU_CREATE_COMMAND_BUFFER_CONFIG_H_ +#define CHROME_COMMON_GPU_CREATE_COMMAND_BUFFER_CONFIG_H_ +#pragma once + +#include <string> +#include <vector> + +// Parameters passed when initializing a GPU channel. +struct GPUCreateCommandBufferConfig { + GPUCreateCommandBufferConfig() { } + + GPUCreateCommandBufferConfig( + const std::string& _allowed_extensions, + const std::vector<int>& _attribs) + : allowed_extensions(_allowed_extensions), + attribs(_attribs) { + } + + std::string allowed_extensions; + std::vector<int> attribs; +}; + +#endif // CHROME_COMMON_GPU_CREATE_COMMAND_BUFFER_CONFIG_H_ diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc index 893f8c9..db7f597 100644 --- a/chrome/common/gpu_messages.cc +++ b/chrome/common/gpu_messages.cc @@ -4,6 +4,7 @@ #include "chrome/common/gpu_messages.h" +#include "chrome/common/gpu_create_command_buffer_config.h" #include "chrome/common/gpu_info.h" #include "chrome/common/dx_diag_node.h" #include "gfx/rect.h" @@ -185,4 +186,24 @@ void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, l->append("<CommandBuffer::State>"); } -} // namespace IPC +void ParamTraits<GPUCreateCommandBufferConfig> ::Write( + Message* m, const param_type& p) { + m->WriteString(p.allowed_extensions); + ParamTraits<std::vector<int> > ::Write(m, p.attribs); +} + +bool ParamTraits<GPUCreateCommandBufferConfig> ::Read( + const Message* m, void** iter, param_type* p) { + if (!m->ReadString(iter, &p->allowed_extensions) || + !ParamTraits<std::vector<int> > ::Read(m, iter, &p->attribs)) { + return false; + } + return true; +} + +void ParamTraits<GPUCreateCommandBufferConfig> ::Log( + const param_type& p, std::string* l) { + l->append("<GPUCreateCommandBufferConfig>"); +} + +} // namespace IPC diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h index b95a534..184d8f4 100644 --- a/chrome/common/gpu_messages_internal.h +++ b/chrome/common/gpu_messages_internal.h @@ -10,6 +10,7 @@ // from it via utility_messages.h. #include <vector> +#include <string> #include "base/shared_memory.h" #include "chrome/common/gpu_video_common.h" @@ -23,6 +24,7 @@ namespace IPC { struct ChannelHandle; } +struct GPUCreateCommandBufferConfig; class GPUInfo; //------------------------------------------------------------------------------ @@ -157,9 +159,10 @@ IPC_BEGIN_MESSAGES(GpuChannel) // to a native view. The |render_view_id| is currently needed only on Mac OS // X in order to identify the window on the browser side into which the // rendering results go. A corresponding GpuCommandBufferStub is created. - IPC_SYNC_MESSAGE_CONTROL2_1(GpuChannelMsg_CreateViewCommandBuffer, + IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateViewCommandBuffer, gfx::NativeViewId, /* view */ int32, /* render_view_id */ + GPUCreateCommandBufferConfig, /* init_params */ int32 /* route_id */) // Tells the GPU process to create a new command buffer that renders to an @@ -170,7 +173,7 @@ IPC_BEGIN_MESSAGES(GpuChannel) IPC_SYNC_MESSAGE_CONTROL4_1(GpuChannelMsg_CreateOffscreenCommandBuffer, int32, /* parent_route_id */ gfx::Size, /* size */ - std::vector<int>, /* attribs */ + GPUCreateCommandBufferConfig, /* init_params */ uint32, /* parent_texture_id */ int32 /* route_id */) diff --git a/chrome/common/gpu_param_traits.h b/chrome/common/gpu_param_traits.h index f2c4e02..59885ea 100644 --- a/chrome/common/gpu_param_traits.h +++ b/chrome/common/gpu_param_traits.h @@ -10,6 +10,7 @@ #include "base/process.h" #include "chrome/common/common_param_traits.h" #include "chrome/common/dx_diag_node.h" +#include "chrome/common/gpu_create_command_buffer_config.h" #include "chrome/common/gpu_info.h" #include "chrome/common/gpu_native_window_handle.h" #include "gfx/native_widget_types.h" @@ -67,6 +68,15 @@ struct ParamTraits<gpu::CommandBuffer::State> { static bool Read(const Message* m, void** iter, param_type* p); static void Log(const param_type& p, std::string* l); }; + +template <> +struct ParamTraits<GPUCreateCommandBufferConfig> { + typedef GPUCreateCommandBufferConfig param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + } // namespace IPC #endif // CHROME_COMMON_GPU_PARAM_TRAITS_H_ diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc index fc2c09c..1ff2598 100644 --- a/chrome/gpu/gpu_channel.cc +++ b/chrome/gpu/gpu_channel.cc @@ -102,9 +102,11 @@ int GpuChannel::GenerateRouteID() { return ++last_id; } -void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id, - int32 render_view_id, - int32* route_id) { +void GpuChannel::OnCreateViewCommandBuffer( + gfx::NativeViewId view_id, + int32 render_view_id, + const GPUCreateCommandBufferConfig& init_params, + int32* route_id) { *route_id = 0; #if defined(ENABLE_GPU) @@ -143,11 +145,9 @@ void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id, #endif *route_id = GenerateRouteID(); - // TODO(enne): implement context creation attributes for view buffers - std::vector<int32> attribs; scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( - this, handle, NULL, gfx::Size(), attribs, 0, *route_id, - renderer_id_, render_view_id)); + this, handle, NULL, gfx::Size(), init_params.allowed_extensions, + init_params.attribs, 0, *route_id, renderer_id_, render_view_id)); router_.AddRoute(*route_id, stub.get()); stubs_.AddWithID(stub.release(), *route_id); #endif // ENABLE_GPU @@ -156,7 +156,7 @@ void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id, void GpuChannel::OnCreateOffscreenCommandBuffer( int32 parent_route_id, const gfx::Size& size, - const std::vector<int32>& attribs, + const GPUCreateCommandBufferConfig& init_params, uint32 parent_texture_id, int32* route_id) { #if defined(ENABLE_GPU) @@ -170,7 +170,8 @@ void GpuChannel::OnCreateOffscreenCommandBuffer( gfx::kNullPluginWindow, parent_stub, size, - attribs, + init_params.allowed_extensions, + init_params.attribs, parent_texture_id, *route_id, 0, 0)); diff --git a/chrome/gpu/gpu_channel.h b/chrome/gpu/gpu_channel.h index e7cb1db..f359777 100644 --- a/chrome/gpu/gpu_channel.h +++ b/chrome/gpu/gpu_channel.h @@ -13,6 +13,7 @@ #include "base/scoped_open_process.h" #include "base/scoped_ptr.h" #include "build/build_config.h" +#include "chrome/common/gpu_create_command_buffer_config.h" #include "chrome/common/gpu_video_common.h" #include "chrome/common/message_router.h" #include "chrome/gpu/gpu_command_buffer_stub.h" @@ -65,14 +66,17 @@ class GpuChannel : public IPC::Channel::Listener, int GenerateRouteID(); // Message handlers. - void OnCreateViewCommandBuffer(gfx::NativeViewId view, - int32 render_view_id, - int32* route_id); - void OnCreateOffscreenCommandBuffer(int32 parent_route_id, - const gfx::Size& size, - const std::vector<int32>& attribs, - uint32 parent_texture_id, - int32* route_id); + void OnCreateViewCommandBuffer( + gfx::NativeViewId view, + int32 render_view_id, + const GPUCreateCommandBufferConfig& init_params, + int32* route_id); + void OnCreateOffscreenCommandBuffer( + int32 parent_route_id, + const gfx::Size& size, + const GPUCreateCommandBufferConfig& init_params, + uint32 parent_texture_id, + int32* route_id); void OnDestroyCommandBuffer(int32 route_id); void OnCreateVideoDecoder(int32 context_route_id, diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc index 040dcef..f6118fa 100644 --- a/chrome/gpu/gpu_command_buffer_stub.cc +++ b/chrome/gpu/gpu_command_buffer_stub.cc @@ -14,15 +14,17 @@ using gpu::Buffer; -GpuCommandBufferStub::GpuCommandBufferStub(GpuChannel* channel, - gfx::PluginWindowHandle handle, - GpuCommandBufferStub* parent, - const gfx::Size& size, - const std::vector<int32>& attribs, - uint32 parent_texture_id, - int32 route_id, - int32 renderer_id, - int32 render_view_id) +GpuCommandBufferStub::GpuCommandBufferStub( + GpuChannel* channel, + gfx::PluginWindowHandle handle, + GpuCommandBufferStub* parent, + const gfx::Size& size, + const std::string& allowed_extensions, + const std::vector<int32>& attribs, + uint32 parent_texture_id, + int32 route_id, + int32 renderer_id, + int32 render_view_id) : channel_(channel), handle_(handle), parent_( @@ -82,10 +84,11 @@ void GpuCommandBufferStub::OnInitialize( if (buffer.shared_memory) { gpu::GPUProcessor* parent_processor = parent_ ? parent_->processor_.get() : NULL; - processor_.reset(new gpu::GPUProcessor(command_buffer_.get())); + processor_.reset(new gpu::GPUProcessor(command_buffer_.get(), NULL)); if (processor_->Initialize( handle_, initial_size_, + allowed_extensions_.c_str(), requested_attribs_, parent_processor, parent_texture_id_)) { diff --git a/chrome/gpu/gpu_command_buffer_stub.h b/chrome/gpu/gpu_command_buffer_stub.h index f217469..fe8b743 100644 --- a/chrome/gpu/gpu_command_buffer_stub.h +++ b/chrome/gpu/gpu_command_buffer_stub.h @@ -9,6 +9,7 @@ #if defined(ENABLE_GPU) #include <vector> +#include <string> #include "base/process.h" #include "base/weak_ptr.h" @@ -30,6 +31,7 @@ class GpuCommandBufferStub gfx::PluginWindowHandle handle, GpuCommandBufferStub* parent, const gfx::Size& size, + const std::string& allowed_extensions, const std::vector<int32>& attribs, uint32 parent_texture_id, int32 route_id, @@ -78,6 +80,7 @@ class GpuCommandBufferStub gfx::PluginWindowHandle handle_; base::WeakPtr<GpuCommandBufferStub> parent_; gfx::Size initial_size_; + std::string allowed_extensions_; std::vector<int32> requested_attribs_; uint32 parent_texture_id_; int32 route_id_; diff --git a/chrome/gpu/gpu_video_decoder_unittest.cc b/chrome/gpu/gpu_video_decoder_unittest.cc index 893d07b..30f1664 100644 --- a/chrome/gpu/gpu_video_decoder_unittest.cc +++ b/chrome/gpu/gpu_video_decoder_unittest.cc @@ -5,7 +5,6 @@ #include "base/process.h" #include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_video_decoder.h" -#include "gpu/command_buffer/service/context_group.h" #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" #include "ipc/ipc_message_utils.h" #include "media/video/mock_objects.h" @@ -70,7 +69,7 @@ class GpuVideoDecoderTest : public testing::Test, public: GpuVideoDecoderTest() { // Create the mock objects. - gles2_decoder_.reset(new gpu::gles2::MockGLES2Decoder(&group_)); + gles2_decoder_.reset(new gpu::gles2::MockGLES2Decoder()); gpu_video_decoder_ = new GpuVideoDecoder( &message_loop_, kDecoderHostId, this, base::kNullProcessHandle, @@ -227,7 +226,6 @@ class GpuVideoDecoderTest : public testing::Test, scoped_refptr<GpuVideoDecoder> gpu_video_decoder_; MockGpuVideoDevice* mock_device_; media::MockVideoDecodeEngine* mock_engine_; - gpu::gles2::ContextGroup group_; scoped_ptr<gpu::gles2::MockGLES2Decoder> gles2_decoder_; std::vector<scoped_refptr<media::VideoFrame> > decoder_frames_; scoped_refptr<media::VideoFrame> device_frame_; diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc index 7f699ba..77f8e13 100644 --- a/chrome/plugin/command_buffer_stub.cc +++ b/chrome/plugin/command_buffer_stub.cc @@ -92,8 +92,8 @@ void CommandBufferStub::OnInitialize(int32 size, } // Initialize the GPUProcessor. - processor_.reset(new gpu::GPUProcessor(command_buffer_.get())); - if (!processor_->Initialize(window_, gfx::Size(), std::vector<int32>(), + processor_.reset(new gpu::GPUProcessor(command_buffer_.get(), NULL)); + if (!processor_->Initialize(window_, gfx::Size(), NULL, std::vector<int32>(), NULL, 0)) { Destroy(); return; diff --git a/chrome/renderer/ggl/ggl.cc b/chrome/renderer/ggl/ggl.cc index f69e3c3..0589852 100644 --- a/chrome/renderer/ggl/ggl.cc +++ b/chrome/renderer/ggl/ggl.cc @@ -64,6 +64,7 @@ class Context : public base::SupportsWeakPtr<Context> { bool Initialize(gfx::NativeViewId view, int render_view_id, const gfx::Size& size, + const char* allowed_extensions, const int32* attrib_list); #if defined(OS_MACOSX) @@ -151,6 +152,7 @@ Context::~Context() { bool Context::Initialize(gfx::NativeViewId view, int render_view_id, const gfx::Size& size, + const char* allowed_extensions, const int32* attrib_list) { DCHECK(size.width() >= 0 && size.height() >= 0); @@ -199,15 +201,18 @@ bool Context::Initialize(gfx::NativeViewId view, // Create a proxy to a command buffer in the GPU process. if (view) { - // TODO(enne): this call should also handle attribs - command_buffer_ = - channel_->CreateViewCommandBuffer(view, render_view_id); + command_buffer_ = channel_->CreateViewCommandBuffer( + view, + render_view_id, + allowed_extensions, + attribs); } else { CommandBufferProxy* parent_command_buffer = parent_.get() ? parent_->command_buffer_ : NULL; command_buffer_ = channel_->CreateOffscreenCommandBuffer( parent_command_buffer, size, + allowed_extensions, attribs, parent_texture_id_); } @@ -408,10 +413,12 @@ void Context::OnSwapBuffers() { Context* CreateViewContext(GpuChannelHost* channel, gfx::NativeViewId view, int render_view_id, + const char* allowed_extensions, const int32* attrib_list) { #if defined(ENABLE_GPU) scoped_ptr<Context> context(new Context(channel, NULL)); - if (!context->Initialize(view, render_view_id, gfx::Size(), attrib_list)) + if (!context->Initialize( + view, render_view_id, gfx::Size(), allowed_extensions, attrib_list)) return NULL; return context.release(); @@ -431,10 +438,11 @@ void ResizeOnscreenContext(Context* context, const gfx::Size& size) { Context* CreateOffscreenContext(GpuChannelHost* channel, Context* parent, const gfx::Size& size, + const char* allowed_extensions, const int32* attrib_list) { #if defined(ENABLE_GPU) scoped_ptr<Context> context(new Context(channel, parent)); - if (!context->Initialize(0, 0, size, attrib_list)) + if (!context->Initialize(0, 0, size, allowed_extensions, attrib_list)) return NULL; return context.release(); diff --git a/chrome/renderer/ggl/ggl.h b/chrome/renderer/ggl/ggl.h index b535306..1d53f57 100644 --- a/chrome/renderer/ggl/ggl.h +++ b/chrome/renderer/ggl/ggl.h @@ -19,10 +19,8 @@ class GpuChannelHost; class MessageLoop; namespace media { - class VideoDecodeContext; class VideoDecodeEngine; - } namespace ggl { @@ -78,6 +76,7 @@ bool Terminate(); Context* CreateViewContext(GpuChannelHost* channel, gfx::NativeViewId view, int render_view_id, + const char* allowed_extensions, const int32* attrib_list); #if defined(OS_MACOSX) @@ -97,6 +96,7 @@ void ResizeOnscreenContext(Context* context, const gfx::Size& size); Context* CreateOffscreenContext(GpuChannelHost* channel, Context* parent, const gfx::Size& size, + const char* allowed_extensions, const int32* attrib_list); // Resize an offscreen frame buffer. The resize occurs on the next call to diff --git a/chrome/renderer/gpu_channel_host.cc b/chrome/renderer/gpu_channel_host.cc index de89774..0532d2e 100644 --- a/chrome/renderer/gpu_channel_host.cc +++ b/chrome/renderer/gpu_channel_host.cc @@ -5,6 +5,7 @@ #include "chrome/renderer/gpu_channel_host.h" #include "chrome/common/child_process.h" +#include "chrome/common/gpu_create_command_buffer_config.h" #include "chrome/common/gpu_messages.h" #include "chrome/renderer/command_buffer_proxy.h" #include "chrome/renderer/gpu_video_service_host.h" @@ -84,16 +85,22 @@ bool GpuChannelHost::Send(IPC::Message* message) { } CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( - gfx::NativeViewId view, int render_view_id) { + gfx::NativeViewId view, + int render_view_id, + const std::string& allowed_extensions, + const std::vector<int32>& attribs) { #if defined(ENABLE_GPU) // An error occurred. Need to get the host again to reinitialize it. if (!channel_.get()) return NULL; + GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs); int32 route_id; - if (!Send(new GpuChannelMsg_CreateViewCommandBuffer(view, - render_view_id, - &route_id)) && + if (!Send(new GpuChannelMsg_CreateViewCommandBuffer( + view, + render_view_id, + init_params, + &route_id)) && route_id != MSG_ROUTING_NONE) { return NULL; } @@ -110,6 +117,7 @@ CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( CommandBufferProxy* parent, const gfx::Size& size, + const std::string& allowed_extensions, const std::vector<int32>& attribs, uint32 parent_texture_id) { #if defined(ENABLE_GPU) @@ -117,11 +125,12 @@ CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( if (!channel_.get()) return NULL; + GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs); int32 parent_route_id = parent ? parent->route_id() : 0; int32 route_id; if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(parent_route_id, size, - attribs, + init_params, parent_texture_id, &route_id)) && route_id != MSG_ROUTING_NONE) { diff --git a/chrome/renderer/gpu_channel_host.h b/chrome/renderer/gpu_channel_host.h index e6eecea..75152ba 100644 --- a/chrome/renderer/gpu_channel_host.h +++ b/chrome/renderer/gpu_channel_host.h @@ -60,13 +60,17 @@ class GpuChannelHost : public IPC::Channel::Listener, virtual bool Send(IPC::Message* msg); // Create and connect to a command buffer in the GPU process. - CommandBufferProxy* CreateViewCommandBuffer(gfx::NativeViewId view, - int render_view_id); + CommandBufferProxy* CreateViewCommandBuffer( + gfx::NativeViewId view, + int render_view_id, + const std::string& allowed_extensions, + const std::vector<int32>& attribs); // Create and connect to a command buffer in the GPU process. CommandBufferProxy* CreateOffscreenCommandBuffer( CommandBufferProxy* parent, const gfx::Size& size, + const std::string& allowed_extensions, const std::vector<int32>& attribs, uint32 parent_texture_id); diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc index 8254c290..67e26c7 100644 --- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc +++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc @@ -54,6 +54,11 @@ WebGraphicsContext3DCommandBufferImpl:: } } +static const char* kWebGraphicsContext3DPerferredGLExtensions = + "GL_EXT_packed_depth_stencil " + "GL_OES_packed_depth_stencil " + "GL_OES_depth24"; + bool WebGraphicsContext3DCommandBufferImpl::initialize( WebGraphicsContext3D::Attributes attributes, WebKit::WebView* web_view, @@ -98,6 +103,7 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( host, view_id, renderview->routing_id(), + kWebGraphicsContext3DPerferredGLExtensions, attribs); } else { bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( @@ -117,10 +123,12 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( parent_context = context_impl->context_; } } - context_ = ggl::CreateOffscreenContext(host, - parent_context, - gfx::Size(1, 1), - attribs); + context_ = ggl::CreateOffscreenContext( + host, + parent_context, + gfx::Size(1, 1), + kWebGraphicsContext3DPerferredGLExtensions, + attribs); web_view_ = NULL; } if (!context_) |