diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-08-04 18:07:02 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-05-03 10:57:05 +0200 |
commit | abce808ab70dc38feeaced0de07632b5a689ffbc (patch) | |
tree | 270c060b9bfbfdf961c8d84d3a5f92eb9097209c | |
parent | c119fb79698bee8017b88a80a9df329a7e63be55 (diff) | |
download | qtwebengine-chromium-abce808ab70dc38feeaced0de07632b5a689ffbc.tar.gz |
Add accessors and seams for the Qt delegated renderer integration.
This is needed to fetch the MessageLoop, the MailboxManager and the
SyncPointManager of the GPU in-process host.
And fetch the right shared context for the in GPU thread.
Change-Id: I7f38e32b2df11da5b046f16643841d34260c11fb
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.cc | 11 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_child_thread.h | 12 | ||||
-rw-r--r-- | chromium/content/public/browser/content_browser_client.h | 8 | ||||
-rw-r--r-- | chromium/gpu/ipc/service/gpu_channel_manager.cc | 4 | ||||
-rw-r--r-- | chromium/gpu/ipc/service/gpu_channel_manager.h | 9 | ||||
-rw-r--r-- | chromium/ui/gl/gl_share_group.cc | 3 | ||||
-rw-r--r-- | chromium/ui/gl/gl_share_group.h | 7 |
7 files changed, 44 insertions, 10 deletions
diff --git a/chromium/content/gpu/gpu_child_thread.cc b/chromium/content/gpu/gpu_child_thread.cc index da3646ab674..de49633c845 100644 --- a/chromium/content/gpu/gpu_child_thread.cc +++ b/chromium/content/gpu/gpu_child_thread.cc @@ -20,6 +20,7 @@ #include "content/common/establish_channel_params.h" #include "content/common/gpu_host_messages.h" #include "content/gpu/gpu_service_factory.h" +#include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" #include "content/public/common/service_manager_connection.h" @@ -144,6 +145,8 @@ ChildThreadImpl::Options GetOptions( } // namespace +GpuChildThread* GpuChildThread::instance_ = 0; + GpuChildThread::GpuChildThread( std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, bool dead_on_arrival, @@ -166,6 +169,8 @@ GpuChildThread::GpuChildThread( target_services_ = NULL; #endif g_thread_safe_sender.Get() = thread_safe_sender(); + + instance_ = this; } GpuChildThread::GpuChildThread( @@ -197,6 +202,8 @@ GpuChildThread::GpuChildThread( switches::kInProcessGPU)); g_thread_safe_sender.Get() = thread_safe_sender(); + + instance_ = this; } GpuChildThread::~GpuChildThread() { @@ -339,6 +346,10 @@ void GpuChildThread::CreateGpuService( ChildProcess::current()->GetShutDownEvent()); CHECK(gpu_service_->media_gpu_channel_manager()); +#if defined(TOOLKIT_QT) + gpu_channel_manager()->set_share_group(GetContentClient()->browser()->GetInProcessGpuShareGroup()); +#endif + // Only set once per process instance. service_factory_.reset(new GpuServiceFactory( gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); diff --git a/chromium/content/gpu/gpu_child_thread.h b/chromium/content/gpu/gpu_child_thread.h index f44ce993d88..bac6fac97fd 100644 --- a/chromium/content/gpu/gpu_child_thread.h +++ b/chromium/content/gpu/gpu_child_thread.h @@ -84,6 +84,12 @@ class GpuChildThread : public ChildThreadImpl, return gpu_service_->watchdog_thread(); } + static GpuChildThread* instance() { return instance_; } + + gpu::GpuChannelManager* gpu_channel_manager() { + return gpu_service_->gpu_channel_manager(); + } + private: void CreateGpuMainService(ui::mojom::GpuMainAssociatedRequest request); @@ -135,10 +141,6 @@ class GpuChildThread : public ChildThreadImpl, void BindServiceFactoryRequest( service_manager::mojom::ServiceFactoryRequest request); - gpu::GpuChannelManager* gpu_channel_manager() { - return gpu_service_->gpu_channel_manager(); - } - // Set this flag to true if a fatal error occurred before we receive the // OnInitialize message, in which case we just declare ourselves DOA. const bool dead_on_arrival_; @@ -169,6 +171,8 @@ class GpuChildThread : public ChildThreadImpl, std::unique_ptr<ui::GpuService> gpu_service_; mojo::AssociatedBinding<ui::mojom::GpuMain> gpu_main_binding_; + static GpuChildThread* instance_; + DISALLOW_COPY_AND_ASSIGN(GpuChildThread); }; diff --git a/chromium/content/public/browser/content_browser_client.h b/chromium/content/public/browser/content_browser_client.h index 45056271e93..1c38e60d4a0 100644 --- a/chromium/content/public/browser/content_browser_client.h +++ b/chromium/content/public/browser/content_browser_client.h @@ -57,6 +57,10 @@ namespace gfx { class ImageSkia; } +namespace gl { +class GLShareGroup; +} + namespace gpu { class GpuChannelEstablishFactory; } @@ -631,6 +635,10 @@ class CONTENT_EXPORT ContentBrowserClient { std::vector<std::unique_ptr<storage::FileSystemBackend>>* additional_backends) {} + // Allow an embedder to provide a share group reimplementation to connect renderer + // GL contexts with the root compositor. + virtual gl::GLShareGroup* GetInProcessGpuShareGroup() { return 0; } + // Creates a new DevToolsManagerDelegate. The caller owns the returned value. // It's valid to return nullptr. virtual DevToolsManagerDelegate* GetDevToolsManagerDelegate(); diff --git a/chromium/gpu/ipc/service/gpu_channel_manager.cc b/chromium/gpu/ipc/service/gpu_channel_manager.cc index a6a099c6300..73d72ffedce 100644 --- a/chromium/gpu/ipc/service/gpu_channel_manager.cc +++ b/chromium/gpu/ipc/service/gpu_channel_manager.cc @@ -125,6 +125,10 @@ GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const { return it != gpu_channels_.end() ? it->second.get() : nullptr; } +void GpuChannelManager::set_share_group(gl::GLShareGroup* share_group) { + share_group_ = share_group; +} + std::unique_ptr<GpuChannel> GpuChannelManager::CreateGpuChannel( int client_id, uint64_t client_tracing_id, diff --git a/chromium/gpu/ipc/service/gpu_channel_manager.h b/chromium/gpu/ipc/service/gpu_channel_manager.h index 01301b2708c..e74d431b9f7 100644 --- a/chromium/gpu/ipc/service/gpu_channel_manager.h +++ b/chromium/gpu/ipc/service/gpu_channel_manager.h @@ -135,11 +135,16 @@ class GPU_EXPORT GpuChannelManager { return exiting_for_lost_context_; } + SyncPointManager* sync_point_manager() const { + return sync_point_manager_; + } + gles2::MailboxManager* mailbox_manager() const { return mailbox_manager_.get(); } gl::GLShareGroup* share_group() const { return share_group_.get(); } + void set_share_group(gl::GLShareGroup* share_group); protected: virtual std::unique_ptr<GpuChannel> CreateGpuChannel( @@ -149,10 +154,6 @@ class GPU_EXPORT GpuChannelManager { bool allow_view_command_buffers, bool allow_real_time_streams); - SyncPointManager* sync_point_manager() const { - return sync_point_manager_; - } - PreemptionFlag* preemption_flag() const { return preemption_flag_.get(); } scoped_refptr<base::SingleThreadTaskRunner> task_runner_; diff --git a/chromium/ui/gl/gl_share_group.cc b/chromium/ui/gl/gl_share_group.cc index 94708c09202..2c93a983cb3 100644 --- a/chromium/ui/gl/gl_share_group.cc +++ b/chromium/ui/gl/gl_share_group.cc @@ -20,6 +20,9 @@ GLShareGroup::GLShareGroup() } void GLShareGroup::AddContext(GLContext* context) { + if (contexts_.empty()) + AboutToAddFirstContext(); + contexts_.insert(context); } diff --git a/chromium/ui/gl/gl_share_group.h b/chromium/ui/gl/gl_share_group.h index 99ce887d9e2..87961c69faa 100644 --- a/chromium/ui/gl/gl_share_group.h +++ b/chromium/ui/gl/gl_share_group.h @@ -34,7 +34,7 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { // Returns a pointer to any initialized context in the share group // or NULL if there are no initialized contexts in the share group. - GLContext* GetContext(); + virtual GLContext* GetContext(); // Sets and returns the shared GL context. Used for context virtualization. void SetSharedContext(GLSurface* compatible, GLContext* context); @@ -47,10 +47,13 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { int GetRendererID(); #endif + protected: + virtual ~GLShareGroup(); + virtual void AboutToAddFirstContext() { } + private: friend class base::RefCounted<GLShareGroup>; - ~GLShareGroup(); // References to GLContext are by raw pointer to avoid a reference count // cycle. |