Linux + Nvidia + Vulkan + X11: Judder / lag spikes with PresentMode::Fifo #6251
Labels
api: vulkan
Issues with Vulkan
platform: x11
Issues with integration with linux/x11
type: bug
Something isn't working
Description
I'm running Linux with X11 on an Nvidia GPU, and the demos have periodic "hitches" in the frame pacing that seem to be a result of
PresentMode::Fifo
. Once every second or so (the timing is not perfectly consistent), a frame takes a long time to render (around 100ms) and previously submitted work all completes at once. New frames are then rendered rapidly until the queue is full again. Here's an example from the bunnymark demo, where I've modified the framework to give each frame a number and track pacing:Adding a
context.device.poll(Maintain::wait());
after each frame to limit the length of the queue to 1 frame seems to help but does not eliminate the stutter, instead only reducing it to 1 frame as well:Setting
desired_maximum_frame_latency
to 1 in combination withcontext.device.poll(Maintain::wait());
does seem to completely eliminate the judder.Repro steps
Here are the changes I made to the framework to report frame/present pacing
Expected vs observed behavior
Frame pacing should be smooth. In general, frame pacing should get smoother as the amount of buffering increases, whereas the opposite seems to be true here.
Extra materials
Not sure if this is a driver bug or a consequence of
PresentMode
not actually controlling frame pacing. This Reddit post describes a very similar issue but seems to indicate it's specific to Nvidia on Linux.The
vkcube
demo seems to work properly with no frame pacing issues on my machine, which seems to indicate that there's at least some way to fix this on the API consumer's side. See this commit to vkcube which uses fences to limit outstanding presentations, and this commit which changes the throttling logic and states "It is currently impossible to reliably throttle presentation per the Vulkan spec."Platform
Fedora 40, latest wgpu trunk (
9b36a3e
), Nvidia driver 560.35.03 on X11The text was updated successfully, but these errors were encountered: