diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 22:30:07 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 22:30:07 +0000 |
commit | e608ce0911ee1764b93d8cd667d6eabbd083ab96 (patch) | |
tree | 1438be09f2e2dee426a3bff149a51cd826358cd7 /content | |
parent | c5651f4a4e0581a53525ad59bfb1fecfeb6ed6bb (diff) | |
download | chromium_src-e608ce0911ee1764b93d8cd667d6eabbd083ab96.zip chromium_src-e608ce0911ee1764b93d8cd667d6eabbd083ab96.tar.gz chromium_src-e608ce0911ee1764b93d8cd667d6eabbd083ab96.tar.bz2 |
Add the ability to share GL contexts across channels.
This is patch 1 of many to enable the use of the GPU process for the browser UI.
Before this, all contexts within one channel were shared, but not across channels. With this patch channels can choose to share contexts with other ones.
This patch also renames the various "renderer_id" to "client_id", since the GPU process doesn't care that the other side is a renderer or not.
BUG=99516
TEST=None yet, but will come with later patches
Review URL: http://codereview.chromium.org/9107033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/gpu/gpu_process_host.cc | 24 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.h | 14 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.cc | 14 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.h | 4 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel.cc | 17 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel.h | 7 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel_manager.cc | 26 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel_manager.h | 12 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 8 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.h | 8 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 23 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface.cc | 26 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface.h | 10 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface_linux.cc | 28 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface_mac.cc | 20 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface_win.cc | 12 |
16 files changed, 132 insertions, 121 deletions
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 480bd9d..cc70bed 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -74,11 +74,11 @@ void ReleasePermanentXIDDispatcher(gfx::PluginWindowHandle surface) { #endif -void SendGpuProcessMessage(int renderer_id, +void SendGpuProcessMessage(int client_id, content::CauseForGpuLaunch cause, IPC::Message* message) { GpuProcessHost* host = GpuProcessHost::GetForRenderer( - renderer_id, cause); + client_id, cause); if (host) { host->Send(message); } else { @@ -183,7 +183,7 @@ static bool HostIsValid(GpuProcessHost* host) { // static GpuProcessHost* GpuProcessHost::GetForRenderer( - int renderer_id, content::CauseForGpuLaunch cause) { + int client_id, content::CauseForGpuLaunch cause) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Don't grant further access to GPU if it is not allowed. @@ -221,13 +221,13 @@ GpuProcessHost* GpuProcessHost::GetForRenderer( } // static -void GpuProcessHost::SendOnIO(int renderer_id, +void GpuProcessHost::SendOnIO(int client_id, content::CauseForGpuLaunch cause, IPC::Message* message) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( - &SendGpuProcessMessage, renderer_id, cause, message)); + &SendGpuProcessMessage, client_id, cause, message)); } // static @@ -379,7 +379,7 @@ void GpuProcessHost::OnChannelConnected(int32 peer_pid) { } void GpuProcessHost::EstablishGpuChannel( - int renderer_id, + int client_id, const EstablishChannelCallback& callback) { DCHECK(CalledOnValidThread()); TRACE_EVENT0("gpu", "GpuProcessHostUIShim::EstablishGpuChannel"); @@ -392,7 +392,7 @@ void GpuProcessHost::EstablishGpuChannel( return; } - if (Send(new GpuMsg_EstablishChannel(renderer_id))) { + if (Send(new GpuMsg_EstablishChannel(client_id, 0))) { channel_requests_.push(callback); } else { EstablishChannelError( @@ -404,13 +404,13 @@ void GpuProcessHost::EstablishGpuChannel( void GpuProcessHost::CreateViewCommandBuffer( gfx::PluginWindowHandle compositing_surface, int32 render_view_id, - int32 renderer_id, + int32 client_id, const GPUCreateCommandBufferConfig& init_params, const CreateCommandBufferCallback& callback) { DCHECK(CalledOnValidThread()); #if defined(TOOLKIT_USES_GTK) - ViewID view_id(renderer_id, render_view_id); + ViewID view_id(client_id, render_view_id); // There should only be one such command buffer (for the compositor). In // practice, if the GPU process lost a context, GraphicsContext3D with @@ -426,7 +426,7 @@ void GpuProcessHost::CreateViewCommandBuffer( if (compositing_surface != gfx::kNullPluginWindow && Send(new GpuMsg_CreateViewCommandBuffer( - compositing_surface, render_view_id, renderer_id, init_params))) { + compositing_surface, render_view_id, client_id, init_params))) { create_command_buffer_requests_.push(callback); #if defined(TOOLKIT_USES_GTK) surface_refs_.insert(std::pair<ViewID, linked_ptr<SurfaceRef> >( @@ -479,10 +479,10 @@ void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) { } void GpuProcessHost::OnDestroyCommandBuffer( - gfx::PluginWindowHandle window, int32 renderer_id, + gfx::PluginWindowHandle window, int32 client_id, int32 render_view_id) { #if defined(TOOLKIT_USES_GTK) - ViewID view_id(renderer_id, render_view_id); + ViewID view_id(client_id, render_view_id); SurfaceRefMap::iterator it = surface_refs_.find(view_id); if (it != surface_refs_.end()) surface_refs_.erase(it); diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index e383e0c..295803a 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -37,13 +37,13 @@ class GpuProcessHost : public BrowserChildProcessHost, // has returned to the message loop as it can be destroyed. Instead store the // associated GPU host ID. A renderer ID of zero means the browser process. // This could return NULL if GPU access is not allowed (blacklisted). - static GpuProcessHost* GetForRenderer(int renderer_id, + static GpuProcessHost* GetForRenderer(int client_id, content::CauseForGpuLaunch cause); // Helper function to send the given message to the GPU process on the IO // thread. Calls GetForRenderer and if a host is returned, sends it. // Can be called from any thread. - CONTENT_EXPORT static void SendOnIO(int renderer_id, + CONTENT_EXPORT static void SendOnIO(int client_id, content::CauseForGpuLaunch cause, IPC::Message* message); @@ -67,7 +67,7 @@ class GpuProcessHost : public BrowserChildProcessHost, // renderer. Once the GPU process responds asynchronously with the IPC handle // and GPUInfo, we call the callback. void EstablishGpuChannel( - int renderer_id, const EstablishChannelCallback& callback); + int client_id, const EstablishChannelCallback& callback); typedef base::Callback<void(int32)> CreateCommandBufferCallback; @@ -76,7 +76,7 @@ class GpuProcessHost : public BrowserChildProcessHost, void CreateViewCommandBuffer( gfx::PluginWindowHandle compositing_surface, int32 render_view_id, - int32 renderer_id, + int32 client_id, const GPUCreateCommandBufferConfig& init_params, const CreateCommandBufferCallback& callback); @@ -101,7 +101,7 @@ class GpuProcessHost : public BrowserChildProcessHost, void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); void OnCommandBufferCreated(const int32 route_id); void OnDestroyCommandBuffer( - gfx::PluginWindowHandle window, int32 renderer_id, int32 render_view_id); + gfx::PluginWindowHandle window, int32 client_id, int32 render_view_id); bool LaunchGpuProcess(const std::string& channel_id); @@ -125,7 +125,7 @@ class GpuProcessHost : public BrowserChildProcessHost, std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; #if defined(TOOLKIT_USES_GTK) - typedef std::pair<int32 /* renderer_id */, + typedef std::pair<int32 /* client_id */, int32 /* render_view_id */> ViewID; // Encapsulates surfaces that we lock when creating view command buffers. diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index 0dda528..488553d 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -226,7 +226,7 @@ void GpuProcessHostUIShim::OnGraphicsInfoCollected( #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) -void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, +void GpuProcessHostUIShim::OnResizeView(int32 client_id, int32 render_view_id, int32 route_id, gfx::Size size) { @@ -237,7 +237,7 @@ void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, host_id_, new AcceleratedSurfaceMsg_ResizeViewACK(route_id)); - RenderWidgetHostView* view = GetRenderWidgetHostViewFromID(renderer_id, + RenderWidgetHostView* view = GetRenderWidgetHostViewFromID(client_id, render_view_id); if (!view) return; @@ -282,7 +282,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceNew( TransportDIB::DefaultHandleValue())); RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; @@ -337,7 +337,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; @@ -357,7 +357,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( new AcceleratedSurfaceMsg_PostSubBufferACK(params.route_id)); RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; @@ -372,7 +372,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; view->AcceleratedSurfaceRelease(params.identifier); diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h index 6d84251..119a802 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.h +++ b/content/browser/gpu/gpu_process_host_ui_shim.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -83,7 +83,7 @@ class GpuProcessHostUIShim void OnLogMessage(int level, const std::string& header, const std::string& message); #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) - void OnResizeView(int32 renderer_id, + void OnResizeView(int32 client_id, int32 render_view_id, int32 route_id, gfx::Size size); diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index a53ed72..69b2aca 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -31,13 +31,14 @@ const int64 kHandleMoreWorkPeriod = 1; GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, GpuWatchdog* watchdog, - int renderer_id, + gfx::GLShareGroup* share_group, + int client_id, bool software) : gpu_channel_manager_(gpu_channel_manager), - renderer_id_(renderer_id), + client_id_(client_id), renderer_process_(base::kNullProcessHandle), renderer_pid_(base::kNullProcessId), - share_group_(new gfx::GLShareGroup), + share_group_(share_group ? share_group : new gfx::GLShareGroup), watchdog_(watchdog), software_(software), handle_messages_scheduled_(false), @@ -45,7 +46,7 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, num_contexts_preferring_discrete_gpu_(0), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { DCHECK(gpu_channel_manager); - DCHECK(renderer_id); + DCHECK(client_id); static int last_channel_id = 0; channel_id_ = ++last_channel_id; @@ -110,7 +111,7 @@ bool GpuChannel::OnMessageReceived(const IPC::Message& message) { } void GpuChannel::OnChannelError() { - gpu_channel_manager_->RemoveChannel(renderer_id_); + gpu_channel_manager_->RemoveChannel(client_id_); } void GpuChannel::OnChannelConnected(int32 peer_pid) { @@ -171,7 +172,7 @@ void GpuChannel::DestroySoon() { void GpuChannel::OnDestroy() { TRACE_EVENT0("gpu", "GpuChannel::OnDestroy"); - gpu_channel_manager_->RemoveChannel(renderer_id_); + gpu_channel_manager_->RemoveChannel(client_id_); } void GpuChannel::CreateViewCommandBuffer( @@ -198,7 +199,7 @@ void GpuChannel::CreateViewCommandBuffer( init_params.attribs, init_params.gpu_preference, *route_id, - renderer_id_, + client_id_, render_view_id, watchdog_, software_)); @@ -394,7 +395,7 @@ void GpuChannel::OnWillGpuSwitchOccur(bool is_creating_context, } void GpuChannel::OnCloseChannel() { - gpu_channel_manager_->RemoveChannel(renderer_id_); + gpu_channel_manager_->RemoveChannel(client_id_); // At this point "this" is deleted! } diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h index c15067b..1e7ab78 100644 --- a/content/common/gpu/gpu_channel.h +++ b/content/common/gpu/gpu_channel.h @@ -41,7 +41,8 @@ class GpuChannel : public IPC::Channel::Listener, // Takes ownership of the renderer process handle. GpuChannel(GpuChannelManager* gpu_channel_manager, GpuWatchdog* watchdog, - int renderer_id, + gfx::GLShareGroup* share_group, + int client_id, bool software); virtual ~GpuChannel(); @@ -141,8 +142,8 @@ class GpuChannel : public IPC::Channel::Listener, std::deque<IPC::Message*> deferred_messages_; - // The id of the renderer who is on the other side of the channel. - int renderer_id_; + // The id of the client who is on the other side of the channel. + int client_id_; // Uniquely identifies the channel within this GPU process. int channel_id_; diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc index 44c946e..880d741 100644 --- a/content/common/gpu/gpu_channel_manager.cc +++ b/content/common/gpu/gpu_channel_manager.cc @@ -27,8 +27,8 @@ GpuChannelManager::~GpuChannelManager() { gpu_channels_.clear(); } -void GpuChannelManager::RemoveChannel(int renderer_id) { - gpu_channels_.erase(renderer_id); +void GpuChannelManager::RemoveChannel(int client_id) { + gpu_channels_.erase(client_id); } int GpuChannelManager::GenerateRouteID() { @@ -45,8 +45,8 @@ void GpuChannelManager::RemoveRoute(int32 routing_id) { gpu_child_thread_->RemoveRoute(routing_id); } -GpuChannel* GpuChannelManager::LookupChannel(int32 renderer_id) { - GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); +GpuChannel* GpuChannelManager::LookupChannel(int32 client_id) { + GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); if (iter == gpu_channels_.end()) return NULL; else @@ -70,15 +70,23 @@ bool GpuChannelManager::Send(IPC::Message* msg) { return gpu_child_thread_->Send(msg); } -void GpuChannelManager::OnEstablishChannel(int renderer_id) { +void GpuChannelManager::OnEstablishChannel(int client_id, int share_client_id) { IPC::ChannelHandle channel_handle; + gfx::GLShareGroup* share_group = NULL; + if (share_client_id) { + GpuChannel* share_channel = gpu_channels_[share_client_id]; + DCHECK(share_channel); + share_group = share_channel->share_group(); + } + scoped_refptr<GpuChannel> channel = new GpuChannel(this, watchdog_, - renderer_id, + share_group, + client_id, false); if (channel->Init(io_message_loop_, shutdown_event_)) { - gpu_channels_[renderer_id] = channel; + gpu_channels_[client_id] = channel; channel_handle.name = channel->GetChannelName(); #if defined(OS_POSIX) @@ -109,12 +117,12 @@ void GpuChannelManager::OnCloseChannel( void GpuChannelManager::OnCreateViewCommandBuffer( gfx::PluginWindowHandle window, int32 render_view_id, - int32 renderer_id, + int32 client_id, const GPUCreateCommandBufferConfig& init_params) { DCHECK(render_view_id); int32 route_id = MSG_ROUTING_NONE; - GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); + GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); if (iter != gpu_channels_.end()) { iter->second->CreateViewCommandBuffer( window, render_view_id, init_params, &route_id); diff --git a/content/common/gpu/gpu_channel_manager.h b/content/common/gpu/gpu_channel_manager.h index db0db36..f48c538 100644 --- a/content/common/gpu/gpu_channel_manager.h +++ b/content/common/gpu/gpu_channel_manager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -48,7 +48,7 @@ class GpuChannelManager : public IPC::Channel::Listener, virtual ~GpuChannelManager(); // Remove the channel for a particular renderer. - void RemoveChannel(int renderer_id); + void RemoveChannel(int client_id); // Listener overrides. virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; @@ -64,18 +64,18 @@ class GpuChannelManager : public IPC::Channel::Listener, void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); void RemoveRoute(int32 routing_id); - GpuChannel* LookupChannel(int32 renderer_id); + GpuChannel* LookupChannel(int32 client_id); private: // Message handlers. - void OnEstablishChannel(int renderer_id); + void OnEstablishChannel(int client_id, int share_client_id); void OnCloseChannel(const IPC::ChannelHandle& channel_handle); void OnVisibilityChanged( - int32 render_view_id, int32 renderer_id, bool visible); + int32 render_view_id, int32 client_id, bool visible); void OnCreateViewCommandBuffer( gfx::PluginWindowHandle window, int32 render_view_id, - int32 renderer_id, + int32 client_id, const GPUCreateCommandBufferConfig& init_params); void OnLoseAllContexts(); diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index c27769c9..cb51128 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -30,7 +30,7 @@ GpuCommandBufferStub::GpuCommandBufferStub( const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference, int32 route_id, - int32 renderer_id, + int32 client_id, int32 render_view_id, GpuWatchdog* watchdog, bool software) @@ -44,7 +44,7 @@ GpuCommandBufferStub::GpuCommandBufferStub( route_id_(route_id), software_(software), last_flush_count_(0), - renderer_id_(renderer_id), + client_id_(client_id), render_view_id_(render_view_id), parent_stub_for_initialization_(), parent_texture_for_initialization_(0), @@ -63,7 +63,7 @@ GpuCommandBufferStub::~GpuCommandBufferStub() { GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer( - handle_, renderer_id_, render_view_id_)); + handle_, client_id_, render_view_id_)); } bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { @@ -196,7 +196,7 @@ void GpuCommandBufferStub::OnInitialize( surface_ = ImageTransportSurface::CreateSurface( channel_->gpu_channel_manager(), render_view_id_, - renderer_id_, + client_id_, route_id_, handle_); } else { diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index b8cdc4e..8796181 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -49,7 +49,7 @@ class GpuCommandBufferStub const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference, int32 route_id, - int32 renderer_id, + int32 client_id, int32 render_view_id, GpuWatchdog* watchdog, bool software); @@ -75,7 +75,7 @@ class GpuCommandBufferStub gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } // Identifies the renderer process. - int32 renderer_id() const { return renderer_id_; } + int32 client_id() const { return client_id_; } // Identifies a particular renderer belonging to the same renderer process. int32 render_view_id() const { return render_view_id_; } @@ -148,7 +148,7 @@ class GpuCommandBufferStub // The following two fields are used on Mac OS X to identify the window // for the rendering results on the browser side. - int32 renderer_id_; + int32 client_id_; int32 render_view_id_; scoped_ptr<gpu::CommandBufferService> command_buffer_; diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index e1bbca3..06f7d0f 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -34,7 +34,7 @@ IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) IPC_STRUCT_END() IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceNew_Params) - IPC_STRUCT_MEMBER(int32, renderer_id) + IPC_STRUCT_MEMBER(int32, client_id) IPC_STRUCT_MEMBER(int32, render_view_id) IPC_STRUCT_MEMBER(int32, width) IPC_STRUCT_MEMBER(int32, height) @@ -47,7 +47,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceNew_Params) IPC_STRUCT_END() IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) - IPC_STRUCT_MEMBER(int32, renderer_id) + IPC_STRUCT_MEMBER(int32, client_id) IPC_STRUCT_MEMBER(int32, render_view_id) IPC_STRUCT_MEMBER(uint64, surface_id) IPC_STRUCT_MEMBER(int32, route_id) @@ -59,7 +59,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) IPC_STRUCT_END() IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params) - IPC_STRUCT_MEMBER(int32, renderer_id) + IPC_STRUCT_MEMBER(int32, client_id) IPC_STRUCT_MEMBER(int32, render_view_id) IPC_STRUCT_MEMBER(uint64, surface_id) IPC_STRUCT_MEMBER(int32, route_id) @@ -73,7 +73,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params) IPC_STRUCT_END() IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params) - IPC_STRUCT_MEMBER(int32, renderer_id) + IPC_STRUCT_MEMBER(int32, client_id) IPC_STRUCT_MEMBER(int32, render_view_id) IPC_STRUCT_MEMBER(uint64, identifier) IPC_STRUCT_MEMBER(int32, route_id) @@ -131,12 +131,13 @@ IPC_ENUM_TRAITS(media::VideoDecodeAccelerator::Profile) IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) // Tells the GPU process to create a new channel for communication with a -// given renderer. The channel name is returned in a -// GpuHostMsg_ChannelEstablished message. The renderer ID is passed so that +// given client. The channel name is returned in a +// GpuHostMsg_ChannelEstablished message. The client ID is passed so that // the GPU process reuses an existing channel to that process if it exists. // This ID is a unique opaque identifier generated by the browser process. -IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel, - int /* renderer_id */) +IPC_MESSAGE_CONTROL2(GpuMsg_EstablishChannel, + int /* client_id */, + int /* share_client_id */) // Tells the GPU process to close the channel identified by IPC channel // handle. If no channel can be identified, do nothing. @@ -148,7 +149,7 @@ IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, IPC_MESSAGE_CONTROL4(GpuMsg_CreateViewCommandBuffer, gfx::PluginWindowHandle, /* compositing_surface */ int32, /* render_view_id */ - int32, /* renderer_id */ + int32, /* client_id */ GPUCreateCommandBufferConfig /* init_params */) // Tells the GPU process to create a context for collecting graphics card @@ -214,7 +215,7 @@ IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated, IPC_MESSAGE_CONTROL3(GpuHostMsg_DestroyCommandBuffer, gfx::PluginWindowHandle, /* view */ int32, /* render_view_id */ - int32 /* renderer_id */) + int32 /* client_id */) // Response from GPU to a GpuMsg_CollectGraphicsInfo. IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected, @@ -229,7 +230,7 @@ IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage, // Resize the window that is being drawn into. It's important that this // resize be synchronized with the swapping of the front and back buffers. IPC_MESSAGE_CONTROL4(GpuHostMsg_ResizeView, - int32 /* renderer_id */, + int32 /* client_id */, int32 /* render_view_id */, int32 /* route_id */, gfx::Size /* size */) diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index d1939f2..12b05e5 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -23,13 +23,13 @@ ImageTransportSurface::~ImageTransportSurface() { ImageTransportHelper::ImageTransportHelper(ImageTransportSurface* surface, GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle) : surface_(surface), manager_(manager), render_view_id_(render_view_id), - renderer_id_(renderer_id), + client_id_(client_id), command_buffer_id_(command_buffer_id), handle_(handle) { route_id_ = manager_->GenerateRouteID(); @@ -72,7 +72,7 @@ bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { void ImageTransportHelper::SendAcceleratedSurfaceRelease( GpuHostMsg_AcceleratedSurfaceRelease_Params params) { - params.renderer_id = renderer_id_; + params.client_id = client_id_; params.render_view_id = render_view_id_; params.route_id = route_id_; manager_->Send(new GpuHostMsg_AcceleratedSurfaceRelease(params)); @@ -80,7 +80,7 @@ void ImageTransportHelper::SendAcceleratedSurfaceRelease( void ImageTransportHelper::SendAcceleratedSurfaceNew( GpuHostMsg_AcceleratedSurfaceNew_Params params) { - params.renderer_id = renderer_id_; + params.client_id = client_id_; params.render_view_id = render_view_id_; params.route_id = route_id_; #if defined(OS_MACOSX) @@ -91,7 +91,7 @@ void ImageTransportHelper::SendAcceleratedSurfaceNew( void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped( GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params) { - params.renderer_id = renderer_id_; + params.client_id = client_id_; params.render_view_id = render_view_id_; params.route_id = route_id_; #if defined(OS_MACOSX) @@ -102,7 +102,7 @@ void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped( void ImageTransportHelper::SendAcceleratedSurfacePostSubBuffer( GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params) { - params.renderer_id = renderer_id_; + params.client_id = client_id_; params.render_view_id = render_view_id_; params.route_id = route_id_; #if defined(OS_MACOSX) @@ -112,7 +112,7 @@ void ImageTransportHelper::SendAcceleratedSurfacePostSubBuffer( } void ImageTransportHelper::SendResizeView(const gfx::Size& size) { - manager_->Send(new GpuHostMsg_ResizeView(renderer_id_, + manager_->Send(new GpuHostMsg_ResizeView(client_id_, render_view_id_, route_id_, size)); @@ -169,7 +169,7 @@ void ImageTransportHelper::Resize(gfx::Size size) { } void ImageTransportHelper::SetSwapInterval() { - GpuChannel* channel = manager_->LookupChannel(renderer_id_); + GpuChannel* channel = manager_->LookupChannel(client_id_); if (!channel) return; @@ -189,7 +189,7 @@ bool ImageTransportHelper::MakeCurrent() { } gpu::GpuScheduler* ImageTransportHelper::Scheduler() { - GpuChannel* channel = manager_->LookupChannel(renderer_id_); + GpuChannel* channel = manager_->LookupChannel(client_id_); if (!channel) return NULL; @@ -202,7 +202,7 @@ gpu::GpuScheduler* ImageTransportHelper::Scheduler() { } gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { - GpuChannel* channel = manager_->LookupChannel(renderer_id_); + GpuChannel* channel = manager_->LookupChannel(client_id_); if (!channel) return NULL; @@ -217,13 +217,13 @@ gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { PassThroughImageTransportSurface::PassThroughImageTransportSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::GLSurface* surface) : GLSurfaceAdapter(surface) { helper_.reset(new ImageTransportHelper(this, manager, render_view_id, - renderer_id, + client_id, command_buffer_id, gfx::kNullPluginWindow)); } diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index a34ae33..8801ba2 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -67,7 +67,7 @@ class ImageTransportSurface { static scoped_refptr<gfx::GLSurface> CreateSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle); private: @@ -80,7 +80,7 @@ class ImageTransportHelper : public IPC::Channel::Listener { ImageTransportHelper(ImageTransportSurface* surface, GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle); virtual ~ImageTransportHelper(); @@ -132,7 +132,7 @@ class ImageTransportHelper : public IPC::Channel::Listener { GpuChannelManager* manager_; int32 render_view_id_; - int32 renderer_id_; + int32 client_id_; int32 command_buffer_id_; int32 route_id_; gfx::PluginWindowHandle handle_; @@ -148,7 +148,7 @@ class PassThroughImageTransportSurface public: PassThroughImageTransportSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::GLSurface* surface); virtual ~PassThroughImageTransportSurface(); diff --git a/content/common/gpu/image_transport_surface_linux.cc b/content/common/gpu/image_transport_surface_linux.cc index 87a197d..405de37 100644 --- a/content/common/gpu/image_transport_surface_linux.cc +++ b/content/common/gpu/image_transport_surface_linux.cc @@ -62,7 +62,7 @@ class EGLImageTransportSurface public: EGLImageTransportSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id); // gfx::GLSurface implementation @@ -113,7 +113,7 @@ class GLXImageTransportSurface public: GLXImageTransportSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id); // gfx::GLSurface implementation: @@ -169,7 +169,7 @@ class OSMesaImageTransportSurface : public ImageTransportSurface, public: OSMesaImageTransportSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id); // gfx::GLSurface implementation: @@ -245,7 +245,7 @@ EGLAcceleratedSurface::~EGLAcceleratedSurface() { EGLImageTransportSurface::EGLImageTransportSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id) : gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1)), fbo_id_(0), @@ -253,7 +253,7 @@ EGLImageTransportSurface::EGLImageTransportSurface( helper_.reset(new ImageTransportHelper(this, manager, render_view_id, - renderer_id, + client_id, command_buffer_id, gfx::kNullPluginWindow)); } @@ -424,7 +424,7 @@ void EGLImageTransportSurface::OnResizeViewACK() { GLXImageTransportSurface::GLXImageTransportSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id) : gfx::NativeViewGLSurfaceGLX(), dummy_parent_(0), @@ -435,7 +435,7 @@ GLXImageTransportSurface::GLXImageTransportSurface( helper_.reset(new ImageTransportHelper(this, manager, render_view_id, - renderer_id, + client_id, command_buffer_id, gfx::kNullPluginWindow)); } @@ -645,14 +645,14 @@ void GLXImageTransportSurface::OnResizeViewACK() { OSMesaImageTransportSurface::OSMesaImageTransportSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id) : gfx::GLSurfaceOSMesa(OSMESA_RGBA, gfx::Size(1, 1)), size_(gfx::Size(1, 1)) { helper_.reset(new ImageTransportHelper(this, manager, render_view_id, - renderer_id, + client_id, command_buffer_id, gfx::kNullPluginWindow)); } @@ -794,7 +794,7 @@ gfx::Size OSMesaImageTransportSurface::GetSize() { scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle) { scoped_refptr<gfx::GLSurface> surface; @@ -803,19 +803,19 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( case gfx::kGLImplementationDesktopGL: surface = new GLXImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id); break; case gfx::kGLImplementationEGLGLES2: surface = new EGLImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id); break; case gfx::kGLImplementationOSMesaGL: surface = new OSMesaImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id); break; default: @@ -829,7 +829,7 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( surface = new PassThroughImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id, surface.get()); #endif diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc index 5bcadc4..47662db 100644 --- a/content/common/gpu/image_transport_surface_mac.cc +++ b/content/common/gpu/image_transport_surface_mac.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -25,7 +25,7 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL, public: IOSurfaceImageTransportSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle); @@ -80,7 +80,7 @@ class TransportDIBImageTransportSurface : public gfx::NoOpGLSurfaceCGL, public: TransportDIBImageTransportSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle); @@ -144,7 +144,7 @@ void AddIntegerValue(CFMutableDictionaryRef dictionary, IOSurfaceImageTransportSurface::IOSurfaceImageTransportSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle) : gfx::NoOpGLSurfaceCGL(gfx::Size(1, 1)), @@ -156,7 +156,7 @@ IOSurfaceImageTransportSurface::IOSurfaceImageTransportSurface( helper_.reset(new ImageTransportHelper(this, manager, render_view_id, - renderer_id, + client_id, command_buffer_id, handle)); @@ -372,7 +372,7 @@ void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { TransportDIBImageTransportSurface::TransportDIBImageTransportSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle) : gfx::NoOpGLSurfaceCGL(gfx::Size(1, 1)), @@ -382,7 +382,7 @@ TransportDIBImageTransportSurface::TransportDIBImageTransportSurface( helper_.reset(new ImageTransportHelper(this, manager, render_view_id, - renderer_id, + client_id, command_buffer_id, handle)); @@ -583,7 +583,7 @@ void TransportDIBImageTransportSurface::OnResize(gfx::Size size) { scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle) { scoped_refptr<gfx::GLSurface> surface; @@ -595,13 +595,13 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( if (!io_surface_support) { surface = new TransportDIBImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id, handle); } else { surface = new IOSurfaceImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id, handle); } diff --git a/content/common/gpu/image_transport_surface_win.cc b/content/common/gpu/image_transport_surface_win.cc index f5177f1..cd5c8b7 100644 --- a/content/common/gpu/image_transport_surface_win.cc +++ b/content/common/gpu/image_transport_surface_win.cc @@ -32,7 +32,7 @@ class PbufferImageTransportSurface public: PbufferImageTransportSurface(GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id); // gfx::GLSurface implementation @@ -71,7 +71,7 @@ class PbufferImageTransportSurface PbufferImageTransportSurface::PbufferImageTransportSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id) : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1))), @@ -79,7 +79,7 @@ PbufferImageTransportSurface::PbufferImageTransportSurface( helper_.reset(new ImageTransportHelper(this, manager, render_view_id, - renderer_id, + client_id, command_buffer_id, gfx::kNullPluginWindow)); } @@ -187,7 +187,7 @@ void PbufferImageTransportSurface::OnResize(gfx::Size size) { scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( GpuChannelManager* manager, int32 render_view_id, - int32 renderer_id, + int32 client_id, int32 command_buffer_id, gfx::PluginWindowHandle handle) { scoped_refptr<gfx::GLSurface> surface; @@ -201,7 +201,7 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( strstr(extensions, "EGL_ANGLE_surface_d3d_texture_2d_share_handle")) { surface = new PbufferImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id); } } @@ -213,7 +213,7 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( surface = new PassThroughImageTransportSurface(manager, render_view_id, - renderer_id, + client_id, command_buffer_id, surface.get()); } |