eglSwapInterval(display, 1) halves fps on Raspberry Pi 4
Description
I'm writing a video player for Raspberry Pi 4. I'm using Weston with DRM backend and I'm rendering video frames via OpenGL ES. As far as I know, it should be possible to get 60 fps at Full HD resolution, but I'm getting only 30 fps.
Calling eglSwapInterval(display, 0)
in the beginning of the program fixes the issue. sort-off. If I understand correctly, it disables vsync so that I can swap buffers as fast as I want. If I call it, it indeed gets faster (around 50 fps) and the output is a bit choppy, because it's not in sync with the screen.
If I don't call it, the default interval is 1 which should allow me to swap buffers in sync with the screen's refresh rate. But if that's true, why am I only getting 30 fps if the refresh rate of the screen is 60 Hz?
The call that takes long to complete is eglSwapBuffers
. That's what slows it down to 30 fps when swap interval is set to 1.
Environment
- Mesa: 21.3.4
- Linux Kernel: 5.15.4
- Using RPi fake KMS driver