Qt
  1. Qt
  2. QTBUG-42699

QML Timer too fast with Animation on Windows

    Details

    • Commits:
      d3b0bd40ec2a2741e35e19250205af2d632a0a52

      Description

      import QtQuick 2.3
      
      Item {
          Timer {
              property var lastTime
              interval: 1000
              running: true
              repeat: true
              onTriggered: {
                  if (lastTime) {
                      console.log(Date.now() - lastTime);
                  }
                  lastTime = Date.now();
              }
          }
          SequentialAnimation on z {
              loops: Animation.Infinite
              NumberAnimation { from: 0; to: 1; duration: 1000 }
          }
      }
      

      Output:

      qml: 340
      qml: 333
      qml: 333
      qml: 334
      
      1. qtbug42699_sequential.qml
        0.6 kB
        Friedemann Kleint
      2. QtQuickTimerTest.zip
        3 kB
        Christian Feldbacher

        Issue Links

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

          Activity

          Hide
          Laszlo Agocs added a comment -

          It is, in the sense that both the threaded and windows render loops install an animation driver, whereas the basic one doesn't.

          Show
          Laszlo Agocs added a comment - It is, in the sense that both the threaded and windows render loops install an animation driver, whereas the basic one doesn't.
          Hide
          Laszlo Agocs added a comment - - edited

          Retested the app (QtQuickTimerTest) on a different machine. Now with again different results:

          Both NVIDIA and Intel are fine when using OpenGL with the threaded render loop (as is the new default in Qt 5.5). Cannot reproduce the previous 1300-1400 results.

          When switching to ANGLE which in turn triggers the windows render loop - or just forcing the windows render loop with desktop GL - it all goes wrong (300 ms instead of 1000, etc.) as shown above.

          Show
          Laszlo Agocs added a comment - - edited Retested the app (QtQuickTimerTest) on a different machine. Now with again different results: Both NVIDIA and Intel are fine when using OpenGL with the threaded render loop (as is the new default in Qt 5.5). Cannot reproduce the previous 1300-1400 results. When switching to ANGLE which in turn triggers the windows render loop - or just forcing the windows render loop with desktop GL - it all goes wrong (300 ms instead of 1000, etc.) as shown above.
          Hide
          Laszlo Agocs added a comment -

          https://codereview.qt-project.org/#/c/110232/ will fix the windows render loop (that is used only by ANGLE in 5.5, and both desktop GL and ANGLE in 5.4 and earlier) to prevent running animations at 3x speed when there is no update to the scene contents.

          This (and this applies to the threaded render loop too) is somewhat inaccurate: it involves a manual sleep instead of relying on the graphics driver's block to wait for vsync behavior. So little deviations are expected.

          Show
          Laszlo Agocs added a comment - https://codereview.qt-project.org/#/c/110232/ will fix the windows render loop (that is used only by ANGLE in 5.5, and both desktop GL and ANGLE in 5.4 and earlier) to prevent running animations at 3x speed when there is no update to the scene contents. This (and this applies to the threaded render loop too) is somewhat inaccurate: it involves a manual sleep instead of relying on the graphics driver's block to wait for vsync behavior. So little deviations are expected.
          Hide
          Pawel Kurdybacha added a comment -

          I am not sure if this is related. I have applied the fix above but I still experience problem on Windows 7 (animations are ~3x faster then duration time e.g. in NumberAnimation when vsync settings are off in NVIDIA settings panel (when vsync is ON then everything is fine).

          qt.scenegraph.info: threaded render loop
          qt.scenegraph.info: Using sg animation driver
          qt.scenegraph.info: Animation Driver: using vsync: 16.95 ms
          qt.scenegraph.info: Animation Driver: using vsync: 16.95 ms
          qt.scenegraph.info: texture atlas dimensions: 1024x1024
          qt.scenegraph.info: R/G/B/A Buffers: 8 8 8 8
          qt.scenegraph.info: Depth Buffer: 24
          qt.scenegraph.info: Stencil Buffer: 8
          qt.scenegraph.info: Samples: 0
          qt.scenegraph.info: GL_VENDOR: NVIDIA Corporation
          qt.scenegraph.info: GL_RENDERER: NVS 315/PCIe/SSE2
          qt.scenegraph.info: GL_VERSION: 4.4.0
          
          Show
          Pawel Kurdybacha added a comment - I am not sure if this is related. I have applied the fix above but I still experience problem on Windows 7 (animations are ~3x faster then duration time e.g. in NumberAnimation when vsync settings are off in NVIDIA settings panel (when vsync is ON then everything is fine). qt.scenegraph.info: threaded render loop qt.scenegraph.info: Using sg animation driver qt.scenegraph.info: Animation Driver: using vsync: 16.95 ms qt.scenegraph.info: Animation Driver: using vsync: 16.95 ms qt.scenegraph.info: texture atlas dimensions: 1024x1024 qt.scenegraph.info: R/G/B/A Buffers: 8 8 8 8 qt.scenegraph.info: Depth Buffer: 24 qt.scenegraph.info: Stencil Buffer: 8 qt.scenegraph.info: Samples: 0 qt.scenegraph.info: GL_VENDOR: NVIDIA Corporation qt.scenegraph.info: GL_RENDERER: NVS 315/PCIe/SSE2 qt.scenegraph.info: GL_VERSION: 4.4.0
          Hide
          Laszlo Agocs added a comment -

          That's expected in the sense that the threaded render loop must never be used if there is no vsync-based throttling. If you are in the special case of having vsync turned off, switch to the basic render loop (QSG_RENDER_LOOP=basic).

          Show
          Laszlo Agocs added a comment - That's expected in the sense that the threaded render loop must never be used if there is no vsync-based throttling. If you are in the special case of having vsync turned off, switch to the basic render loop (QSG_RENDER_LOOP=basic).

            People

            • Assignee:
              Laszlo Agocs
              Reporter:
              S.Gold
            • Votes:
              9 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews Side Panel

                Error rendering 'com.meetme.plugins.jira.gerrit-plugin:gerrit-reviews-side-panel'. Please contact your JIRA administrators.