summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-10-29 16:21:46 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-11 17:25:25 +0100
commit7403ef5908cf2d2e81e5cedf44cb2536bd1b9ac2 (patch)
tree80e664cce4b4ff3cfeba0c21eda2a92ca7c339c3 /patches
parent258e3aad97be370663983573b557c4115db3fafb (diff)
Delegated renderer: Put textures on those quads.
A few changes are necessary to allow fetching textures provided by the render processes through IPC and bound to their respective GL context in the GPU process and use them in the QtQuick scene graph. - Remove the plain color test textures. - Allow setting the QtQuick QOpenGLContext's handle as the share context for all context set as shared in the Chromium GPU process. We do this by letting the GpuChannelManager ask us for a ShareGroup instance responsible for returning a sharing GL context handle. - Fetch texture IDs from the MailboxManager used by the GPU process using the Mailbox given to us in the DelegatedFrameData. This is the same mechanism used by Chromium to share textures between "client" GL contexts. - Keep the QtQuick scene graph threads and Chromium in-process GPU thread separate. The complicated part of merging those two rendering pipelines on the same thread is that it would force Qt to also use only one thread for rendering. For the moment we will try to synchronize those threads together instead. - Lock the Qt SG thread while waiting for resource sync points. Do so by posting a callback to the Chromium GPU thread and wait until the sync point of every resource has been retired by the producing contexts. - Acknowledge the delegated from once QtQuick swapped the GL buffers instead of right after we added the frame to the scene graph. This fixes some issues where the textures for the previous frame would already be released as Chromium was producing the new frame. There are still a few issues regarding synchronization that have to be fixed, especially when Qt triggers the rendering of a new frame while Chromium is starting to produce the next frame. Note: To enable it we still need to pass the following command switches: --enable-delegated-renderer --enable-threaded-compositing --in-process-gpu Change-Id: I2d4f7fac603b1808ed1495a8d689cb48e9ed41b9 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'patches')
-rw-r--r--patches/0001-Add-accessors-for-the-Qt-delegated-renderer-integrat.patch84
-rw-r--r--patches/0001-Add-seams-to-setup-GL-contexts-sharing-with-QtQuick.patch109
-rwxr-xr-xpatches/patch-chromium.sh2
3 files changed, 195 insertions, 0 deletions
diff --git a/patches/0001-Add-accessors-for-the-Qt-delegated-renderer-integrat.patch b/patches/0001-Add-accessors-for-the-Qt-delegated-renderer-integrat.patch
new file mode 100644
index 000000000..fe63dfc0f
--- /dev/null
+++ b/patches/0001-Add-accessors-for-the-Qt-delegated-renderer-integrat.patch
@@ -0,0 +1,84 @@
+From e40d3482d46ff88755aa2bd76048de698ae03915 Mon Sep 17 00:00:00 2001
+From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
+Date: Fri, 20 Sep 2013 15:00:47 +0200
+Subject: [PATCH] Add accessors for the Qt delegated renderer integration.
+
+This is needed to fetch the MessageLoop, the MailboxManager and the
+SyncPointManager of the GPU in-process host.
+---
+ content/common/gpu/gpu_channel_manager.h | 2 ++
+ content/gpu/gpu_child_thread.cc | 6 ++++++
+ content/gpu/gpu_child_thread.h | 6 ++++++
+ 3 files changed, 14 insertions(+)
+
+diff --git a/content/common/gpu/gpu_channel_manager.h b/content/common/gpu/gpu_channel_manager.h
+index f01a1c5..e41a548 100644
+--- a/content/common/gpu/gpu_channel_manager.h
++++ b/content/common/gpu/gpu_channel_manager.h
+@@ -89,6 +89,8 @@ class GpuChannelManager : public IPC::Listener,
+
+ gpu::gles2::ProgramCache* program_cache();
+
++ gpu::gles2::MailboxManager* mailbox_manager() { return mailbox_manager_.get(); }
++
+ GpuMemoryManager* gpu_memory_manager() { return &gpu_memory_manager_; }
+
+ GpuChannel* LookupChannel(int32 client_id);
+diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
+index 170b364..a84a9e0 100644
+--- a/content/gpu/gpu_child_thread.cc
++++ b/content/gpu/gpu_child_thread.cc
+@@ -40,6 +40,8 @@ bool GpuProcessLogMessageHandler(int severity,
+
+ } // namespace
+
++GpuChildThread* GpuChildThread::instance_ = 0;
++
+ GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread,
+ bool dead_on_arrival,
+ const gpu::GPUInfo& gpu_info,
+@@ -53,6 +55,8 @@ GpuChildThread::GpuChildThread(GpuWatchdogThread* watchdog_thread,
+ target_services_ = NULL;
+ #endif
+ g_thread_safe_sender.Get() = thread_safe_sender();
++
++ instance_ = this;
+ }
+
+ GpuChildThread::GpuChildThread(const std::string& channel_id)
+@@ -71,6 +75,8 @@ GpuChildThread::GpuChildThread(const std::string& channel_id)
+ VLOG(1) << "gfx::GLSurface::InitializeOneOff()";
+ }
+ g_thread_safe_sender.Get() = thread_safe_sender();
++
++ instance_ = this;
+ }
+
+ GpuChildThread::~GpuChildThread() {
+diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h
+index ff0c925..82bb32a 100644
+--- a/content/gpu/gpu_child_thread.h
++++ b/content/gpu/gpu_child_thread.h
+@@ -56,6 +56,10 @@ class GpuChildThread : public ChildThread {
+ virtual bool Send(IPC::Message* msg) OVERRIDE;
+ virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;
+
++ GpuChannelManager* ChannelManager() const { return gpu_channel_manager_.get(); }
++
++ static GpuChildThread* instance() { return instance_; }
++
+ private:
+ // Message handlers.
+ void OnInitialize();
+@@ -94,6 +98,8 @@ class GpuChildThread : public ChildThread {
+ // Whether the GPU thread is running in the browser process.
+ bool in_browser_process_;
+
++ static GpuChildThread* instance_;
++
+ DISALLOW_COPY_AND_ASSIGN(GpuChildThread);
+ };
+
+--
+1.8.4.2
+
diff --git a/patches/0001-Add-seams-to-setup-GL-contexts-sharing-with-QtQuick.patch b/patches/0001-Add-seams-to-setup-GL-contexts-sharing-with-QtQuick.patch
new file mode 100644
index 000000000..55cf5a5d5
--- /dev/null
+++ b/patches/0001-Add-seams-to-setup-GL-contexts-sharing-with-QtQuick.patch
@@ -0,0 +1,109 @@
+From 559c011aabd6fc9f064d2913e4fae06db2c8495b Mon Sep 17 00:00:00 2001
+From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
+Date: Thu, 24 Oct 2013 18:26:59 +0200
+Subject: [PATCH] Add seams to setup GL contexts sharing with QtQuick.
+
+This will allow us to know right before the first GL context is
+instantiated by Chromium so that we can install those contexts to
+be shared with QtQuick GL contexts as well.
+---
+ content/common/gpu/gpu_channel_manager.cc | 8 +++++++-
+ content/public/browser/content_browser_client.h | 5 +++++
+ ui/gl/gl_share_group.cc | 3 +++
+ ui/gl/gl_share_group.h | 7 +++++--
+ 4 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc
+index 8b466bd..fe3f7b3 100644
+--- a/content/common/gpu/gpu_channel_manager.cc
++++ b/content/common/gpu/gpu_channel_manager.cc
+@@ -11,6 +11,7 @@
+ #include "content/common/gpu/gpu_memory_manager.h"
+ #include "content/common/gpu/gpu_messages.h"
+ #include "content/common/gpu/sync_point_manager.h"
++#include "content/public/browser/content_browser_client.h"
+ #include "gpu/command_buffer/service/feature_info.h"
+ #include "gpu/command_buffer/service/gpu_switches.h"
+ #include "gpu/command_buffer/service/mailbox_manager.h"
+@@ -124,7 +125,12 @@ void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) {
+ DCHECK(!mailbox_manager_.get());
+ mailbox_manager_ = new gpu::gles2::MailboxManager;
+ }
+- share_group = share_group_.get();
++ // Qt: Ask the browser client at the top to manage the context sharing.
++ // This can only work with --in-process-gpu or --single-process.
++ if (GetContentClient()->browser() && GetContentClient()->browser()->GetInProcessGpuShareGroup())
++ share_group = GetContentClient()->browser()->GetInProcessGpuShareGroup();
++ else
++ share_group = share_group_.get();
+ mailbox_manager = mailbox_manager_.get();
+ }
+
+diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
+index 1f5e836..2168769 100644
+--- a/content/public/browser/content_browser_client.h
++++ b/content/public/browser/content_browser_client.h
+@@ -48,6 +48,7 @@ class CryptoModuleBlockingPasswordDelegate;
+ }
+
+ namespace gfx {
++class GLShareGroup;
+ class ImageSkia;
+ }
+
+@@ -563,6 +564,10 @@ class CONTENT_EXPORT ContentBrowserClient {
+ // Return NULL to use the default one for the platform to be created.
+ virtual LocationProvider* OverrideSystemLocationProvider();
+
++ // Allow an embedder to provide a share group reimplementation to connect renderer
++ // GL contexts with the root compositor.
++ virtual gfx::GLShareGroup* GetInProcessGpuShareGroup() { return 0; }
++
+ #if defined(OS_POSIX) && !defined(OS_MACOSX)
+ // Populates |mappings| with all files that need to be mapped before launching
+ // a child process.
+diff --git a/ui/gl/gl_share_group.cc b/ui/gl/gl_share_group.cc
+index 8e8958b..347873d 100644
+--- a/ui/gl/gl_share_group.cc
++++ b/ui/gl/gl_share_group.cc
+@@ -18,6 +18,9 @@ GLShareGroup::GLShareGroup()
+ }
+
+ void GLShareGroup::AddContext(GLContext* context) {
++ if (contexts_.empty())
++ AboutToAddFirstContext();
++
+ contexts_.insert(context);
+ }
+
+diff --git a/ui/gl/gl_share_group.h b/ui/gl/gl_share_group.h
+index 1deed63..f1b0369 100644
+--- a/ui/gl/gl_share_group.h
++++ b/ui/gl/gl_share_group.h
+@@ -31,7 +31,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 unique shared GL context. Used for context
+ // virtualization.
+@@ -45,10 +45,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.
+--
+1.8.4.2
+
diff --git a/patches/patch-chromium.sh b/patches/patch-chromium.sh
index 2c3834b08..38cc4c126 100755
--- a/patches/patch-chromium.sh
+++ b/patches/patch-chromium.sh
@@ -69,6 +69,8 @@ git am $PATCH_DIR/0001-Solve-conflicts-when-including-both-QtOpenGL-headers.patc
git am $PATCH_DIR/0001-Do-not-forward-declare-UIResourceRequest-Identity-an.patch
git am $PATCH_DIR/0001-Fix-the-build-with-a-GL-ES2-configured-Qt.patch
git am $PATCH_DIR/0001-Hide-the-definition-of-MessagePumpGtk-GetDefaultXDis.patch
+git am $PATCH_DIR/0001-Add-accessors-for-the-Qt-delegated-renderer-integrat.patch
+git am $PATCH_DIR/0001-Add-seams-to-setup-GL-contexts-sharing-with-QtQuick.patch
cd $CHROMIUM_SRC_DIR/third_party/WebKit
echo "Entering $PWD"