Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Cannot draw a single rectangle at constant 60fps
Forum Updated to NodeBB v4.3 + New Features

Cannot draw a single rectangle at constant 60fps

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 217 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CharbyC Offline
    CharbyC Offline
    Charby
    wrote on last edited by
    #1

    I was curious about the fps performance versus element type so I wrote a simple test program to display a number of elements (Canvas, QuickPaintedItem, QNanoPainter, QuickItem...)...
    Doing this, I experienced that drawing a single Rectangle was not always showing a 60fps : when window is getting large enough (more than 2000x2000), the fps suddenly drops to 35-40 fps.
    In addition, It happens in rare occasion I could reach full screen dimension (3840x2160) with a steady 60fps.

    Tested with Debian bullseye, Qt5.15.2, Nvidia GeForce GTX 1060 6GB

    Here is the QML document for a single Rectangle :

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2.2
    
    Window {
        id:window
        width: 640
        height: 480
        onWidthChanged: console.log("width : " + width  )
        onHeightChanged: console.log("height : " + height  )
        visible: true
        title: qsTr("Test FPS")
    
        Rectangle{
            anchors.fill:parent
            color:"red"
    
            Control{
                id: fpsMeter
                property int frameCounter: 0
                property int frameCounterAvg: 0
                property int counter: 0
                property real fps: 0
                property real fpsAvg: 0
                implicitWidth :100
                implicitHeight:20
    
                Item {
                    anchors.fill: parent
                    NumberAnimation on rotation {
                        from:0; to: 360; duration: 800; loops: Animation.Infinite
                    }
                    onRotationChanged: fpsMeter.frameCounter++;
                }
    
                Label {
                    anchors.fill: parent
                    text: "Ø " + fpsMeter.fpsAvg.toFixed(1) + " | " + fpsMeter.fps.toFixed(1) + " fps"
                }
    
                Timer {
                    interval: 1000; repeat: true; running: true
                    onTriggered: {
                        fpsMeter.frameCounterAvg += fpsMeter.frameCounter;
                        fpsMeter.fps = fpsMeter.frameCounter / interval * 1000;
                        fpsMeter.counter++;
                        fpsMeter.frameCounter = 0;
                        if (fpsMeter.counter >= 10) {
                            fpsMeter.fpsAvg = fpsMeter.frameCounterAvg/(interval / 1000 * fpsMeter.counter)
                            fpsMeter.frameCounterAvg = 0;
                            fpsMeter.counter = 0;
                        }
                    }
                }
            }
        }
    }
    
    

    Do you have feedbacks about known limitations/issues or simply things I could do wrong (I have tried to analyse it with qml profiler but without finding the potential bottleneck) ?

    1 Reply Last reply
    0
    • CharbyC Offline
      CharbyC Offline
      Charby
      wrote on last edited by
      #2

      Just find out that since a recent OS upgrade the hardware acceleration was not activated on my device, installing nvidia driver fixed this issue.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved