summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-11-12 15:29:33 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2018-11-13 12:48:07 +0000
commitee3c66ca917b77f759acea7c6b27d15066f0b814 (patch)
tree768d93616c1425450899663d3ad4e129463cbe2e
parent1446cde812fc557de4e29db3d63c42a1030e5c1f (diff)
macOS: Disable threaded GL rendering on SDK 10.14+
AppKit expects rendering to happen on the main thread, or at least any interaction with AppKit UI classes such as NSView. Our OpenGL helpers, such as QOpenGLContext, do not enforce this, and we may end up calling into AppKit UI classes on the render thread, deadlocking the application. Until this can be investigated and new APIs possibly introduced that allow a more fine grained control in our own classes, we disable threaded GL as a capability of the platform, which will inform clients such as QtQuick to use the basic render loop. [ChangeLog][macOS] Threaded OpenGL usage has been disabled when building using Xcode 10/SDK 10.14 and later. Qt Quick defaults to the 'basic' render loop now on macOS. Task-number: QTBUG-71731 Change-Id: I6fc3295e833ecd48ad49382b8275c762fa7978a6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 936fecf8de..1bd1029863 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -340,12 +340,17 @@ QCocoaScreen *QCocoaIntegration::screenForNSScreen(NSScreen *nsScreen)
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
- case ThreadedPixmaps:
#ifndef QT_NO_OPENGL
- case OpenGL:
case ThreadedOpenGL:
+ // AppKit expects rendering to happen on the main thread, and we can
+ // easily end up in situations where rendering on secondary threads
+ // will result in visual artifacts, bugs, or even deadlocks, when
+ // building with SDK 10.14 or higher which enbles view layer-backing.
+ return QMacVersion::buildSDK() < QOperatingSystemVersion(QOperatingSystemVersion::MacOSMojave);
+ case OpenGL:
case BufferQueueingOpenGL:
#endif
+ case ThreadedPixmaps:
case WindowMasks:
case MultipleWindows:
case ForeignWindows: