forked from unom/punktfunk
gamescope's built-in PipeWire node has always been SDR-only: it offers BGRx and NV12, and `paint_pipewire()` hardcodes a Gamma-2.2 composite with the SDR screenshot LUT set. So an HDR game reaches punktfunk already tone-mapped down, and the whole gamescope backend streams 8-bit no matter what the client can decode. Games CAN render HDR on a headless gamescope today — only the capture half is missing. Carry the two patches that close it (packaging/gamescope/patches): the node additionally offers `xRGB_210LE`/`xBGR_210LE` with MANDATORY SMPTE ST.2084 + BT.2020 props, mapped to the same 10-bit capture texture the HDR AVIF screenshot path already allocates, and `paint_pipewire()` composites into them with the HDR screenshot LUTs + `EOTF_PQ` — which is exactly the in-tree `bHDRScreenshot` branch. The new formats are listed LAST, so every existing consumer keeps negotiating the 8-bit stream bit-for-bit. Offered upstream against ValveSoftware/gamescope#2126. Ship it as `punktfunk-gamescope`, beside the distro's own binary rather than replacing it: a Bazzite sysext payload (`build-sysext.sh --gamescope`, which refuses a binary without the marker), an Arch package, a nix derivation + `services.punktfunk.host.gamescopeHdr`, and one distro-agnostic build script the rest call. The second patch stamps `+pfhdr1` into the `--version` banner. That is not cosmetic: punktfunk fixes a session's bit depth in the Welcome, before the display exists and with no way to take it back, so its capability answer has to be a static property of the binary it will spawn.
56 lines
3.4 KiB
Bash
56 lines
3.4 KiB
Bash
# punktfunk host config for Bazzite (~/.config/punktfunk/host.env).
|
|
#
|
|
# The compositor + input backend are AUTO-DETECTED per connect from the ACTIVE session: the host
|
|
# follows the box as you flip between Steam Gaming Mode (gamescope — a managed session at the
|
|
# CLIENT's resolution) and a KDE/GNOME Desktop (KWin/Mutter virtual output at the client's mode).
|
|
# So nothing here forces a backend, and no session anchors are needed: a `systemctl --user`
|
|
# service inherits the correct XDG_RUNTIME_DIR and the host derives the bus from it. (Keys are
|
|
# CASE-SENSITIVE — use the exact uppercase names.)
|
|
|
|
PUNKTFUNK_VIDEO_SOURCE=virtual
|
|
|
|
# GPU zero-copy capture (dmabuf -> CUDA -> NVENC) is ON by default and auto-falls back to CPU if
|
|
# unavailable. No need to set it. Set to 0 only to force the CPU path.
|
|
# PUNKTFUNK_ZEROCOPY=0
|
|
|
|
#RUST_LOG=info
|
|
|
|
# --- Optional overrides (default is active-session auto-detection) ---
|
|
# Force a specific backend for testing (skips auto-detect + env retargeting):
|
|
# PUNKTFUNK_COMPOSITOR=kwin|mutter|wlroots|gamescope
|
|
# PUNKTFUNK_INPUT_BACKEND=libei|wlr|gamescope|uinput
|
|
#
|
|
# GAME MODE = ATTACH (the box owns its session; the host follows). The box decides whether it's in
|
|
# Steam Gaming Mode or a Desktop — you switch with the normal Steam UI / "Switch to Desktop". The
|
|
# host just ATTACHES to whatever's live and captures it; it never tears the session down. So
|
|
# switching Desktop<->Game is rock-solid, and when you disconnect the box STAYS in its current
|
|
# mode — reconnecting drops you right back where you were. On a resolution mismatch the host
|
|
# restarts the box's own game-mode session at the CLIENT's resolution (a foreign/bare gamescope
|
|
# instead streams at its own mode).
|
|
PUNKTFUNK_GAMESCOPE_ATTACH=1
|
|
#
|
|
# Opt OUT to the MANAGED model instead (host tears the box's gamescope down on connect and launches
|
|
# its OWN at the CLIENT's exact resolution; restores on a debounced idle). Client-mode-following, but
|
|
# it does not coexist with a box-owned game-mode session — pick one:
|
|
# PUNKTFUNK_GAMESCOPE_MANAGED=1 # (and remove PUNKTFUNK_GAMESCOPE_ATTACH above)
|
|
#
|
|
# Follow a Gaming<->Desktop switch MID-STREAM (rebuild the backend in place, no reconnect). This is
|
|
# ON BY DEFAULT on Bazzite/SteamOS (the host detects the platform); set =0 to disable it:
|
|
# PUNKTFUNK_SESSION_WATCH=0
|
|
#
|
|
# HDR (10-bit BT.2020 PQ) on the gamescope path. Needs `punktfunk-gamescope` — gamescope plus the
|
|
# patch that teaches its capture node the 10-bit formats — which the sysext ships alongside the
|
|
# host; it does NOT replace the system gamescope. Off by default while the feature soaks; a host
|
|
# without the patched binary stays SDR either way. `punktfunk-host hdr-probe` says what it found.
|
|
# PUNKTFUNK_GAMESCOPE_HDR=1
|
|
#
|
|
# On an HDR session, how bright SDR content (desktop, Steam overlay, SDR games) is inside the PQ
|
|
# container. gamescope's default is 400 nits; raise it if whites look dim on your TV.
|
|
# PUNKTFUNK_GAMESCOPE_SDR_NITS=400
|
|
#
|
|
# HEADLESS GAME MODE: on a box with no display attached, Bazzite's "Switch to Game Mode" normally
|
|
# crashes (gamescope's DRM backend has no panel to drive). The host package ships
|
|
# /etc/gamescope-session-plus/sessions.d/steam, which auto-falls-back to gamescope's HEADLESS backend
|
|
# when no display is connected — so game mode boots offscreen and streams, with no config here. It's a
|
|
# no-op on display-attached boxes. (The host then auto-detects Gaming and streams it.)
|