Skip to content

8K videos start again on SteamOS 0.5.10's new video driver - #87

Merged
seaweeduk merged 1 commit into
masterfrom
fix/iris-capture-pool
Nov 19, 2026
Merged

seaweeduk merged 1 commit into
masterfrom
fix/iris-capture-pool

Conversation

@seaweeduk

@seaweeduk seaweeduk commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

SteamOS 0.5.10 replaces the Frame's video decoder driver with the upstream Iris driver. On it, 8K HEVC Main 10 videos didn't start, and 8K H.264 could be refused at start. This makes the Frame's FFmpeg and mpv start streams the way that driver expects, while older SteamOS keeps the current path.

  • Detection by capability. Both drivers call themselves iris_driver. The upstream one reports V4L2_CID_MIN_BUFFERS_FOR_CAPTURE and the vendor one doesn't, so that control tells them apart. Every change below is behind that check (iris_reports_minimum), never the OS version.
  • Provisional input size. The driver sizes its working memory from the input format set before the stream's headers are parsed, then allocates the real size's at capture start before freeing the first. An 8K input format left no address space for 8K Main 10. Streams larger than 4096×2560 now start from a 4096×2560 input format, as the stateful decoder interface intends; the real size comes with the source change.
  • Capture buffers made after STREAMON. At capture STREAMON the driver allocates its own reference frames and the stream's working memory, the new set before it frees the old, all in one 2.9 GiB address range where each 8K Q10C buffer takes a 128 MiB-aligned slot. A pool allocated before that left 8K Main 10 streams with a minimum of 8 no room, even with only 8 buffers. FFmpeg now reads the minimum (V4L2_CID_MIN_BUFFERS_FOR_CAPTURE), creates one buffer, starts streaming, then adds buffers with VIDIOC_CREATE_BUFS (REQBUFS would raise the count to the minimum). It stops once memory runs out, provided it has reached the minimum. It retries briefly while the old working memory is still being freed.
  • Pool sized from the driver's minimum when refused. This driver keeps reference frames in buffers of its own, so the capture pool only holds frames waiting for display. When capture start fails with ENOMEM, FFmpeg flags it (capture_start_refused) and mpv reopens the decoder with the driver's minimum plus one. A session that already had that pool doesn't retry. mpv remembers the smallest refused picture area per codec and bit depth (an atomic minimum), so later files and seeks that size start with that pool at once.
  • Staged start kept for the vendor driver only. The upstream driver rejects input format changes once buffers exist, so it never takes that path.
sequenceDiagram
    participant D as FFmpeg v4l2m2m
    participant K as Iris (upstream)
    D->>K: S_FMT input 4096x2560 (stream is 8192x4096)
    D->>K: REQBUFS / STREAMON input
    K-->>D: SOURCE_CHANGE 8192x4096, minimum N
    D->>K: CREATE_BUFS 1 capture, STREAMON capture
    alt STREAMON ENOMEM
        K-->>D: refused
        D->>D: capture_start_refused = 1
        Note over D: mpv reopens with N + 1, remembers the size
    else started
        Note over K: reference frames and working memory allocated
        loop until N + spare, or ENOMEM once N exist
            D->>K: CREATE_BUFS 1, QBUF
        end
    end
Loading

8K HEVC Main 10, 8192×4096 at 59.94 fps, on SteamOS 0.5.10:

master This PR
Starts (capture minimum of 7 or 8) No (capture start refused) Yes
Frame rate — 60 fps, no dropped frames
First frame after a seek — 67–175 ms

Not changed, on purpose:

  • The refused size is remembered when the pool is refused, not after the smaller pool decodes. References live in the driver's own buffers, so the smallest pool costs nothing measurable: 8K Main 10 plays at 60 fps with it. A refusal under memory pressure would also refuse a larger stream.
  • A second failure during the retry replays only what the retry path already saves. That is the existing allocation-retry path. If the smallest pool also fails, the file fails for good and its packets don't matter.
  • A same-size source change that raises the driver's minimum mid-stream. The video files this player opens carry one sequence.
  • A refusal at the smallest pool still gets the one-shot retry. That retry is for a refusal that clears by itself, such as just after a seek.

Important

AI disclosure

Model Variant Role
anthropic/claude-opus-5-5 high Investigation, implementation
openai/gpt-6.2-sol high Driver analysis
openai/gpt-6.2-astra high Independent review

Agent harness OpenCode 2.3.2

@seaweeduk seaweeduk added the fix Bug fix (release notes: Fixes) label Nov 19, 2026
@opencode-agent

Copy link
Copy Markdown
  1. Medium — Recheck the capture minimum on same-resolution source changes. In v4l2_context.c:1443–1463, the minimum is read only when creating a pool. A new H.264 or HEVC sequence can change the required buffer count without changing the picture dimensions; the V4L2 decoder contract explicitly identifies this as a source change. For example, if late allocation stops at seven buffers and the next sequence requires eight, do_source_change() sees unchanged dimensions, keeps all seven, and restarts capture below the new minimum. On upstream Iris, re-read the minimum before reusing an existing pool and take the existing reallocation path if num_buffers is too small.

  2. Low — A refused session already using the smallest pool still retries. In mpv-v4l2-reset.patch:249–257, opening another file at a remembered size sets v4l2_smallest_pool, but retried_v4l2_allocation starts false. If capture is refused, smaller is false yet the || still schedules a full decoder reopen and packet replay. For Main 10, that repeats both the same pool request and the same Q10C format, delaying fallback without reducing the allocation. For a flagged pool refusal, retry only if the session requested more than one spare; use the existing one-shot retry condition for other ENOMEM failures.

github run

@seaweeduk
seaweeduk merged commit 724b8f1 into master Nov 19, 2026
5 checks passed
@seaweeduk
seaweeduk deleted the fix/iris-capture-pool branch November 19, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix (release notes: Fixes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant