mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
droiddeck-session: wait up to 10 s for the Mali bridge socket before falling back
The bridge check tested the server's socket once. It now polls every 50 ms (BL_VKBRIDGE_WAIT_MS, default 10000) on the first pass, logs how long the socket took, stops waiting when the session is told to stop, and names what is missing (icd, library, socket) when it falls back.
This commit is contained in:
1 parent
5b35ace098
commit
9c28b41d49
2 files changed
+170
-4
No files matched your search
@@ -97,7 +97,7 @@ collect_steam_logs() {
|
||||
cp "$fex_state/status.json" "$fex_state/config/Config.json" "$BL_DEBUG_DIR/droiddeck-fex/" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
trap 'collect_steam_logs 2>/dev/null || true' TERM INT HUP
|
||||
trap 'bl_stopping=1; collect_steam_logs 2>/dev/null || true' TERM INT HUP
|
||||
if [ -n "${BL_VK_DRIVER:-}" ]; then
|
||||
bl_icd_lib=$(sed -n 's/.*"library_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$BL_VK_DRIVER" 2>/dev/null | head -1)
|
||||
bl_icd_lib=$(printf '%s' "$bl_icd_lib" | sed 's|\\/|/|g')
|
||||
@@ -114,9 +114,48 @@ if [ -n "${BL_VK_DRIVER:-}" ]; then
|
||||
fi
|
||||
unset bl_icd_lib
|
||||
fi
|
||||
bl_now_ms() {
|
||||
if [ -n "${EPOCHREALTIME:-}" ]; then
|
||||
local t=${EPOCHREALTIME/[.,]/}
|
||||
echo $((10#$t / 1000))
|
||||
else
|
||||
date +%s%3N
|
||||
fi
|
||||
}
|
||||
vkbridge_wait_socket() {
|
||||
local sock=$1 limit=${2:-10000} start now waited
|
||||
[ -n "$sock" ] || return 1
|
||||
if [ -S "$sock" ]; then
|
||||
echo "== vkbridge: server socket ready (waited 0 ms)"
|
||||
return 0
|
||||
fi
|
||||
start=$(bl_now_ms)
|
||||
while :; do
|
||||
now=$(bl_now_ms)
|
||||
waited=$((now - start))
|
||||
if [ -S "$sock" ]; then
|
||||
echo "== vkbridge: server socket ready (waited $waited ms; the server listens after its startup probe)"
|
||||
return 0
|
||||
fi
|
||||
if [ -n "${bl_stopping:-}" ]; then
|
||||
echo "== vkbridge: no server socket after $waited ms; the session is stopping"
|
||||
return 1
|
||||
fi
|
||||
if [ "$waited" -ge "$limit" ]; then
|
||||
echo "== vkbridge: no server socket after $waited ms (gave up at $limit ms)"
|
||||
return 1
|
||||
fi
|
||||
sleep 0.05
|
||||
done
|
||||
}
|
||||
if [ "${BL_VKBRIDGE:-0}" = 1 ]; then
|
||||
bl_vkb_icd=/usr/local/share/vkbridge/droidbridge_icd.json
|
||||
if [ -r "$bl_vkb_icd" ] && [ -r /usr/local/lib/vkbridge/libvulkan_droidbridge.so ] && [ -S "${VKBRIDGE_SOCKET:-}" ]; then
|
||||
[ -z "${BL_INSIDE:-}" ] && vkbridge_wait_socket "${VKBRIDGE_SOCKET:-}" "${BL_VKBRIDGE_WAIT_MS:-10000}"
|
||||
bl_vkb_missing=
|
||||
[ -r "$bl_vkb_icd" ] || bl_vkb_missing="$bl_vkb_missing icd"
|
||||
[ -r /usr/local/lib/vkbridge/libvulkan_droidbridge.so ] || bl_vkb_missing="$bl_vkb_missing library"
|
||||
[ -S "${VKBRIDGE_SOCKET:-}" ] || bl_vkb_missing="$bl_vkb_missing socket"
|
||||
if [ -z "$bl_vkb_missing" ]; then
|
||||
export VK_DRIVER_FILES=$bl_vkb_icd VK_ICD_FILENAMES=$bl_vkb_icd
|
||||
export VKBRIDGE_SOCKET VKBRIDGE_CLIENT_LOG
|
||||
if [ -r /root/.vkbridge-env ]; then
|
||||
@@ -136,9 +175,9 @@ if [ "${BL_VKBRIDGE:-0}" = 1 ]; then
|
||||
fi
|
||||
echo "== vulkan driver: Mali bridge ($bl_vkb_icd, server at $VKBRIDGE_SOCKET)"
|
||||
else
|
||||
echo "== vulkan driver: Mali bridge requested but NOT usable (icd $bl_vkb_icd, socket ${VKBRIDGE_SOCKET:-unset}); this GPU will show a black screen"
|
||||
echo "== vulkan driver: Mali bridge requested but NOT usable (icd $bl_vkb_icd, socket ${VKBRIDGE_SOCKET:-unset}; missing:$bl_vkb_missing); this GPU will show a black screen"
|
||||
fi
|
||||
unset bl_vkb_icd
|
||||
unset bl_vkb_icd bl_vkb_missing
|
||||
fi
|
||||
export GAMESCOPE_FORCE_VULKAN_REALTIME=${BL_GAMESCOPE_REALTIME:-0}
|
||||
|
||||
|
||||
Reference in new issue
Block a user