Qt 5 XCB tearing

I am running Qt 5.4.2 on an Apalis T30 with a Fido image. Unfortunately the Tegra only has proprietary drivers and they are forcing me to use X11 for hardware acceleration. I therefore had to build Qt with XCB instead of EGLFS.

My problem is that I am seeing tearing on some QML 2 animations on the device that are not visible on my PC. I am wondering if there is anything I can do to try and get rid of this tearing? I have read that QT_QPA_EGLFS_FORCEVSYNC might help but unfortunately I can’t use EGLFS and doubt if it will be of any use.

I have noticed that “QSGContext::initialize: stencil buffer support missing, expect rendering errors” as well as “Qt Warning: Could not find a location of the system’s Compose files. Consider setting the QTCOMPOSE environment variable.” come up when the application is started. I am not sure if they can be related to the problem.

Yes, T20/T30 officially only allow for hardware acceleration on top of X11.
Synchronisation wise as far as we are aware T20/T30 always syncs to the primary display controller interface being parallel RGB aka LVDS-1. What displays/monitors are you experiencing the tearing on?
We don’t know much about the missing stencil buffer support or QTCOMPOSE settings but do not believe this being related at all.

I am experiencing this on the HDMI output. I have read that many people found that a simple switch to EGL can solve a problem. I am trying to see if that will help as I believe that that XCB probably uses GLX by default. Unfortunately this switch is easier said than done… Could something like that make a difference?

I guess as officially only EGL is validated on T20/T30 as far as I know (see documentation/release notes at https://developer.nvidia.com/linux-tegra-rel-16 for more information).

Why would GLX even work if NVIDIA does not support it? Is Mesa built by default on the Yocto images and possibly providing it? Also, how hardware accelerated would a situation like that be because at the moment it does not seem as if it is using mesa as a software renderer based on the performance that I am getting.

That’s indeed a very good question however we are kind of the wrong party to ask as the whole graphics/multimedia stack is provided by NVIDIA. Concerning Mesa and Yocto that depends as some are misusing that to work around missing OpenGL headers. However I am hesitant to comment on what exactly you now might have built.

Ok I just got Qt running on the EGLFS QPA using its X11 backend and the tearing is still there. Though as it was previously the tearing only happens with some animation, more specifically, when more than one object is animated at the same time. Is there anything else I can do to try and force vsync?

At least for Qt 5.5, there is the environment variable QT_QPA_EGLFS_INTEGRATION which allows to chose the X11 platform integration for EGL, this might be worth a try. However, I really don’t think that this will solve the VSync issue for the Tegra case. See also Qt for Embedded Linux | Qt 5.15

As far as I understand the Qt EGLFS QPA, it consists of hardware dependent backends. I guess that QT_QPA_EGLFS_FORCEVSYNC is something which need to be implemented in a hardware specific manor (at least when dealing with proprietary drivers). The only reference to this environment variable is using a ioctrl on a fbdev:

I am pretty sure that this is not going to work for the Tegra binary drivers since NVidia mandates using EGL ontop of X11…