0008: Direct HDMI output through a local Wolf consumer
- Status: Superseded by 0009/0013 (owner, 2026-11-14): Gamescope drives the TV with no Wolf session in between, and direct mode left the stack instead of staying a fallback (0012 covers remote devices).
- Date: 2026-11-13
Context
The TV shows Wolf's stream through Moonlight on the same machine: Wolf encodes every frame, the TV client decodes it and draws it to HDMI. That costs two GPU passes, adds latency, and rules out HDR on GPUs that cannot encode 10-bit (the host's GPU encodes HEVC Main only, checked with vainfo). Options: (a) a kmssink consumer inside Wolf, started through Wolf's API; (b) a DRM output inside gst-wayland-display (Rust/Smithay, no such code upstream); (c) tune encode/decode; (d) a Wolf consumer that hands DMA-BUFs over a socket (unixfdsink) to our TV container, which draws them with kmssink and plays audio with alsasink.
Decision
(d). The TV container asks Wolf's API for a session of its own (sessions/add, then sessions/start with our pipelines, which Wolf accepts), joins the lobby the shell starts, and reads frames and audio from two sockets. Pad input goes to Wolf through sessions/input, the same packets Moonlight sends, so apps see the same virtual pad. Checked on the host's pinned Wolf: kmssink, unixfdsink, unixfdsrc, vapostproc exist and the API has sessions/add, sessions/start (with gst_pipeline) and sessions/input. No Wolf or gst-wayland-display code change is needed. (c) stays for remote clients.
Consequences
- DRM master, ALSA, the input bridge and restart logic stay in the container we own (ADR 0006); Wolf only gains one consumer pipeline. A Wolf crash does not take the display with it.
- The Moonlight client in the TV container goes away once the new path works; Moonlight stays the fallback (one
.envline). unixfdsinkonly sends fd-backed memory, and interpipe passes Wolf's own buffers, so the consumer makes one copy. Measured on the host (1080p60, no zero copy there, frames in RGBx):videoconvertto BGRx kept 60 fps with no measurable extra CPU; to NV12 it cost about half a core. With zero copy (DMA-BUF frames), gst-wayland-display renders every frame into one buffer, which a display sink would likely tear on; upstream draft:docs/upstream-drafts/gst-wayland-display-buffer-ring.md.- Proven on the host with a test session (TV untouched):
sessions/add,sessions/startwith our pipelines, two UDP pings, frames received in another process,sessions/stopremoves it. - Built as
TV_MODE=directin the TV container (Moonlight stays the default). The session is opened forTV_APPdirectly, withTV_CLIENT_IDso Wolf UI keeps the TV's data; joining the shell's lobby happens inside Wolf UI, as today. - The pad bridge reads pads with SDL (as Moonlight did) and announces every pad as an Xbox pad, because the emulator mappings are made for Wolf's virtual Xbox pad. Rumble is not passed back. Audio is PCM only: apps write to PulseAudio, so no bitstream passthrough.
- HDR needs Wolf's open HDR work (P010 producer caps) and is later.