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

Idle Mode Support

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • 5.7.0
    • Qt3D TP2
    • Qt3D
    • None

    Description

      The following information comes from the implementors of the QSG framework underlying QML2. Its going to be particularly important on any Qt5 / QML2 device, but is also relevant for the destop.

      When applications are not visible on screen, typically because the screen is off or another application is overlaid, the applications can enter an idle mode. When this happens, the following things happens to QML applications:

      • Based on receiving the QWindow::exposeEvent(), the framework decides that the application is no longer visible on screen and stops scene graph rendering
      • The animation system switches to a timer based tick rather than the normal vsync tick. This tick is currently set to time out once every second

      When in idle mode, the application should do as little as possible, preferably it should be 100% idle. QML Applications should tie their long-running animations, timers and continuous logic to the "Qt.application.active" property and use that property to go idle when idle. C++ applications can use the QWindow::exposeEvent() in conjunction with QWindow::isExposed() to decide if they are visible in the compositor or not and go dormant when obscured or hidden.

      The reason QML animations cannot be stopped completely is that they are integral parts of state changes and very often do actual work, even though one might argue that they shouldn't.

      If the system enters into a low-memory situation while in idle mode, it may start to release scene graph and OpenGL resources. The reason for doing this is so that the application can free up memory "while in your pocket" to do things like indexing of images or other memory intensive work, without foreground app being killed. It will also help with keeping the simpler apps alive while switching between them, a feature that was planned but is currently on hold, as apps swiped to the background can release a significant amount of their own memory but still function properly.

      • If you use OpenGL resources, register for QOpenGLContext::aboutToBeDestroyed() and clean up gracefully
      • If you use scene graph, register for QQuickCanvas::sceneGraphInvalidated() and clean up gracefully.

      Applications that would rather be killed in this situation can opt-in for this using QQuickCanvas::setPersistentSceneGraph() to preserve the scene graph nodes and resources and QQuickCanvas::setPersistenOpenGLContext() to preserve the OpenGL context, shaders. Qt3D is an obvious candidate for opting out of this feature are as they do their own GL rendering and may not want to support staying alive without a GL context.

      QML applications that do not make explicit use of OpenGL or scene graph API, which the majority of our apps do, do not have to care about this at all. The QML scene is unaffected.

      Attachments

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

        Activity

          People

            dpope Daniel Pope (closed Nokia identity) (Inactive)
            sarasmit Sarah Smith (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes