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

QML is using way too much CPU on Mac OS X on 4K external monitor (scaled)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.14.0 RC2
    • GUI: OpenGL
    • None
    • OS X 10.14.6
      MacBook Pro 13" 2016 (3,3 GHz Intel Core i7)
      External 4K monitor on Thunderbolt connector
    • macOS

    Description

      Hello!

      We have noticed considerable slowness of QML based application on MacBook Pro 13" 2016 (3,3 GHz Intel Core i7), Intel Iris Graphics 550 1536 MB graphics, OS X 10.14 when the app is running on external 4K monitor with scaling enabled. Even a simple 1 icon AnimatedSprite in application would not be smooth. QT elements as Menus open really laggy/jumpy etc.

      We have observed that the issue is the same using QT 5.12 or 5.14. What changes behaviour is using Xcode 9.4.1 vs. Xcode 11.3. It is much better when compiling with Xcode 9.4.1, but still takes 10x the CPU of the same code on Windows machine.

      We made an example project to test it out and simple QML code with two AnimatesSprites (project attached) is using on Mac 12% CPU on startup and then after 20-30s it settles on 5-7% CPU. On Windows same code uses something as 0.2% CPU. Now imagine what happens on complex application with many QML elements. We get CPU usages of 20-30% because of one single AnimatedSprite in GUI.

      We did notice that:

      https://doc.qt.io/qt-5.12/qtquick-visualcanvas-scenegraph.html

      "On macOS, the threaded render loop is not supported when building with XCode 10 (10.14 SDK) or later, since this opts in to layer-backed views on macOS 10.14. You can build with Xcode 9 (10.13 SDK) to opt out of layer-backing, in which case the threaded render loop is available and used by default."

      It seems with Xcode 10 and over everything gets redrawn because of one single AnimatedSprite....

      But even with Xcode 9 the CPU usage is WAY TO HIGH, but at least "potentially usable".

      Sample code (main.qml):

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      
      Window {
          visible: true
          width: 1920
          height: 1080
          title: qsTr("Hello World")
      
      
          AnimatedSprite{
              anchors.left:parent.left
              anchors.leftMargin:25
              anchors.verticalCenter:parent.verticalCenter
              source:"qrc:/icon-spinning-animation.png"
              width:128;
              height: 128;
              frameWidth: 128
              frameHeight: 128
              frameCount: 120
              frameRate: 60
      
      
              interpolate:true
              frameSync: true
              loops:1000
      
      
          }
      
      
          AnimatedSprite{
              anchors.right:parent.right
              anchors.rightMargin:25
              anchors.verticalCenter:parent.verticalCenter
              source:"qrc:/icon-spinning-animation.png"
              width:128;
              height: 128;
              frameWidth: 128
              frameHeight: 128
              frameCount: 120
              frameRate: 60
      
      
              interpolate:true
              frameSync: true
              loops:1000
      
      
          }
      

      Attachments

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

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            alien2108 Alen Salamun
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes