diff --git a/docs/technical-notes.md b/docs/technical-notes.md index 73a9207..17cc736 100644 --- a/docs/technical-notes.md +++ b/docs/technical-notes.md @@ -85,6 +85,15 @@ the shortcut through the Steam client's DevTools port (`127.0.0.1:8080`, page `SharedJSContext`) with `SteamClient.Apps.AddShortcut`, so Steam doesn't need restarting. (`steam steam://addnonsteamgame/` adds nothing.) +Steam preloads its in-game overlay, `gameoverlayrenderer.so`, into everything +it launches through `LD_PRELOAD`. In Chromium it segfaults the zygote during +library initialisation. The GPU process then fails to launch +(`GPU process launch failed: error_code=1002`), and after a few tries +Chromium quits with `GPU process isn't usable. Goodbye.` about 30 seconds +after starting. The `chromium-xr` launcher removes the overlay from +`LD_PRELOAD` before starting Chromium, keeping anything else that was +preloaded. + ## Debugging - `chromium-xr --remote-debugging-port=9223 URL` opens DevTools on the Frame's diff --git a/frame/chromium-xr b/frame/chromium-xr index 7cac010..53ea623 100755 --- a/frame/chromium-xr +++ b/frame/chromium-xr @@ -7,6 +7,27 @@ set -euo pipefail CHROME="${CHROMIUM_XR_HOME:-$HOME/chromium-xr}/chrome" [[ -x "$CHROME" ]] || { echo "chromium-xr: no build at $CHROME (run frame/install.sh)" >&2; exit 1; } +# Steam preloads its in-game overlay (gameoverlayrenderer.so) into anything it +# launches. It segfaults in Chromium's zygote, the GPU process then can't +# start, and Chromium quits with "GPU process isn't usable". Drop it and keep +# anything else that was preloaded. +if [[ -n "${LD_PRELOAD:-}" ]]; then + keep=() + # Split on spaces and colons only, like ld.so, with no glob expansion. + # read -d '' takes the whole value, newlines included (it returns 1 at EOF). + IFS=' :' read -r -d '' -a libs < <(printf '%s' "$LD_PRELOAD") || true + for lib in ${libs[@]+"${libs[@]}"}; do + [[ -z "$lib" || "$lib" == *gameoverlayrenderer.so ]] || keep+=("$lib") + done + if (( ${#keep[@]} )); then + LD_PRELOAD=${keep[0]} + for lib in "${keep[@]:1}"; do LD_PRELOAD+=":$lib"; done + export LD_PRELOAD + else + unset LD_PRELOAD + fi +fi + # --enable-features=OpenXR: the Linux OpenXR device is off by default. # --ozone-platform=x11: gamescope's X display, where each app is a panel. # --no-first-run and --password-store=basic: otherwise startup can stop at a