-
-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lag when pressing keys in Vulkan application. #1232
Comments
what present mode do you use in your vulkan application? |
It's |
does changing it to the |
Yes, it does! Interesting. However, now I'm producing frames every ~3 to ~4ms. So my framerate is effectively around 250 FPS. The vsync mechanism seems to be not functioning with that mode. |
indeed, because the i'm afraid that your original issue may be related to the well-known long-standing nvidia's driver issue with the |
I can replicate the findings from the linked forum on my machine as well, but the fact that my problem is keystroke related, happens 100% of the time, and after all my testing, only occurs with picom, I'm not so sure that there is not something going on with picom. I figured out that this problem is happening when I press keys when other windows are focused. Not all, but some. For example pressing no-effect keys when Tracy is focused, also causes the frame time to jump up to 50ms in my app. A second instance of my app is also good to trigger the effect: run my app twice, press keys in any instance, and observe slowdowns in both. When testing the complaints in the forum you linked, I also found out that upon every window focus switch in i3 (by means of moving the mouse from one to the other for example), causes a similar high frame time. The key presses causing this sounds so ridiculous to me. I can't think of anything that could be related to key presses. |
I might try to use Nouveau drivers tomorrow to see if that changes anything. |
I also see this issue, though profiling shows that the vkQueuePresentHKR call will take 0.05 seconds - so you can easily see the dropped frames. Strangely it's not just a key press/release event that is correlated to the stutter, but if you press and hold then key repeat events also cause it. My setup slightly different: Debian 12, Regolith/i3, NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2, Driver 535.161.08. Switching my compositor from picom to xcompmgr and the problem disappears entirely. |
Platform
Ubuntu 22.04.3 LTS / 6.5.0-26-generic
GPU, drivers, and screen setup
NVIDIA RTX 3080Ti with Driver 535.154.05 CUDA Version: 12.2
Two monitors side-by-side, left one rotated 90 degrees (xrandr).
Environment
i3
picom version
vgit-d8c34
Diagnostics
Version: vgit-d8c34
Extensions:
Misc:
(Another compositor is already running)
Drivers (inaccurate):
NVIDIA
Backend: glx
Backend: egl
Configuration:
Configuration file
Steps of reproduction
Unfortunately, reproducing it is not easy. I'm using bgfx in my application with the Vulkan backend, and I have Tracy hooked up profiling everything. Whenever I press a key (even one that has absolutely no effect), I get a very slow
vkQueuePresentHKR
call. This causes the frame time to be around 28ms and the next frame then catches up and gets completed in ~5ms, causing the result to be fine. I don't believe any frames are dropped. I do notice the huge slowdown in my application which of course is not great for timing and predictable handling of user input. This also effectively reduces my frame time budget to 5ms instead of 16ms. If I don't hit the 5ms deadline when pressing a key, I'll drop a frame.In the above image, the problem happens in the frame in the middle of the picture.
I have no clue what this has to do with Picom, but if I exit Picom, the problem disappears:
I'm pressing keys several times here in this screenshot, and no delay is observed. (The spurious long frames is simply because my application doesn't render continuously, but only upon animations. The screenshots are taken in regions of animation where I press keys.)
Note that this does not occur with mouse events.
In summary, this only happens with the combination of: picom + vulkan app with
PRESENT_MODE_FIFO_KRH
+ keypresses.The issue disappears in all of the following situations:
PRESENT_MODE_IMMEDIATE_KRH
, orThe text was updated successfully, but these errors were encountered: