Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.5.2
-
None
Description
macOS / Cocoa does not allow to call into NSView, NSWindow functionality or anything UI related from different threads than the UI thread.
Observation
The QQuickWindow implementation does exactly this, even repeatedly, when syncing the render thread:
https://github.com/qt/qtdeclarative/blob/dev/src/quick/items/qquickwindow.cpp#L524
It seems to be unnecessary, to ask for the device pixel ratio each time in this case, and it should be considered to rather use a similar mechanism comparable to when accessing the metal layer during rendering.
Example callstack:
#0 0x000000010281683c in NI_6_x_dev::QCocoaWindow::devicePixelRatio() const at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm:1921 #1 0x000000010227d928 in NI_6_x_dev::QWindow::devicePixelRatio() const at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtbase/src/gui/kernel/qwindow.cpp:1336 #2 0x00000001005dcf00 in NI_6_x_dev::QQuickWindow::effectiveDevicePixelRatio() const at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtdeclarative/src/quick/items/qquickwindow.cpp:3810 #3 0x00000001005dcca0 in NI_6_x_dev::QQuickWindowPrivate::syncSceneGraph() at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtdeclarative/src/quick/items/qquickwindow.cpp:537 #4 0x000000010092c1bc in NI_6_x_dev::QSGRenderThread::sync(bool) at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtdeclarative/src/quick/scenegraph/qsgthreadedrenderloop.cpp:550 #5 0x000000010092cd70 in NI_6_x_dev::QSGRenderThread::syncAndRender() at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtdeclarative/src/quick/scenegraph/qsgthreadedrenderloop.cpp:688 #6 0x000000010092e0ac in NI_6_x_dev::QSGRenderThread::run() at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtdeclarative/src/quick/scenegraph/qsgthreadedrenderloop.cpp:938 #7 0x000000010033bc7c in NI_6_x_dev::QThreadPrivate::start(void*)::$_0::operator()() const at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:321 #8 0x000000010033a644 in void NI_6_x_dev::(anonymous namespace)::terminate_on_exception<NI_6_x_dev::QThreadPrivate::start(void*)::$_0>(NI_6_x_dev::QThreadPrivate::start(void*)::$_0&&) at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:257 #9 0x000000010033a5d4 in NI_6_x_dev::QThreadPrivate::start(void*) at /Users/stefan.wastl/NIBuild/libraries/qt/qt6-all/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:280 #10 0x000000010b9b9890 in _pthread_start ()
Side notes
We only noticed this now, since we for a long time had the threaded rendering turned off by a private API ( qsg_disableThreadedRendering ), but which has started to cause fatal issues:
Execution of the command buffer was aborted due to an error during execution. Invalid Resource (00000009:kIOGPUCommandBufferCallbackErrorInvalidResource)
eventually freezing certain machines NSView state:
Execution of the command buffer was aborted due to an error during execution. Ignored (for causing prior/excessive GPU errors) (00000004:kIOGPUCommandBufferCallbackErrorSubmissionsIgnored)
Attachments
Issue Links
- duplicates
-
QTBUG-115090 [macOS] QCocoaWindow::devicePixelRatio called from scenegraph render thread results in warning
- Closed