Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135954

[REG] Wayland: Over 2x higher painting CPU usage when display scaling is used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.8.3, 6.9.0
    • QPA: Wayland
    • None
    • kwin_wayland
    • Linux/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();
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            davidedmundson David Edmundson
            zaps166 Błażej Szczygieł
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes