This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x EVM tearing

Hi everybody,
I am currently working on implementing a smooth scrolling text on AM335x EVM using QT/Embedded (4.8).

Everything is fine: the text scrolls very smoothly and the CPU usage is so low! *BUT* I have an annoying tearing effect... I tried to implement the scrolling in both a standard QWidget and in a QGLWidget... I also tried QT Quick 1.1... but the problem is always there...

I guess it is due to the fact that the drawing to framebuffer is not sync with the display VSYNC...

I already tried to modify the settings in /etc/powervr.ini (for using a FLIP or BLIT approach) but it does not change anything...


Have you some ideas about that?

Thanks!

  • I am currently working on AM335x Starter Kit.Let me know if you need other details from my side.

    Thanks

  • Hello,

    I think your best bet would be to use the fbdev wait for vsync ioctl: FBIO_WAITFORVSYNC
    If you call that ioctl before your framebuffer is updated, then that should eliminate the tearing.  I've never attempted to integrate wait for vsync into Qt as you would have to do, but I have done it on Qt applications where i was updating the framebuffer manually, and it worked well.

    Regards,

    Josh
  • Thank you so much Josh for your reply, but I am "starter" with linux embedded development and I need some additional hints from your side...

    How can I do what you are telling about? Can you provide a code sample? (remember that I am using Qt)

  • Hello,

    I don't see much material on enabling vysnc in a Qt app (other than by using an OpenGL plugin), but maybe double buffering could help you out.

    Here is a nice, in-depth tutorial I found on double buffering with Qt: http://www.informit.com/articles/article.aspx?p=1405227&seqNum=4

    Let me know if that helps with your tearing issue.

    Regards,

    Josh

  • Thanks Josh for your reply...

    Actually double-buffering hasn't helped...

    Now I just compiled QT5 (which seems to have a better VSYNC support) for my platform and the tearing is fixed.

    Even if I fixed my problem I leave the question open because if would be nice to understand if and how it is possible to do that with QT 4.8.x.

  • Hello,


    Thanks for the update--that is interesting to hear.  I would also like to get some more insight into how vsync is handled in Qt 4, so I will look more into this.

    Did the tearing stop with Qt 5 with additional modifications to your code to ensure vsync support, or did it just work with no changes?

    Josh

  • Hi Josh,
    I haven't made any special modifications to my code... Simply compiled it against QT5 and the magic was done!

    Anyway please let me know if you discover something useful for enabling VSYNC support in QT4.x. Thanks!

    Regards,
    /Moris

  • Hi,

    I've found a way to fix vertical tearing in Qt 4.8 but *only* for GLWidgets.

    I had to patch the sources because the method setSwapInterval() was not working for me.

    I made the following modification :

    - In the file src/plugins/powervr/QWSWSEGL/pvrqwsdrawable.c :

       - In the beginning of the pvrQwsSwapBuffers() method :

          - Add the folowing line : 

          ioctl(fd , FBIO_WAITFORVSYNC, 0);

    This works great for me, however, as I mentioned, standard widgets still suffer from some tearing. So if somenone knows where else I could use the IOCTL call for the other widgets it would be really appreciated.

    By the way, Qt5 with the EGLFS platform works fine for me but I need to apply a screen rotation (portrait mode) to my app so I cannot use it out of the box. I tried to build walyand, qtwalyand and sgx-wayland-wsegl, and almost succeeded, but it is a real pain to get these things working...