core: Disable Qt RHI pipeline cache

The Qt pipeline cache causes a disk sync on every load and save of a
QQuickWindow. This causes a stutter under high disk usage.

The gains from this cache are minimal on our simple scenes on PC
hardware. Especially given mesa has it's own cache, profiling on my
personal laptop showed the pipeline as being 0ms.

There is an upstream patch at
https://codereview.qt-project.org/c/qt/qtdeclarative/+/564411 .
QSaveFile still has a sync, but that should only be hit for the first
non-cached run. I'm also adding a flag to QSaveFile to fix the QML cache
and first run case. 

Tested via running kwin with `strace -e
inject=fdatasync:delay_enter=10000000` to simulate a slow flush.

BUG: 487043
This commit is contained in:
David Edmundson 2024-05-31 15:28:09 +00:00 committed by Vlad Zahorodnii
parent 40839e3347
commit f700de56f8
2 changed files with 10 additions and 0 deletions

View file

@ -285,6 +285,11 @@ int main(int argc, char *argv[])
// enforce our internal qpa plugin, unfortunately command line switch has precedence
setenv("QT_QPA_PLATFORM", "wayland-org.kde.kwin.qpa", true);
// The shader (currently) causes a blocking disk flush on load and save of every QQuickWindow
// Because it's on load, it will happen every time not just occasionally
// The gains are minimal, disable until it's fixed
QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache);
KWin::ApplicationWayland a(argc, argv);
// reset QT_QPA_PLATFORM so we don't propagate it to our children (e.g. apps launched from the overview effect)

View file

@ -400,6 +400,11 @@ int main(int argc, char *argv[])
// For sharing thumbnails between our scene graph and qtquick.
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
// The shader (currently) causes a blocking disk flush on load and save of every QQuickWindow
// Because it's on load, it will happen every time not just occasionally
// The gains are minimal, disable until it's fixed
QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache);
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
// shared opengl contexts must have the same reset notification policy
format.setOptions(QSurfaceFormat::ResetNotification);