mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-10-14 19:27:09 -04:00
x86-64 client: the arm64 web helper, and the client on the GPU
Big Picture ran at ~20 fps in the x86-64 client: its web helper drew on SwiftShader (under FEX its GPU process needs libgbm, which FEX does not thunk) and the client showed every frame through llvmpipe. Both clients are the same Steam build, so the x86-64 client now runs the arm64 client's steamwebhelper natively (bannerlator-x64-arm-webhelper: FEX hands the arm64 program to the CPU), with the session's GPU settings and preloads, ANGLE on Turnip. steamrt64/steamwebhelper.sh is pointed at it while the client runs, padded to the client's own copy's size: the client size-checks its files at start and reinstalls itself over one that differs. With the helper off FEX, the client takes the GPU through FEX's thunks. Device: 80+ fps in Big Picture (was 20). BL_X64_X86_WEBHELPER=1 keeps the x86 helper, BL_X64_CLIENT_SOFTWARE=1 the client in software.
This commit is contained in:
1 parent
0e11894c81
commit
a0441cebbc
4 files changed
+70
-6
No files matched your search
@@ -47,6 +47,7 @@ object SessionFiles {
|
||||
// Experimental: Valve's x86-64 client under FEX (desktop menu entry).
|
||||
"usr/local/bin/bannerlator-steam-x64" to "usr/local/bin/bannerlator-steam-x64",
|
||||
"usr/local/bin/bannerlator-x64-arm-proton" to "usr/local/bin/bannerlator-x64-arm-proton",
|
||||
"usr/local/bin/bannerlator-x64-arm-webhelper" to "usr/local/bin/bannerlator-x64-arm-webhelper",
|
||||
"usr/local/bin/bannerlator-desktop-games" to "usr/local/bin/bannerlator-desktop-games",
|
||||
"usr/local/bin/bannerlator-steam-shim" to "usr/local/bin/bannerlator-steam-shim",
|
||||
"usr/local/bin/bannerlator-steam-shortcuts" to "usr/local/bin/bannerlator-steam-shortcuts",
|
||||
|
||||
@@ -265,11 +265,12 @@ case $mode in
|
||||
step "x86-64 Steam client ready"
|
||||
steam_root=${BL_X64_HOME:-$HOME/.droiddeck-x64}/.local/share/Steam
|
||||
steam_client=(bannerlator-steam-x64 --exec)
|
||||
# The client's browser stays in software: on the GPU its GPU process needs libgbm, which FEX
|
||||
# does not thunk, and the guest GBM cannot share buffers with the Adreno (device: GPU process
|
||||
# restart loop, no first frame). Games still get the GPU through the thunks.
|
||||
# BL_X64_CEF_GPU=1 tries it anyway.
|
||||
if [ "${BL_X64_CEF_GPU:-0}" = 1 ] && bannerlator-steam-x64 --gpu; then
|
||||
# The client's browser is the arm64 client's web helper (bannerlator-x64-arm-webhelper), on the
|
||||
# GPU with the same flags. The x86 one (BL_X64_X86_WEBHELPER=1) stays in software: its GPU
|
||||
# process needs libgbm, which FEX does not thunk (device: GPU process restart loop, no first
|
||||
# frame); BL_X64_CEF_GPU=1 tries it anyway.
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] ||
|
||||
{ [ "${BL_X64_CEF_GPU:-0}" = 1 ] && bannerlator-steam-x64 --gpu; }; then
|
||||
steam_cef=(-cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan)
|
||||
else
|
||||
steam_cef=(-cef-disable-gpu)
|
||||
|
||||
@@ -455,6 +455,14 @@ if x64_gpu; then
|
||||
done
|
||||
} > "$X64_HOME/game-gpu.env"
|
||||
fi
|
||||
# The web helper is the arm64 client's (bannerlator-x64-arm-webhelper), which sets its own GPU
|
||||
# environment, so the client itself can have the GPU now: it shows every Big Picture frame the helper
|
||||
# draws, and in software (llvmpipe under FEX) that held the UI at ~20 fps. BL_X64_CLIENT_SOFTWARE=1
|
||||
# keeps it in software.
|
||||
if x64_gpu && [ "${BL_X64_CLIENT_SOFTWARE:-0}" != 1 ]; then
|
||||
export FEX_THUNKCONFIG=$X64_HOME/thunks.json
|
||||
unset LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE
|
||||
else
|
||||
unset FEX_THUNKCONFIG $gpu_vars
|
||||
# x86 Mesa has no driver for this GPU, so software: llvmpipe for GL (the client's own window needs
|
||||
# GLX), and the rootfs's own Vulkan ICDs (lavapipe) found by the x86 loader instead of the arm64 one.
|
||||
@@ -462,6 +470,7 @@ export LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe
|
||||
# The X server hands out the GPU node (DRI3 open), and Mesa's software path then tries KMS dumb
|
||||
# buffers on it in a loop: present through plain X instead.
|
||||
export LIBGL_DRI3_DISABLE=1
|
||||
fi
|
||||
# The proot fast path (libblfastpath, preloaded into every guest process, FEX included) stands down
|
||||
# by itself when FEX is about to run a 32-bit program (it broke FEX's 32-bit mode: SIGILL at start);
|
||||
# 64-bit ones keep it. BL_X64_FP_OFF=1 turns it off for everything, as before.
|
||||
@@ -504,6 +513,32 @@ export BL_WEBHELPER_HIDE_TRACER=1
|
||||
x64_exec() {
|
||||
x64_env
|
||||
cd "$STEAM_X64"
|
||||
# The client's own web helper launcher, pointed at the arm64 client's helper (FEX hands that arm64
|
||||
# program to the CPU). The client checks its files' sizes at every start and reinstalls itself
|
||||
# over one that differs (device: install loop, "steamwebhelper.sh is 176 bytes, expected 84"), so
|
||||
# the replacement is padded to the size of the client's own copy. It is pointed again whenever it
|
||||
# differs, for as long as this client runs: a full check puts the client's copy back.
|
||||
case "${1:-}" in
|
||||
-shutdown|steam://*) ;;
|
||||
*) if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] && [ -x /usr/local/bin/bannerlator-x64-arm-webhelper ]; then
|
||||
(
|
||||
client=$$ wh=$STEAM_X64/steamrt64/steamwebhelper.sh
|
||||
base=$(printf '#!/bin/sh\nexec /usr/local/bin/bannerlator-x64-arm-webhelper "$@"\n#')
|
||||
size= want=
|
||||
while kill -0 "$client" 2>/dev/null; do
|
||||
if [ -f "$wh" ] && ! grep -q bannerlator-x64-arm-webhelper "$wh" 2>/dev/null; then
|
||||
size=$(stat -c %s "$wh") want=
|
||||
pad=$((size - ${#base} - 1))
|
||||
[ "$pad" -ge 0 ] && want=$base$(printf '%*s' "$pad" '' | tr ' ' '-')
|
||||
fi
|
||||
if [ -n "$want" ] && [ "$(cat "$wh" 2>/dev/null)" != "$want" ]; then
|
||||
printf '%s\n' "$want" > "$wh.new" && chmod 755 "$wh.new" && mv -f "$wh.new" "$wh"
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
) &
|
||||
fi ;;
|
||||
esac
|
||||
exec "${BL_FEX:-/usr/local/bin/FEX}" "$STEAM_X64/steamrt64/steam" "$@"
|
||||
}
|
||||
|
||||
@@ -597,7 +632,7 @@ for attempt in 1 2 3 4 5; do
|
||||
echo publicbeta > "$STEAM_X64/package/beta"
|
||||
step "starting the x86-64 SteamRT3 client under FEX (attempt $attempt): $*"
|
||||
rc=0
|
||||
if [ "${BL_X64_CEF_GPU:-0}" = 1 ] && x64_gpu; then cef=(-cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan); else cef=(-cef-disable-gpu); fi
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] || { [ "${BL_X64_CEF_GPU:-0}" = 1 ] && x64_gpu; }; then cef=(-cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan); else cef=(-cef-disable-gpu); fi
|
||||
( x64_exec -clientbeta publicbeta -no-cef-sandbox "${cef[@]}" "$@" ) >>"$LOG" 2>&1 || rc=$?
|
||||
step "client exited rc=$rc"
|
||||
[ "$rc" = 42 ] || break
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# The x86-64 client's web helper (its whole UI) is the arm64 client's, run natively: both clients are
|
||||
# the same Steam build, and steamrt64/steamwebhelper.sh is pointed here (bannerlator-steam-x64) through
|
||||
# an arm64 binary, which FEX hands to the CPU. Under FEX the x86 helper could not have the GPU (its GPU
|
||||
# process needs libgbm, which FEX does not thunk) and drew on SwiftShader; this one draws with ANGLE on
|
||||
# Turnip and takes the session's preloads (KGSL poll fix, fast path), as from the arm64 client.
|
||||
x64_home=$HOME
|
||||
arm=/root/.local/share/Steam/steamrtarm64
|
||||
|
||||
# Drop the x86 side: FEX's settings, the x86 library paths and preloads, the client's software GL.
|
||||
for v in $(compgen -e); do
|
||||
case $v in FEX_*) unset "$v" ;; esac
|
||||
done
|
||||
unset LD_PRELOAD LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE BL_WEBHELPER_HIDE_TRACER
|
||||
# The arm64 session's GPU settings (saved by bannerlator-steam-x64 at start).
|
||||
if [ -f "$x64_home/arm-session.env" ]; then
|
||||
eval "$(grep -E '^declare -x (VK_ICD_FILENAMES|VK_DRIVER_FILES|GALLIUM_DRIVER|MESA_LOADER_DRIVER_OVERRIDE|LIBGL_KOPPER_DRI2|TU_DEBUG|ZINK_DEBUG|ZINK_DESCRIPTORS|MESA_NO_ERROR|MESA_DISK_CACHE_DATABASE)=' "$x64_home/arm-session.env")"
|
||||
fi
|
||||
export LD_LIBRARY_PATH=$arm:$arm/panorama LIBGL_KOPPER_DISABLE=true
|
||||
|
||||
# The client was started for a software browser; the arm64 client's helper is told what it is told.
|
||||
args=()
|
||||
for a in "$@"; do
|
||||
case $a in --disable-gpu|--disable-gpu-compositing) ;; *) args+=("$a") ;; esac
|
||||
done
|
||||
cd "$arm" || exit 1
|
||||
exec "$arm/steamwebhelper" "${args[@]}" --ignore-gpu-blocklist
|
||||
Reference in new issue
Block a user