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

Input lag could be reduced for QML

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.2
    • Qt RHI, Quick: SceneGraph
    • None
    • Android, Windows
    • 02bf4d06b (dev), 91cae3f9c (dev), 920060606 (6.8), 1e6950fd7 (6.8), 6b598235b (dev)

    Description

      QML applications in both Windows and Android have a big input latency on 60 Hz screens, creating a worse UX for users than what is offered by Qt Widgets on Windows or native apps on Android. You can reproduce the problem easily by compiling the qml file below, then moving the mouse around the screen and seeing that the rectangle lags behind the mouse. I wasn't able to reproduce the same issue on macOS though, where the rectangle keeps up fairly close with the mouse movement (why isn't it a problem on macOS?). If you disable VSync, the problem goes way, so the issue might be caused by the VSync blocking the render thread, which will in turn block the UI thread and stall event processing; but disabling VSync is not an option since animations will stop running smoothly and we could introduce tearing.

      What we could do instead is to introduce the APIs for VSync synchronization native to each platform - IDXGIOutput::WaitForVBlank on Windows and Choreographer on Android - to solve the animation issues and disable vsync if the system compositor already solves the tearing issue.

       

      import QtQml.Models
      import QtQuick
      import QtQuick.Window
      import QtQuick.Controls
      import QtQuick.Layouts
      
      Window {
          id: window
          visible: true
          width: 640
          height: 480
          title: "QtQuickApplication1"
          
          Rectangle {
              color: "gray"
              width: 40
              height: 40
              x: ma.point.position.x - width / 2
              y: ma.point.position.y - height / 2
          }
          HoverHandler {
              id: ma
          }
      } 

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-127267
          # Subject Branch Project Status CR V

          Activity

            People

              lagocs Laszlo Agocs
              felipef Felipe Goron Farinon
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: