Skip to content

egl/wayland: wait for frame callback after swap

Lucas Stach requested to merge lynxeye/mesa:egl-wayland-throttle-latency into main

By waiting for the frame callback to signal before attaching a new buffer, applications that use the blocking eglSwapBuffers blocking to pace their rendering always have their already flushed commands wait one display refresh period until they get sent to the compositor for presentation. While this gives a bit more margin for the GPU to process the commands, it's really bad for latency sensitive applications. It also goes against the spirit of the frame callback, which tells the application when is a good time to start rendering a new frame, not when is a good time to attach an already rendered frame.

This might have some performance implications for applications that are running quite close to the render timing margin, as it prevents the application from getting further ahead of the presentation. I believe the latency improvement outweighs the potential loss of performance, which is only an issue with applications that need almost a full refresh cycle of combined CPU and GPU time to prepare the next frame and at the same time run with a swap Interval >= 1.

Merge request reports