Skip to content

[BUG] OpenXR: xrEndFrame blocks until vsync while xrWaitFrame returns immediately (Linux, Vulkan) #1071

Open

Description

@stevesloan

Describe the bug

On Linux, SteamVR's OpenXR runtime paces the application inside xrEndFrame
instead of xrWaitFrame:

  • xrWaitFrame returns almost immediately (median 0.05–0.3 ms), even when
    called early in the frame interval.
  • xrEndFrame blocks for 4–6 ms (median 4.6–4.8 ms) and returns about 0.2 ms
    after the next vsync.
  • The block does not track GPU load. The app's GPU work is about 1.3 ms per
    frame and GPU utilisation is 15–25%.

The spec places throttling in xrWaitFrame ("xrWaitFrame throttles the
application frame loop in order to synchronize application frame submissions
with the display") and says xrEndFrame "may return immediately".

Why it matters

An engine that calls xrEndFrame on its render thread loses that thread for
the length of the block. The next frame cannot start until just after vsync,
and the compositor starts its work about 7.5 ms after vsync, so the app has
about 7.3 ms to produce a frame rather than 11.1 ms at 90 Hz. In a scene that
fits the full interval comfortably, 8–10% of frames were reprojected; with
the block kept off the render thread, about 1%.

Related

This looks like the behaviour reported in 2020 on the SteamVR OpenXR forum,
"xrEndFrame() blocks instead of xrWaitFrame()", where a Valve developer
replied that it was fixed in 1.15.10:
https://steamcommunity.com/app/250820/discussions/8/3001046778348674981/

To Reproduce

  1. Run a Vulkan OpenXR application on SteamVR for Linux.
  2. Time each of xrWaitFrame, xrBeginFrame and xrEndFrame.
  3. xrWaitFrame returns at once; xrEndFrame holds the caller until vsync.

Cross-checked against IVRCompositor::GetFrameTimings, read from a
background OpenVR application.

Expected behavior

xrWaitFrame blocks to pace the application, and xrEndFrame returns
promptly.

System Information

  • SteamVR version: 2.19.3 (beta)
  • Distribution: Arch Linux, kernel 7.3.4-arch1-1, GNOME on Wayland
  • GPU: NVIDIA GeForce RTX 5070 Ti, driver 620.70.06
  • Headset: Valve Index, 90 Hz

Activity

  1. michaelkrauty commented on Nov 15, 2026

    @michaelkrauty

    I see the same on a Bigscreen Beyond 2e, but only for the first 1 to 55 s after an app starts. Then xrWaitFrame starts blocking:

    at first later
    time in xrWaitFrame 0.01 ms 5.3-5.4 ms
    time in xrEndFrame 9.0 ms 3.6-3.7 ms
    predicted display time minus xrWaitFrame return 19.0-19.2 ms 22.9 ms
    frame timing m_flWaitGetPosesCalledMs +0.8 to +1.0 ms -8.1 to -8.2 ms
    frame timing m_flCompositorRenderStartMs -2.8 to -2.9 ms -0.5 to -0.7 ms

    I started a small OpenXR/Vulkan test app 8 times for 2 minutes each, in two SteamVR sessions on the 2.19.3 beta. It does about 2 ms of CPU and 4.5 ms of GPU work per frame and logs when each call is made and when it returns. The table has the range of its per-start medians; the frame-timing rows are relative to vsync.

    • Each change came right after a late frame: one that was ready (m_flNewFrameReadyMs) 0.2 to 7.6 ms after the time the compositor usually starts (last row, left column). The compositor started as soon as that frame was in. Late frames that were ready before that, even by just 0.2 ms, changed nothing.
    • In seven of the eight starts that frame followed an xrEndFrame call that took 14-19 ms instead of 9.
    • After the change it didn't go back in the rest of any run (1 to 2 minutes). At most 5 single frames per run looked like the left column.
    • Every start began in the left column again, also the ones 2 to 7 minutes after the first in the same SteamVR session.
    • hello_xr (the OpenXR SDK sample) starts the same way in the frame timing, with its frames ready about 2 ms earlier. Two of four 40 s runs stayed that way to the end; the other two changed after 18 and 19 s.

    Setup: Beyond 2e at 90 Hz, RTX 4090, NVIDIA 620.70.06, Arch, Linux 7.3.4, KWin Wayland. The logs, the test app and the script that makes the table are in the zip.

    app-start-pacing.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions