From 3b735d74d82e879aa7534677c565ece9fa556f78 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Wed, 18 Nov 2026 01:52:10 +0000 Subject: steamvr: even bug fixes have bugs The stutter fix was incomplete, waits were added for images which the renderers render and consume, but not for images coming from the application (e.g. eye textures). This hid some of the problem but you can still get stutter in intensive games that regularly miss their frame targets. Also, the headset can send spurious acks for frame 0 after a reconnect, despite not having received a frame, which can put the host into 3.3FPS mode. --- steamvr/patches.toml | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'steamvr/patches.toml') diff --git a/steamvr/patches.toml b/steamvr/patches.toml index 3061ede..d0f3698 100644 --- a/steamvr/patches.toml +++ b/steamvr/patches.toml @@ -39,21 +39,36 @@ edits = [ [0x436614, "00040000"], ] +[targets.compiled] +sources = ["vrcompositor/vulkan-wait.c", "vrcompositor/facet-wait.c"] + +[targets.compiled.imports] +pthread_mutex_lock = 0x157320 +pthread_mutex_unlock = 0x157710 +facet_wait_hook_end = 0x410277 +vulkan_wait_hook_end = 0x4313c2 +append_wait = 0x468180 + +# Add semaphore waits for things that may be eye textures (among other things, +# but it seems harmless). +# This avoids nasty stutters when the renderers sample eye textures before +# they're actually rendered by the GPU. This affects both renderers, which one +# is chosen when isn't totally clear to me. + +[[targets.compiled.hooks]] +address = 0x4313bb +length = 7 +target = "vulkan_wait_hook" + +[[targets.compiled.hooks]] +address = 0x410270 +length = 7 +target = "facet_wait_hook" + [[targets]] path = "drivers/vrlink/bin/linux64/driver_vrlink.so" sha256 = "b78a5a6bbfcb0cd80cd44f4b88ed97f5a93110ad62ebaaffff20768d0a7a9135" edits = [ - # Keep increasing (mod(2^16)) the ACK cutoff instead of clearing it (#965). - # If the headset's ACKs start to fall behind, the driver throttles new - # frame generation to once every 0.3s. Normally the driver stores the last - # ACK number regardless of whether it is newer or older than the currently - # stored one. This ACK number is used to determine if the headset has - # fallen behind. When a reset occurs, throttling should stop to allow the - # new frame (which does not depend on any prior frames) to be sent out - # immediately. But clearing the ACK cutoff means that the next frame - # immediately following that one can get throttled if the host is still - # receiving old ACKs. - [0xd7a6d, "89838401000090909090"], # Ignore stale tracking IDs and repeated older tracking attempts [0x116581, "89d02b47084189c6c1e004"], [0x11658c, "0f8853050000"], @@ -71,3 +86,18 @@ edits = [ [0x115524, "e83886ffff"], ] +# Don't clear the ACK cutoff. Also ignore ACKs which are beyond the latest +# frame ID. This is mainly to avoid the case where the headset erroneously +# sends an ack for frame ID 0 after a reconnect before it has anything to +# acknowledge. +# The current headset patch fixes this, but people aren't as eager to patch the +# headset as it's a bit more complicated, and it's not hard to add a workaround +# here. It improves robustness regardless. +[targets.compiled] +sources = ["driver_vrlink/ack-window.c"] +imports = { resume_ack = 0xd8a77 } + +[[targets.compiled.hooks]] +address = 0xd8a58 +length = 6 +target = "accept_ack" -- cgit v1.3.1