From c0bc770eb1dfcc6689df44438cd396721d5129fc Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Wed, 14 May 2014 17:53:59 +0200 Subject: Enable GLContextHelper and register a SurfaceFactoryQt on eAndroid This is needed to run on certain hardware that needs the shared EGL contexts to be created on the same thread. To prevent a deadlock on eAndroid only use a blocking connection if we are not on the main thread where the singleton was created, since there is a call to this from gpu_info_collector_android before the GPU thread is launched. Change-Id: I6887ad1218b8426097f454741dc5a79ee94f9d62 Reviewed-by: Jocelyn Turcotte --- src/core/gl_context_qt.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/core/gl_context_qt.cpp') diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp index 1d51292dc..f440679cf 100644 --- a/src/core/gl_context_qt.cpp +++ b/src/core/gl_context_qt.cpp @@ -41,6 +41,8 @@ #include "gl_context_qt.h" +#include +#include #include "ui/gl/gl_context_egl.h" QT_BEGIN_NAMESPACE @@ -53,6 +55,12 @@ void GLContextHelper::initialize() contextHelper = new GLContextHelper; } +void GLContextHelper::destroy() +{ + delete contextHelper; + contextHelper = 0; +} + bool GLContextHelper::initializeContextOnBrowserThread(gfx::GLContext* context, gfx::GLSurface* surface) { return context->Initialize(surface, gfx::PreferDiscreteGpu); @@ -61,7 +69,8 @@ bool GLContextHelper::initializeContextOnBrowserThread(gfx::GLContext* context, bool GLContextHelper::initializeContext(gfx::GLContext* context, gfx::GLSurface* surface) { bool ret = false; - QMetaObject::invokeMethod(contextHelper, "initializeContextOnBrowserThread", Qt::BlockingQueuedConnection, + Qt::ConnectionType connType = (QThread::currentThread() == qApp->thread()) ? Qt::DirectConnection : Qt::BlockingQueuedConnection; + QMetaObject::invokeMethod(contextHelper, "initializeContextOnBrowserThread", connType, Q_RETURN_ARG(bool, ret), Q_ARG(gfx::GLContext*, context), Q_ARG(gfx::GLSurface*, surface)); @@ -70,7 +79,7 @@ bool GLContextHelper::initializeContext(gfx::GLContext* context, gfx::GLSurface* QT_END_NAMESPACE -#if defined(USE_OZONE) +#if defined(USE_OZONE) || defined(OS_ANDROID) namespace gfx { -- cgit v1.2.3