QML and Qt c++ Vsync and Tearing Problems - Summary of possible Solutions



  • Hi everyone,

    I started a project to use QML (UI) and QT C++(Logic) on embedded devices (right now I am using the i.MX53).

    My animation is quite simple: I am moving a few images and fade them in and out.
    During this animation tearing appears. OpenGL is used to benefit from hardware accerlation.

    I read a few blogs and forum posts regarding similar problems.
    First, I would like to summarize the problems and possible solutions I found (as far as I understood it correctly)

    Short description of tearing from wikipedia:
    Screen tearing is a visual artifact in video where information from two or more different frames is shown in a display device in a single screen draw.
    The artifact occurs when the video feed sent to the device isn't in sync with the display's refresh, be it due to non-matching refresh rates, or simply lack of sync between the two. During video motion, screen tearing creates a torn look as edges of objects (such as a wall or a tree) fail to line up.

    Example, how it looks like:
    !http://tdistler.com/wp-content/uploads/2010/07/v_sync.jpg!

    Problems:

    1. QML is facing right now VSYNC problems.
      -> These problems are known by the Qt Development team and they will fix them in the Qt5.0 release.

    Possible Solutions:

    1. Use QMLSceneGraph
      1.1 Qt 4.8 with QML 2
      "http://ilkka.github.com/blog/2011/03/04/qtquick_2_scenegraph_glsl_fragment_shader_tutorial/"
      1.2 Qt 5.0 with QML 2
      "http://zchydem.enume.net/2010/11/01/playing-with-qt-scene-graph/"

    2. Write own QGLWidget and override the paint() function
      Set autoswapbuffers to false and swapbuffers manually.
      Try to fake the algorithm of QMLSceneGraph:
      @while (animationIsRunning) {
      paintQMLScene();
      swapAndBlockForNextVSync();
      }@

    Original source: "velvet and the qml scene graph":http://labs.qt.nokia.com/2010/12/02/velvet-and-the-qml-scene-graph/

    1. Should work, but doesn't for me:
      @QGLFormat fmt = QGLFormat::defaultFormat();
      fmt.setSwapInterval(1);@

    Questions and Problems regarding the solutions:

    Did somebody face similar or the same problems I did and solved it ?

    1.1 I managed to install Qt 4.8 and add QML2, but when I am executing the project then I get always the same error message:
    QDeclarativeView only supports loading of root objects that derive from QGraphicsobject
    1.2. I couldn't manage to install Qt 5.0 from the repository, but I am able to find some videos and blog post which proof that it should work and that I am the problem .. ;)

    1. I tried to implement my own QGLWidget, but right now I can't figure it out how to do it. I do not understand how the qml elements are communicating with the Qt c++ paint() function of Opengl.
    2. Easiest way but doesn't work for me. It's explained in the velvet qt labs post.

    I can't imagine that I am the only one who has this problems, thats why I tried to share my small experience about this topic with the community.

    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.