mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
Apply PowerVR Steam and game compatibility during normal launches
This commit is contained in:
1 parent
92691b363d
commit
3bb74b70b6
10 files changed
+681
-9
No files matched your search
@@ -271,6 +271,54 @@ def mark_install_scripts(command, env):
|
||||
print("droiddeck-game-env: install scripts not marked (%s)" % error, file=sys.stderr)
|
||||
|
||||
|
||||
class SystemGraphicsError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def system_graphics_launch(command, env):
|
||||
"""Use the APK's PowerVR compatibility files only for actual Proton game launches."""
|
||||
runtime = env.get("DROIDDECK_POWERVR_RUNTIME")
|
||||
if not runtime or not game_id(env) or len(command) < 3 or command[1] != "waitforexitandrun":
|
||||
return command, env
|
||||
directory = Path(runtime)
|
||||
if not directory.is_absolute():
|
||||
raise SystemGraphicsError("system Vulkan runtime path is not absolute")
|
||||
required = (
|
||||
"run-proton.py", "wsi/libVkLayer_window_system_integration.so",
|
||||
"wsi/VkLayer_window_system_integration.json", "lib/libVkLayer_hybris_compat.so",
|
||||
*("dxvk/%s/%s.dll" % (arch, name) for arch in ("x32", "x64")
|
||||
for name in ("d3d8", "d3d9", "d3d10core", "d3d11", "dxgi")),
|
||||
)
|
||||
try:
|
||||
for name in required:
|
||||
path = directory / name
|
||||
if not path.is_file() or not path.stat().st_size:
|
||||
raise SystemGraphicsError("missing system Vulkan component: %s" % name)
|
||||
wrapper = directory / "run-proton.py"
|
||||
if not os.access(wrapper, os.X_OK):
|
||||
raise SystemGraphicsError("system Vulkan Proton wrapper is not executable")
|
||||
except OSError as error:
|
||||
raise SystemGraphicsError("system Vulkan component is unreadable: %s" % error) from error
|
||||
result = dict(env)
|
||||
result.update({
|
||||
"HYBRIS_BC_TEXTURES": "dxvk",
|
||||
"VK_LAYER_PATH": "%s:%s" % (directory / "wsi", directory / "lib"),
|
||||
"VK_INSTANCE_LAYERS": "VK_LAYER_window_system_integration:VK_LAYER_HYBRIS_compat",
|
||||
"ENABLE_GAMESCOPE_WSI": "0",
|
||||
"VK_LOADER_LAYERS_DISABLE": "*gamescope*",
|
||||
"DISABLE_VK_LAYER_VALVE_steam_fossilize_1": "1",
|
||||
})
|
||||
for name in ("DISABLE_WSI_LAYER", "PROTON_USE_WINED3D", "ENABLE_VK_LAYER_VALVE_steam_fossilize_1"):
|
||||
result.pop(name, None)
|
||||
return [str(wrapper), *command], result
|
||||
|
||||
|
||||
def exec_proton(command, env):
|
||||
# Synchronization selection has already picked the actual Proton executable.
|
||||
command, env = system_graphics_launch(command, env)
|
||||
os.execvpe(command[0], command, env)
|
||||
|
||||
|
||||
def main():
|
||||
command = sys.argv[1:]
|
||||
if not command:
|
||||
@@ -309,13 +357,17 @@ def main():
|
||||
launch, launch_env = select_sync(command, env, sync)
|
||||
if launch[0] != command[0]:
|
||||
try:
|
||||
os.execvpe(launch[0], launch, launch_env)
|
||||
exec_proton(launch, launch_env)
|
||||
except OSError as error:
|
||||
print("droiddeck-game-env: %s could not start (%s); stock launch" % (launch[0], error), file=sys.stderr)
|
||||
launch, launch_env = command, without_pack(launch_env, env)
|
||||
record_stock(sync, launch, launch_env)
|
||||
os.execvpe(launch[0], launch, launch_env)
|
||||
exec_proton(launch, launch_env)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
try:
|
||||
sys.exit(main())
|
||||
except SystemGraphicsError as error:
|
||||
print("droiddeck-game-env: PowerVR graphics runtime unavailable (%s)" % error, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
@@ -225,7 +225,13 @@ if [ -z "${BL_INSIDE:-}" ]; then
|
||||
echo "== gamescope: games at ${nested}x${height} stretched to the ${width}x${height} output"
|
||||
fi
|
||||
fi
|
||||
args=(--backend wayland --expose-wayland -f -W "$width" -H "$height" -w "$nested" -h "$height")
|
||||
backend=${BL_GAMESCOPE_BACKEND:-wayland}
|
||||
case "$backend" in
|
||||
wayland) ;;
|
||||
sdl) export SDL_VIDEODRIVER=wayland ;;
|
||||
*) echo "== unsupported gamescope backend: $backend"; exit 64 ;;
|
||||
esac
|
||||
args=(--backend "$backend" --expose-wayland -f -W "$width" -H "$height" -w "$nested" -h "$height")
|
||||
[ "$nested" != "$width" ] && args+=(-S stretch) && export BL_STRETCHED=1
|
||||
# -r is what gamescope advertises as the refresh rate, and what a game reads as the display's.
|
||||
# Left unset it defaults to 60, so a 120 Hz panel offers only 60 Hz in game settings. The FPS
|
||||
@@ -764,6 +770,21 @@ BUSCONF
|
||||
export STEAM_RUNTIME=1
|
||||
export LD_LIBRARY_PATH=$steam_root/steamrtarm64:$steam_root/steamrtarm64/panorama${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
||||
export SDL_VIDEO_X11_DGAMOUSE=0
|
||||
bl_steam_path=$PATH
|
||||
bl_steam_angle=vulkan
|
||||
bl_steam_presentation=()
|
||||
if [ "${BL_STEAM_GL_PRESENT:-}" = 1 ]; then
|
||||
bl_steam_path="/usr/local/libexec/droiddeck-steam:$PATH"
|
||||
# Keep the system driver for GPU rendering, but present Steam through ordinary DRI3.
|
||||
# The inner compositor has neither android_wlegl nor the bridge's TAWC-DRI extension.
|
||||
export DISABLE_GAMESCOPE_WSI=1 LIBGL_KOPPER_DISABLE=true
|
||||
bl_steam_angle=gl
|
||||
# CEF renders correctly internally, but its accelerated shared-texture output is
|
||||
# corrupted on this path. Software web compositing avoids that handoff; Gamescope
|
||||
# and the selected game driver still use the system GPU.
|
||||
bl_steam_presentation=(-cef-disable-gpu-compositing)
|
||||
echo "== steam: system PowerVR uses OpenGL/DRI3 through Zink with software CEF compositing"
|
||||
fi
|
||||
# Decky is optional and session scoped: the app's marker opts in, and this supervisor is
|
||||
# reaped with the client session. Native ARM64 runs directly. A legacy x86_64 asset is used
|
||||
# only when its recorded architecture says so and droiddeck-fex has FEX and its runtime ready.
|
||||
@@ -890,7 +911,7 @@ BUSCONF
|
||||
done
|
||||
) &
|
||||
fi
|
||||
echo "== steam args: ${_bl_ui[*]} ${_bl_cdp[*]} ${_bl_lang[*]} -clientbeta $steam_channel -no-cef-sandbox -cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan $*"
|
||||
echo "== steam args: ${_bl_ui[*]} ${_bl_cdp[*]} ${_bl_lang[*]} -clientbeta $steam_channel -no-cef-sandbox -cef-force-gpu ${bl_steam_presentation[*]} -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=$bl_steam_angle $*"
|
||||
# An update that cannot install asks for a restart (rc=42) every time; the count is capped so a
|
||||
# session can never again loop in silence, which reads as a menu opening and closing by itself.
|
||||
steam_updates=0
|
||||
@@ -980,9 +1001,12 @@ BUSCONF
|
||||
/usr/local/bin/droiddeck-steam-desktop-ui &
|
||||
desktop_ui_pid=$!
|
||||
fi
|
||||
# Keep Valve's optional webhelper CPU pinning from aborting browser startup.
|
||||
PATH="$bl_steam_path" \
|
||||
BL_STEAM_WEBHELPER="$steam_root/steamrtarm64/steamwebhelper" \
|
||||
"$steam_root/steamrtarm64/steam" "${_bl_ui[@]}" "${_bl_cdp[@]}" "${_bl_lang[@]}" -clientbeta "$steam_channel" \
|
||||
-no-cef-sandbox -cef-force-gpu -cef-ozone-platform=x11 \
|
||||
-cef-use-gl=angle -cef-use-angle=vulkan "$@"
|
||||
-no-cef-sandbox -cef-force-gpu "${bl_steam_presentation[@]}" -cef-ozone-platform=x11 \
|
||||
-cef-use-gl=angle "-cef-use-angle=$bl_steam_angle" "$@"
|
||||
rc=$?
|
||||
if [ -n "$desktop_ui_pid" ]; then
|
||||
kill "$desktop_ui_pid" 2>/dev/null || true
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# Staged as taskset in a PATH directory used only by the Steam client.
|
||||
# Valve's ARM64 helper uses `taskset 0x7c /path/to/steamwebhelper ...` and exits
|
||||
# before starting the browser when Android denies sched_setaffinity.
|
||||
set -u
|
||||
if [ "$#" -ge 2 ] && [[ "$1" =~ ^(0[xX])?[0-9a-fA-F]+$ ]] &&
|
||||
[ -n "${BL_STEAM_WEBHELPER:-}" ] && [ "$2" -ef "$BL_STEAM_WEBHELPER" ]; then
|
||||
mask=$1
|
||||
shift
|
||||
# Pin this wrapper before exec; never retry a helper that has already run.
|
||||
if ! /usr/bin/taskset -p "$mask" "$$" >/dev/null 2>&1; then
|
||||
echo "droiddeck: Steam helper CPU pinning unavailable; using the allowed CPUs" >&2
|
||||
fi
|
||||
exec -- "$@"
|
||||
fi
|
||||
# Queries, existing-process changes, and other programs retain taskset's behavior.
|
||||
exec /usr/bin/taskset "$@"
|
||||
Reference in new issue
Block a user