xcb: Fallback to Xlib screen when glXGetCurrentDisplay() returns NULL

Change-Id: Ie25b3fac4c0224f847c77c0515894a9df84077a2
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Błażej Szczygieł 2016-01-16 00:57:54 +01:00 committed by Shawn Rutledge
parent 5ef14c52d0
commit e8ad49d6cb
2 changed files with 11 additions and 6 deletions

View File

@ -645,9 +645,12 @@ void QGLXContext::queryDummyContext()
QScopedPointer<QSurface> surface;
Display *display = glXGetCurrentDisplay();
const char *glxvendor = 0;
if (display)
glxvendor = glXGetClientString(display, GLX_VENDOR);
if (!display) {
// FIXME: Since Qt 5.6 we don't need to check whether primary screen is NULL
if (QScreen *screen = QGuiApplication::primaryScreen())
display = DISPLAY_FROM_XCB(static_cast<QXcbScreen *>(screen->handle()));
}
const char *glxvendor = glXGetClientString(display, GLX_VENDOR);
if (glxvendor && !strcmp(glxvendor, "ATI")) {
QWindow *window = new QWindow;
window->resize(64, 64);

View File

@ -196,9 +196,11 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO
if (!vendorChecked) {
vendorChecked = true;
Display *display = glXGetCurrentDisplay();
const char *glxvendor = 0;
if (display)
glxvendor = glXGetClientString(display, GLX_VENDOR);
#ifdef XCB_USE_XLIB
if (!display)
display = static_cast<Display *>(m_connection->xlib_display());
#endif
const char *glxvendor = glXGetClientString(display, GLX_VENDOR);
if (glxvendor && !strcmp(glxvendor, "ATI"))
glxPbufferUsable = false;
}