MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

Suggestion: use software QML scene graph backend

Open RJVB opened this issue 1 year ago • 3 comments
trafficstars

Your idea

MuseScore seems to use QML/QQuick* only for the palette widget which isn't exactly a graphics-intensive feature.

Problem to be solved

The problem I ran into is a freak one. A self-built MuseScore/Linux install (3.6.2 but that's moot here) that had been working for months (years, actually) all of a sudden started crashing during startup. This happened because of a memory corruption deep in Mesa libraries while trying to enumerate the available OpenGL extensions in QML's SGRenderer thread.

Running under valgrind didn't teach me anything other than that memory corruption was occurring in those Mesa libraries but I could not reproduce this with any other application than MuseScore. It looks like the loading of KDE/KF5 plasma libraries (kirigami and family) was a triggering factor; using a "parallel" Qt install with a different QT_PLUGIN_PATH allowed to circumvent the issue.

On a hunch I tried calling QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software); just after creating the QCoreApplication instance. This also "solved" the issue, while still allowing to use the full contingent of applicable KDE/KF5 libraries and plugins and without any observable effect on functionality or performance.

Prior art

No response

Additional context

No response

Checklist

  • [X] This request follows the guidelines for reporting issues
  • [X] I have verified that this feature request has not been logged before, by searching the issue tracker for similar requests

RJVB avatar Oct 19 '24 14:10 RJVB

This issue seems not applicable to MuseScore 4+, which is written completely in QML. Using the software backend by default is no option because of its inferior performance, and the fact that it does not support simple graphical effects such as drop shadow and masks for rounded corners. However, we have recently implemented a system for falling back to software rendering when certain Qt graphics error messages are detected in the log files.

Additionally, according to the documentation (https://doc.qt.io/qt-6/qquickwindow.html#setSceneGraphBackend and https://doc.qt.io/qt-6/qtquick-visualcanvas-adaptations.html), you can force MuseScore to use the software backend anyway by setting the QT_QUICK_BACKEND=software env variable.

I don't know if there is anything more to say about this issue or that we can close it.

cbjeukendrup avatar Oct 19 '24 14:10 cbjeukendrup

On Saturday October 19 2024 07:17:51 Casper Jeukendrup wrote:

This issue seems not applicable to MuseScore 4+, which is written completely in QML.

Yuck ^^ (A complete rewrite in QML must indeed have done wonders for the performance of the core functionality ^^)

Additionally, according to the documentation (https://doc.qt.io/qt-6/qquickwindow.html#setSceneGraphBackend and https://doc.qt.io/qt-6/qtquick-visualcanvas-adaptations.html), you can force MuseScore to use the software backend anyway by setting the QT_QUICK_BACKEND=software env variable.

Hah, I tried to search for such a control switch; if it had come up I'd probably not have posted this issue.

I don't know if there is anything more to say about this issue or that we can close it.

It was nothing more than a suggestion and a PSA for anyone hitting a similar inexplicable sudden problem.

RJVB avatar Oct 19 '24 14:10 RJVB

To be clear, only the GUI is in QML. The time it takes to draw the interface is not a major factor in overall application performance and doesn’t inpact “core functionality”.

MarcSabatella avatar Oct 19 '24 15:10 MarcSabatella

We decided to close this issue for now, for the following reasons:

  • using software rendering for everyone is not really a good idea because of the performance implications, and is not necessary for most users
  • we now have a system that falls back to software rendering in a few known problematic cases
  • for sporadic cases where it is necessary to use software rendering but it is not detected by our fallback system, the user can use the mentioned Qt environment variables
  • As Qt updates and driver updates etc. are released, the need for using software rendering should decrease over time.

But thanks anyway for the suggestion!

cbjeukendrup avatar Oct 22 '24 20:10 cbjeukendrup