Show every VR frame in order at 120 fps: wait for SteamVR's GPU work, present only finished copies, skip the grace on idle shared counters

This commit is contained in:
maxjivi05 committed 2026-10-13 12:21:05 -04:00
1 parent 6e1c8e06cf
commit e8e3e6ba12
5 files changed
+292 -22

No files matched your search

+10 -3
View File
@@ -104,7 +104,9 @@ switches the picture to side-by-side and runs SteamVR with three DroidDeck piece
compositor signals only after the client has submitted and said so, which deadlocked every app
before its first frame (`helloxr`'s swapchain acquire, DXVK's submit thread in a Proton game).
A submit's wait on an imported shared value that is neither reached nor queued in that process
gets 3 ms for the other process to reach it, then is dropped;
gets 3 ms for the other process to reach it, then is dropped. On a counter that has not moved for
100 ms it is dropped at once: Angry Birds VR waits on two such values a frame, and the grace cost
its submit thread 6 ms a frame and held it at 60 fps;
- Steam's web helper has the semaphore bridge whenever SteamVR is installed: its GPU process
outlives SteamVR runs, and one started without the layer crashed when SteamVR showed Steam's
overlays, until Steam quit;
@@ -148,8 +150,13 @@ a pose written to the shared file turns SteamVR's view. Started from the drawer
A presses show up in the ring the driver reads.
- **Layers**: only the first layer of each frame is drawn. SteamVR's compositor composites the
dashboard into it, so this has not mattered yet.
- **Timing**: no reprojection, and the presenter blits whatever was submitted last, a guard delay
after it arrived. The chain is SteamVR → presenter → DroidDeck compositor → lens pass.
- **Timing**: no reprojection. The presenter blits the frame submitted last once `vrcompositor`'s GPU
work for it is done: the layer fences that process's submits and counts issued and finished ones in
`present-sync` beside the `active` marker, and the presenter sleeps on the count (a futex). Without
the file it falls back to a guard delay after the frame arrived (`DROIDDECK_VR_PRESENT_GUARD_MS`,
4 ms). It hands its own picture to Wayland only once its blit is done, because KGSL does not order
the DroidDeck compositor's copy after it. The chain is SteamVR → presenter → DroidDeck compositor →
lens pass.
- **Cross-process GPU sync** is a poll away from exact (see the semaphore note above); binary
semaphores are not bridged.
- **Apps and games**: Windows VR games run through Proton ARM64 (FEX for the x86-64 game, DXVK, and
+19 -6
View File
@@ -44,12 +44,15 @@ OpenVR to SteamVR's ARM64 `vrclient.so`, so no x86 SteamVR is involved.
- `helloxr` blocked in a wait-idle in `vrclient.so`;
- DXVK's `dxvk-queue` thread blocked in Proton games.
The layer now gives a submit's wait on an imported shared value 3 ms, then drops it. It is kept
when the value is already reached, or when this process has queued the signal itself. Two details
mattered:
The layer now gives a submit's wait on an imported shared value 3 ms, then drops it, at once when
the shared counter has not moved for 100 ms. It is kept when the value is already reached, or when
this process has queued the signal itself. Three details mattered:
- the waits are judged before the submit's own signals count, because an acquire waits on one
value and signals the next on the same semaphore;
- SteamVR's client interop device is Vulkan 1.0, so only the `KHR` entry points resolve there.
- SteamVR's client interop device is Vulkan 1.0, so only the `KHR` entry points resolve there;
- a Proton game waits on two values a frame that are never signalled (5,500 dropped, none reached
within 200 ms afterwards). With the grace on each, Angry Birds VR's submit thread lost 6 ms a
frame and the game ran at 60 fps; without it, 120.
4. **UBWC layouts must agree.** An imported image has to be created with the same
`VkImageFormatListCreateInfo` (sRGB + UNORM) as its creator, or Turnip lays out the compression
differently and the reader sees garbage. The presenter's eye-texture import does this.
@@ -83,6 +86,15 @@ OpenVR to SteamVR's ARM64 `vrclient.so`, so no x86 SteamVR is involved.
- **Memory.** Steam, SteamVR and one VR game fit in the Thor's 12 GB. A large game such as The Lab, or
two games at once, push the device into critical pressure, and the low-memory killer takes
DroidDeck itself (`ended-without-teardown.txt` in the session logs, `lowmemorykiller` in logcat).
- **Frames shown out of order.** Video from the glasses jumped back a few frames in bursts while the
head turned. Two causes, each found by stamping a frame counter into the presenter's output:
- the presenter copied SteamVR's eye texture a fixed 4 ms after `Present`, with no fence. Under
GPU load `vrcompositor` had not drawn it yet, so the copy got that texture's previous frame. The
layer now fences `vrcompositor`'s submits and the presenter waits for the frame's count;
- DroidDeck's compositor copies a Wayland client's dma-buf without waiting for its implicit fence,
and KGSL does not order the copy after the client's GPU work. The presenter's blit sat behind the
game's frame, so the compositor showed the swapchain image's older picture. The presenter now
waits for its blit before it presents.
- **Head-tracking axes.** With the display at `ROTATION_90`, screen x is minus device y and screen y is
device x. Getting this wrong made a turn at the hips tilt the view. Recentring now keeps the world
vertical and resets the heading only.
@@ -123,8 +135,9 @@ OpenVR to SteamVR's ARM64 `vrclient.so`, so no x86 SteamVR is involved.
- **SteamVR Home** needs `IVROverlayView_002` in Proton's `vrclient`, or an ARM64 build of Home.
- **The Lab and other large games** need memory headroom. Candidates: stop Steam's own web helpers
while a VR game runs, or lower SteamVR's footprint.
- **Wait drops are a heuristic.** A 3 ms grace keeps the common case in sync. A submit thread in the
layer, deferring submits until their waits are reachable, would be exact.
- **Wait drops are a heuristic.** A 3 ms grace keeps the common case in sync, and an idle counter
skips it. A submit thread in the layer, deferring submits until their waits are reachable, would be
exact.
- **Layers:** only the first layer of each frame is presented. No reprojection.
- **Controllers** are a gaze pointer driven by the pad. Pad presses did not close the SteamVR menu in
testing. Untested: whether that came from gamescope focus being on Steam, or from the system button