VSYNC seems unresponsive in Qt 5.15 EGLFS
Hi,
Last couple of weeks I am trying to debug a rendering issue between eglfs and what I believe to be a VSYNC/Tearing issue. For testing I am using a bootlin demo build-root image with elgfs support.
The image has Qt5.15, EGLFS and EGL support (more detailed description of the image specifications under: st_stm32mp135f_dk_demo.) Most of the QT examples have apparent vsync (tearing) issues like the one in this video. Weirdly enough, the pure opengl examples like hellowindow work perfectly fine.
I attempted to gather more information about the issue in a few ways:
- Experimenting with the QT environment variables:
I tried to set QT_QPA_EGLFS_ALWAYS_SET_MODE=1, QT_QPA_EGLFS_KMS_ATOMIC=1 with no results. I also created a KMS config file. What seemed weird to me is that the FORCEVSYNC and SWAPINTERVAL variables they do not seem affect the image, even though I can see on the EGLFS_DEBUG that the the variables have been applied.
- Testing different displays:
I tested 4 different displays with DSI, and HDMI Bridges. In all displays the issue is the same but the lower the resolution gets the less frequent the issue is. For example in the 480x800 DK2 display tearing appears once every couple of seconds while in an HDMI connected 1080p display the issue is continues.
- Testing different images
I had an old qt-image example from 2020 that used to work with no issues. In the 2020 linux 5.10, eglfs distribution all 4 displays work with no issues.
Then I tried the latest qt-example image and although the issue was not identical tearing issue was still there.
Lastly I tried the demo weston image that seems to work just fine with a few dropped frames here and there.
- Testing different LTDC clock configuration
Going back to buildroot, I tried a 79MHz and an 84.85MHz configurations with no luck.
- Testing different versions of linux
Both in linux 5.10 and 5.15 the issue is the same.
- Testing DRM/KMS framework
Modetest vsync test works with no issues in all displays.
Attached some of the EGLFS and Modetest logs:
QML debugging is enabled. Only use this in a safe environment.
Failed to move cursor on screen DSI1: -14
Failed to move cursor on screen DSI1: -14
Shmem has been moved to thread
shmemThread has started
Created context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile) with config:
EGL_BUFFER_SIZE: 24
EGL_ALPHA_SIZE: 0
EGL_BLUE_SIZE: 8
EGL_GREEN_SIZE: 8
EGL_RED_SIZE: 8
EGL_DEPTH_SIZE: 24
EGL_STENCIL_SIZE: 8
EGL_CONFIG_CAVEAT: 12344
EGL_CONFIG_ID: 15
EGL_LEVEL: 0
EGL_MAX_PBUFFER_HEIGHT: 8064
EGL_MAX_PBUFFER_PIXELS: 65028096
EGL_MAX_PBUFFER_WIDTH: 8064
EGL_NATIVE_RENDERABLE: 1
EGL_NATIVE_VISUAL_ID: 875713112
EGL_NATIVE_VISUAL_TYPE: 32
EGL_SAMPLES: 0
EGL_SAMPLE_BUFFERS: 0
EGL_SURFACE_TYPE: 1287
EGL_TRANSPARENT_TYPE: 12344
EGL_TRANSPARENT_BLUE_VALUE: -1
EGL_TRANSPARENT_GREEN_VALUE: -1
EGL_TRANSPARENT_RED_VALUE: -1
EGL_BIND_TO_TEXTURE_RGB: 1
EGL_BIND_TO_TEXTURE_RGBA: 1
EGL_MIN_SWAP_INTERVAL: 1
EGL_MAX_SWAP_INTERVAL: 604 33 connected DSI-1 309x83 1 33
modes:
index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
#0 1920x515 48.08 1920 1980 2000 2080 515 525 560 565 56500 flags: nhsync, nvsync; type: preferred, driver
props:
1 EDID:
flags: immutable blob
blobs:
value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
5 link-status:
flags: enum
enums: Good=0 Bad=1
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
4 TILE:
flags: immutable blob
blobs:I am sure that there are still a lot of places to look but I am starting to get out of ideas. Any help or tips is highly appreciated.
All the best,
Kyr
