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>
This commit is contained in:
parent
56ce6ba979
commit
16baadab11
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user