Skip to content

0035: Gamescope rebuilt with our own patches

Status: Accepted (owner, 2026-11-24). Proposed (2026-11-20, after a device's Gamescope crashed when a capture left)

Context

ADR 0011 prefers parts consumed unmodified. Gamescope 3.16.29 (Fedora 45's package) crashes now and then when a PipeWire consumer leaves or renegotiates: gamescope-xwm segfaults at b0 in libvulkan_radeon.so, the screen's Xwayland, input and overlay sockets go with it, and the device sees a dead screen. Core dumps showed paint_pipewire painting into a destroyed capture texture. Cause: dequeue_pipewire_buffer takes a buffer on the compositor thread without PipeWire's loop lock, while the PipeWire thread frees every buffer that is not marked as copying. A capture stress test on a throwaway screen reproduced it on the stock package. Every device stream and every join churns captures, so we hit it in normal use.

Decision

The screen image builds Gamescope from Fedora's own 3.16.29-1.fc45 source package plus our patches, three today (the other two are under Consequences). The first (stack/images/screen/gamescope/pipewire-dequeue-lock.patch: hold the loop lock around the dequeue and around dispatch_nudge). The RPM release becomes .fc45.couchdogs1. The patch goes upstream as a draft (docs/upstream-drafts/gamescope-pipewire-dequeue-race.md) once the owner OKs it.

Not chosen: a newer Gamescope (the version is the behaviour we tested on the TV), restarting crashed screens (the device still loses its app and stream).

Consequences

The screen image build compiles Gamescope once (cached afterwards). A Gamescope version bump means re-checking the patch; drop it once upstream has the fix.

ADR 0036 adds a second patch (capture-without-overlay.patch, release .fc45.couchdogs2).

A third patch (pipewire-still-screen.patch, release .fc45.couchdogs3, 2026-11-21): unpatched, a reader that connects to a still screen got no frame until something on it changed (on a still window the first reader got a frame in 0.7 s, later readers none after 10 minutes), so a TV joining an idle device waited 4 to 10 s for a picture. Gamescope now pushes a frame when the stream (re)starts or renegotiates, and at least once a second.