Disable switchable widget compositing when using XCB in Parallels VM

The Parallels 3D hardware acceleration does not seem to play nice with
Qt Creator when switching between tabs that have OpenGL Qt Quick Content
and those that have just raster widget content.  QWidgetBackingstore has
the ability to switch how content is flushed depending on if the
SwitchableWidgetComposition capability is available.  Previously for XCB
it was always enabled, but should be disabled when using the GLX
integration for the Parallels VM.

Change-Id: I42e41456e0873f6780f5d0333dbfaaf8fcce4a5e
Task-number: QTCREATORBUG-16742
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Andy Nichols 2016-08-16 16:54:16 +02:00
parent ed4cd363b1
commit 2b0e52757c
4 changed files with 25 additions and 1 deletions

View File

@ -54,6 +54,7 @@ public:
virtual bool initialize(QXcbConnection *connection) = 0;
virtual bool supportsThreadedOpenGL() const { return false; }
virtual bool supportsSwitchableWidgetComposition() const { return true; }
virtual bool handleXcbEvent(xcb_generic_event_t *event, uint responseType);
virtual QXcbWindow *createWindow(QWindow *window) const = 0;

View File

@ -218,5 +218,26 @@ bool QXcbGlxIntegration::supportsThreadedOpenGL() const
return QGLXContext::supportsThreading();
}
bool QXcbGlxIntegration::supportsSwitchableWidgetComposition() const
{
static bool vendorChecked = false;
static bool isSwitchableWidgetCompositionAvailable = true;
if (!vendorChecked) {
vendorChecked = true;
Display *display = glXGetCurrentDisplay();
#ifdef XCB_USE_XLIB
if (!display)
display = static_cast<Display *>(m_connection->xlib_display());
#endif
const char *glxvendor = glXGetClientString(display, GLX_VENDOR);
if (glxvendor) {
if (!strcmp(glxvendor, "Parallels Inc"))
isSwitchableWidgetCompositionAvailable = false;
}
}
return isSwitchableWidgetCompositionAvailable;
}
QT_END_NAMESPACE

View File

@ -54,6 +54,7 @@ public:
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
virtual bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE;
virtual bool supportsSwitchableWidgetComposition() const Q_DECL_OVERRIDE;
private:
QXcbConnection *m_connection;

View File

@ -254,7 +254,8 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case ForeignWindows: return true;
case SyncState: return true;
case RasterGLSurface: return true;
case SwitchableWidgetComposition: return true;
case SwitchableWidgetComposition: return m_connections.at(0)->glIntegration()
&& m_connections.at(0)->glIntegration()->supportsSwitchableWidgetComposition();
default: return QPlatformIntegration::hasCapability(cap);
}
}