Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.8.3, 6.9.0
-
None
-
kwin_wayland
Description
When scaling is set to value higher than 100% (e.g. 175%, 200%, ...) I noticed over 2x more CPU usage when painting than on 100% scaling. Bisected to this: https://codereview.qt-project.org/c/qt/qtwayland/+/604320 and https://codereview.qt-project.org/c/qt/qtwayland/+/604633
Reverting mentioned commit fixes the issue.
Example program to reproduce (CPU usage at fixed 4.5GHz CPU clock, 60 FPS):
- Qt 6.7.3: ~20% CPU usage (scale doesn't change CPU usage)
- Qt 6.9.0:
- 100% scale: ~25% CPU usage
- 200% scale: ~70% CPU usage
#include <QGuiApplication> #include <QRasterWindow> #include <QElapsedTimer> #include <QPainter> class PaintWin : public QRasterWindow { public: QElapsedTimer et; uint8_t brightness = 0; int64_t cnt = 0; PaintWin() { et.start(); } void paintEvent(QPaintEvent *) override { auto elapsed = et.nsecsElapsed() / 1e9; if (elapsed >= 1.0) { et.restart(); qDebug () << cnt / elapsed << "FPS"; cnt = 0; } ++cnt; QPainter p(this); p.fillRect(QRect(QPoint(), size()), QColor(brightness, brightness, brightness)); ++brightness; update(); } }; int main(int argc, char *argv[]) { QGuiApplication a(argc, argv); auto win = new PaintWin; win->showMaximized(); return a.exec(); }