Present timing - #5869
Conversation
3af9ff2 to
406a275
Compare
|
I'm using KWin with the latest version of the commit timing PR merged into it while I test this present timing PR in a few of games. Here's some logs from when I tried to run a D3D9 game with the latest Proton-GE. |
|
The validation error about invalid time domain IDs should already be fixed, I updated the branch a while ago to fix an issue with that on Nvidia. As for why the |
|
Unlike that D3D9 game, this D3D11 game does not freeze. Judging by the D3D11 game logs, present timing is working in that game. Let me know if I'm wrong. For both games, I used the files from the artifact found here: https://github.com/doitsujin/dxvk/actions/runs/33633088810 Here's the logs of the D3D11 game: |
|
To be clear, does D3D9 still freeze even with current code? Makes me wonder if there's any 32-bit shenanigans going on, I've only tested 64-bit games so far (including a D3D9 one though). |
|
Yes, multiple D3D9 games still freeze with current code. I might test other 32 and 64-bit games. |
|
To be clear, when I said "current code", I meant the DXVK artifact I downloaded from here: https://github.com/doitsujin/dxvk/actions/runs/33633088810 Let me know if that wasn't current code. |
|
That is the current iteration of the branch, yeah. Anyway, guess I'll have to look into that, if it really is 32-bit stuff that's broken then that would be rather unfortunate. |
|
Yeah, it's broken due to winevulkan unfortunately. Just looked at the code and the 32-bit struct conversion leaves a few things undefined that cause the driver to do weird things, including segfaults and the Doesn't look like an easy fix either, pain. |
2a6380f to
73d623c
Compare
|
32-bit woes should be fixed as of https://gitlab.winehq.org/wine/wine/-/merge_requests/11862. There's no great way to detect a "good" wine build at runtime, so on wine builds without that patch it'll just crash or otherwise misbehave. That problem should solve itself over time. |
|
Thanks for that good news and the work you've done. The 32/64-bit games I tested all work now with that Wine PR merged into this Proton build, which has your latest present timing DXVK changes in it: Repeating Frame Time SpikesI discovered this bug that happens in every 32/64-bit game I tested, even without that Proton build linked above. As far as I've seen, the repeating frame time spikes happen only with your latest present timing DXVK files, regardless of whether I use the linked Proton build or proton-cachyos-slr. With Another important thing to know is that I don't see the game stuttering/jittering/freezing when I move my mouse in the games I tested. The only reason I know about this bug is the fact that those frame time spikes appear in DXVK HUD and MangoHud; see the screenshots of the frame time graphs for context.
|
|
Doesn't really sound actionable unless i find a way to reproduce that manually. Neither the HUD nor Mangohud show what's actually happening at a compositor level, but 13ms is multiple frames, that shouldn't happen. Are you benchmarking this with validation layers enabled? If so then you really want to turn those off, they're not exactly free. We're periodically re-calibrating timestamps because apparently some AMD hardware has bugged clocks, could be that too, but yeah would need a way to actually repro this. So far I haven't seen it even on my Nvidia card. (also, for the record, |
Yes, I think I did have those enabled. These are some of the env vars in my games' launch options.
I'll change the above options to this, most likely. I might do some tests with these.
EDIT: I'm using a Ryzen 7 5800X and NVIDIA GeForce RTX 3070. I don't know if either of those is the cause of the bug. It could be the KWin build I'm using, which, on my device with KDE Plasma 6.7.4, can be built and installed for CachyOS (and probably for other distros based on Arch Linux, too) with these commands. Your (anyone reading this) results may vary; be prepared for any possible crashes or data loss (BTRFS snapshots can be helpful here). |
|
Something's still limiting my FPS to about 140 while I'm at the main menu, and I am not using the in-game FPS limiter. I doubt it's the EDIT: And the bug was still happening just before I wrote this post. |
|
Well, all I can say right now is that I can't reproduce it, far too many variables at play here (Proton builds, compositors, games, etc). |
|
Well, disabling the limiter also disables present timing. |
|
Maybe try reverting 73d623c in your build. We can't detect VRR currently (wayland protocol issue), but if that commit is the problem somehow then something must be really wrong with clock sources on your setup. |
This log shows present timing still working without your FPS limiter, and there's still no bug anymore. I might be reading the log wrong, though. I'm at about 144 FPS in game now, which is my max monitor refresh rate. VRR is enabled. I did not revert the commit yet; this is the same Proton and DXVK versions as the last few tests. |
|
Well it doesn't really do anything useful if you're running at the maximum possible refresh rate anyway. The fact that it's not disabled in this scenario is a bug, and the only thing it's going to do is cause problems. Guess it's because of this: Need to come up with something here I guess. We literally cannot know the refresh rate or whether VRR is annoying, even though the VUlkan extension is supposed to give us that info and we kind of need it to make useful decisions. |
Does this mean VSync and the DXVK frame rate limiter must both be enabled at the same time? I'm asking because I'm confused by the "or" at the end of the first bulleted line. |
|
Vsync is always required, yes. The first bullet point is about us emulating non-native refresh rates. We can't modeset on wayland, so we have to use our own FPS limiter to actually ensure that games requesting 60 Hz modes run at 60 Hz or all hell breaks loose, and now present timing basically does that. |
|
I don't want to add more heuristics here either. The FPS limiter already only kicks in if we're actually running faster than the requested frame rate for a brief period of time, but that's not really viable here because we really want present timing active for games that have a built-in FPS limtier but don't change the display mode. This entire situation sucks, sigh. Gonna ignore this for now, but if setups continue to a) not report refresh rate and b) not report VRR enablement, we'll potentially be wasting a lot of power on busy-waiting to pace the app thread when timing is enabled. Which means we can't enable it by default because it's just going to drain e.g. Steam Deck battery for literally no reason. |
cc3520a to
526a735
Compare
|
I'll wait until KDE 6.8 Beta 1 releases in the See the beta release dates in the link below. |
Like I said earlier, it doesn't do anything useful if the timing interval matches your refresh rate so we won't enable it in that case if we actually know the refresh rate. The other games also mostly disable it as soon as the refresh rate is known, as can be seen in the log. Splinter Cell is a case where it's working as intended though: |
|
Now I understand. So all the games I have installed, with the exception of Splinter Cell 1 and 2, don't need this MR, since the refresh rates match in the output log. Thank you for the explanation! EDIT: I thought this PR was intended to "fix" vsync on linux, especially on wayland. I followed the discussions on the wayland protocols |
|
Quick update: Kwin has merged the commit timing protocol! |
|
Cool, sounds like 6.8 will include it? Guess the biggest issue now is that XWayland doesn't really support a useful feature set. On Mesa it can handle the SyncInterval > 1 case (i.e. running at half refresh), but not e.g. 60 FPS on 144 Hz display because it lacks absolute timing support and doesn't report VRR either. |
I think yes indeed because the branchpoint for Plasma 6.8 is Thu 2026-09-10. |
We want to preserve some frames for present_timing purposes.
Should give us much more consistent pacing in non-VRR environments.
32bd33d to
a75c6c5
Compare
|
Turns out there was a bug with relative timing, the Windows/XWL use cases that this covers should work more consistently now. |
|
Is it normal for the input latency to increase when present timing is active in D3D9 and D3D11 games? It feels that way, but I don't have a way to prove it with measurements. I don't have NVIDIA LDAT or similar hardware to measure the latency I'm sensing in games. I can't measure latency with pyrofling, either, because If I load pyrofling's latency measurement layer, which uses present timing, then DXVK's present timing won't work, according to the DXVK logs. When I disable present timing in dxvk.conf, the latency in game feels lower than before I disabled it.
|
|
tldr yes, normal. There is no universe where you can get both consistent timing and lowest possible input latency without the game supporting Reflex and friends. Edit: You can generally mitigate this somewhat by setting |




Rebased the work that I already did quite a while ago and (somewhat reluctantly) installed Gnome for testing. Turns out it basically works fine there, both with and without VRR.
TL;DR is that this kicks in if
Not gonna land this any time soon, this needs a lot more testing on a large number of environments, and I'd definitely want to wait until KWin has some sort of usable commit-timing support upstream. Also currently only works with something like proton-ge +
PROTON_ENABLE_WAYLAND=1for now. X11 is completely untested and XWayland doesn't support this.XWayland only supports relative mode on Mesa and doesn't report VRR, so we'd only use it for the SyncInterval > 1 case there, but hey, it works.
Definitely gonna have to add a config for this as well so peolpe can at least disable it in case of issues.