SteamVR-for-Linux icon indicating copy to clipboard operation
SteamVR-for-Linux copied to clipboard

[BUG] No SteamVR UI on wlroots-based wayland compositors (sway, hyprland, ...) with workaround

Open Danielduel opened this issue 8 months ago • 0 comments

(latest everything, beta steam, beta steamvr, arch, amdgpu, liquorix kernel, but in my opinion it doesn't matter in this case, I use hyprland)

Error from Steam trying to launch SteamVR (output in terminal, not a popup):

This application failed to start because it could not find or load the Qt platform plugin "wayland".

Available platform plugins are: xcb.

Note - only the UI part of SteamVR crashes (desktop UI and vr UI (dashboard?)), if I did few restarts like I was doing on KDE plasma (wayland) - core functionality of steamvr works in the background.

Workaround

Adding QT_QPA_PLATFORM=xcb to SteamVR launch flags fixes the issue. So, those are my current flags: RADV_DEBUG=zerovram QT_QPA_PLATFORM=xcb %command%

Change request

(I lack fundamental understanding on how qt works, but I will go for few assumptions...) I understand the error message as SteamVR UI supports xcb backend and in result it uses xwayland's xcb on platforms like kde's wayland. Wlroots-based compositors tend to default that QT_QPA_PLATFORM env to wayland, so I think it will be beneficial to do the workaround on SteamVR launch script level.

To vrstartup.sh I've added following lines:

if [ "$QT_QPA_PLATFORM" = "wayland" ]; then
	log "WARNING: QT5 wayland plugin is not supported, defaulting to xcb"
	export QT_QPA_PLATFORM="xcb"
fi;

Can we go this way until SteamVR will support a wayland directly?

Full vrstartup.sh:

#!/bin/bash

# verbose
#set -x

set -o pipefail
shopt -s failglob
set -u

BASENAME="$(basename "$0")"

export STEAMVR_SETUP_LOG="${STEAMVR_SETUP_LOG:-/tmp/SteamVRLauncherSetup.log}"

log () {
	( echo "${BASENAME}[$$]: $*" | tee -a "${STEAMVR_SETUP_LOG}" >&2 ) || :
}

if [ -z "${_SKIP_DATE-}" ]; then
	log "=== $(date) ==="
	# so we only log this once through the vrenv.sh execs etc.
	export _SKIP_DATE=1
fi

if [ -n "${PRESSURE_VESSEL_RUNTIME-}" ]; then
	log "Steam Linux Runtime: ${PRESSURE_VESSEL_RUNTIME}"
elif [ -n "${STEAM_RUNTIME-}" ]; then
	log "WARNING: launching in legacy LDLP scout, please use sniper SLR"
else
	log "ERROR: no steam runtime environment set, please use sniper SLR"
	exit 1
fi

VRBINDIR="$(cd "$(dirname "$0")" && echo $PWD)"

# here first avoids doing it twice in vrsetup.sh, then vrstartup-helper.sh
if [ -z "${STEAMVR_VRENV-}" ]; then
	log exec "$VRBINDIR/vrenv.sh" "$0" "$@"
	exec "$VRBINDIR/vrenv.sh" "$0" "$@"
	# unreachable
fi

if [ "$QT_QPA_PLATFORM" = "wayland" ]; then
	log "WARNING: QT5 wayland plugin is not supported, defaulting to xcb"
	export QT_QPA_PLATFORM="xcb"
fi;

log call "$VRBINDIR/vrsetup.sh"
"$VRBINDIR/vrsetup.sh"

log exec "$VRBINDIR/vrstartup-helper.sh"
exec "$VRBINDIR/vrstartup-helper.sh"

Danielduel avatar Nov 11 '23 14:11 Danielduel