mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
x86-64 client: the GPU for games only, client in software
With FEX's thunks on for every x86 process the client's browser GPU process gets the host drivers even under -cef-disable-gpu, fails and dies, and the client never opens a window. The client keeps the software setup that works; the launcher saves the session's GPU settings and DroidDeck direct hands them and the thunks to the game.
This commit is contained in:
1 parent
0b3bc31397
commit
8589951aea
1 file changed
+30
-16
@@ -227,8 +227,15 @@ rt=$HOME/.local/share/Steam/ubuntu12_32/steam-runtime.old
|
||||
# Source games keep their console in console.log (-condebug): what the VAC diagnostics read - the
|
||||
# server they joined and whether it is secure.
|
||||
case "$*" in *hl2.sh*|*hl2_linux*|*srcds*) set -- "$@" -condebug ;; esac
|
||||
# GL threading is a GPU-path tuning from the session; with software GL under FEX it is no help.
|
||||
[ -n "${LIBGL_ALWAYS_SOFTWARE:-}" ] && export mesa_glthread=false
|
||||
# The GPU: FEX's host thunks and the session's GPU settings, saved by the launcher (the client
|
||||
# itself draws in software). BL_X64_GAME_SOFTWARE=1 keeps the game in software too.
|
||||
gpu=$HOME/game-gpu.env
|
||||
if [ -f "$gpu" ] && [ "${BL_X64_GAME_SOFTWARE:-0}" != 1 ]; then
|
||||
. "$gpu"
|
||||
else
|
||||
# GL threading is a GPU-path tuning from the session; with software GL under FEX it is no help.
|
||||
export mesa_glthread=false
|
||||
fi
|
||||
case $verb in
|
||||
run|waitforexitandrun) exec "$rt/run.sh" "$@" ;;
|
||||
*) exec "$@" ;;
|
||||
@@ -292,23 +299,30 @@ x64_gpu() {
|
||||
x64_env() {
|
||||
# The arm64 session's library paths and preloads are aarch64 and mean nothing to x86 processes.
|
||||
unset LD_LIBRARY_PATH LD_PRELOAD STEAM_RUNTIME STEAM_RUNTIME_PREFER_HOST_LIBRARIES
|
||||
# The client and its browser draw in software, as they always have: with the thunks the browser's
|
||||
# GPU process (even under -cef-disable-gpu it probes GL and Vulkan) gets the host drivers, fails
|
||||
# ("MESA-LOADER: failed to retrieve device information") and dies, and the client never opens a
|
||||
# window (device: 0 windows, "Starting display and audio" forever). Games get the GPU: the session's
|
||||
# GPU settings are saved for DroidDeck direct, which hands them, and FEX's host thunks, to the game.
|
||||
gpu_vars="GALLIUM_DRIVER MESA_LOADER_DRIVER_OVERRIDE VK_ICD_FILENAMES VK_DRIVER_FILES LIBGL_KOPPER_DRI2 ZINK_DEBUG ZINK_DESCRIPTORS TU_DEBUG MESA_NO_ERROR mesa_glthread"
|
||||
rm -f "$X64_HOME/game-gpu.env"
|
||||
if x64_gpu; then
|
||||
# FEX's host thunks: the x86 program's libvulkan and libGL calls run in the runtime's own arm64
|
||||
# libraries - Turnip and Mesa on the GPU, with the session's settings for them (the Turnip ICD,
|
||||
# Zink and its tuning), as the arm64 client has them.
|
||||
printf '{"ThunksDB": {"GL": 1, "Vulkan": 1}}\n' > "$X64_HOME/thunks.json"
|
||||
export FEX_THUNKCONFIG=$X64_HOME/thunks.json
|
||||
else
|
||||
# So are the desktop's GPU settings: zink over the arm64 Turnip ICD. 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.
|
||||
unset GALLIUM_DRIVER MESA_LOADER_DRIVER_OVERRIDE VK_ICD_FILENAMES VK_DRIVER_FILES LIBGL_KOPPER_DRI2 \
|
||||
ZINK_DEBUG ZINK_DESCRIPTORS TU_DEBUG MESA_NO_ERROR
|
||||
export LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe
|
||||
# The X server hands out that node too (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
|
||||
{
|
||||
echo "export FEX_THUNKCONFIG='$X64_HOME/thunks.json'"
|
||||
echo "unset LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE GALLIUM_DRIVER"
|
||||
for v in $gpu_vars; do
|
||||
eval "val=\${$v-}"; [ -n "$val" ] && printf "export %s='%s'\n" "$v" "$val"
|
||||
done
|
||||
} > "$X64_HOME/game-gpu.env"
|
||||
fi
|
||||
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.
|
||||
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
|
||||
# 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.
|
||||
|
||||
Reference in new issue
Block a user