summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-07-07 13:28:21 +0200
committerAndras Becsi <andras.becsi@digia.com>2014-07-07 16:18:24 +0200
commit16baadab11341e671150932fd28cff466a4fc041 (patch)
treecef621459f4c1b59a345da0434a7b376dda363de
parent56ce6ba9792778e7d6fa1194b41e282633ff81c1 (diff)
Add support for querying "glxconfig" from native interface
This makes it possible to retrieve the GLXFBConfig used by Qt to create the GLXContext. QtWebEngine on desktop needs this so that Chromium can use the same config as Qt to eliminate BadMatch errors. Change-Id: If18c0937b5af3e457ddbfda035e5d652230211c6 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp4
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp17
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h2
4 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index df929c4b61..45ccd9929e 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -166,6 +166,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
const QVariant &nativeHandle)
: QPlatformOpenGLContext()
, m_screen(screen)
+ , m_config(0)
, m_context(0)
, m_shareContext(0)
, m_format(format)
@@ -190,6 +191,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
m_shareContext = static_cast<const QGLXContext*>(share)->glxContext();
GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),m_format);
+ m_config = config;
XVisualInfo *visualInfo = 0;
Window window = 0; // Temporary window used to query OpenGL context
@@ -399,6 +401,8 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share, const
qWarning("QGLXContext: Multiple configs for FBConfig ID %d", configId);
config = configs[0];
+ // Store the config.
+ m_config = config;
}
Q_ASSERT(vinfo || config);
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index a7787f5f86..abe3216ad7 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -72,6 +72,7 @@ public:
bool isValid() const;
GLXContext glxContext() const { return m_context; }
+ GLXFBConfig glxConfig() const { return m_config; }
QVariant nativeHandle() const;
@@ -83,6 +84,7 @@ private:
void init(QXcbScreen *screen, QPlatformOpenGLContext *share, const QVariant &nativeHandle);
QXcbScreen *m_screen;
+ GLXFBConfig m_config;
GLXContext m_context;
GLXContext m_shareContext;
QSurfaceFormat m_format;
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 490064a94d..b381fac5bb 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -79,6 +79,7 @@ static int resourceType(const QByteArray &key)
QByteArrayLiteral("display"), QByteArrayLiteral("egldisplay"),
QByteArrayLiteral("connection"), QByteArrayLiteral("screen"),
QByteArrayLiteral("eglcontext"),
+ QByteArrayLiteral("glxconfig"),
QByteArrayLiteral("glxcontext"), QByteArrayLiteral("apptime"),
QByteArrayLiteral("appusertime"), QByteArrayLiteral("hintstyle"),
QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"),
@@ -240,6 +241,9 @@ void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceSt
case EglContext:
result = eglContextForContext(context);
break;
+ case GLXConfig:
+ result = glxConfigForContext(context);
+ break;
case GLXContext:
result = glxContextForContext(context);
break;
@@ -471,4 +475,17 @@ void *QXcbNativeInterface::glxContextForContext(QOpenGLContext *context)
}
+void *QXcbNativeInterface::glxConfigForContext(QOpenGLContext *context)
+{
+ Q_ASSERT(context);
+#if defined(XCB_USE_GLX)
+ QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
+ return glxPlatformContext->glxConfig();
+#else
+ Q_UNUSED(context);
+ return 0;
+#endif
+
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index ff5f358298..01b66a767d 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -63,6 +63,7 @@ public:
Connection,
Screen,
EglContext,
+ GLXConfig,
GLXContext,
AppTime,
AppUserTime,
@@ -104,6 +105,7 @@ public:
static void setAppUserTime(QScreen *screen, xcb_timestamp_t time);
static void *eglContextForContext(QOpenGLContext *context);
static void *glxContextForContext(QOpenGLContext *context);
+ static void *glxConfigForContext(QOpenGLContext *context);
Q_INVOKABLE void beep();
Q_INVOKABLE bool systemTrayAvailable(const QScreen *screen) const;