diff --git a/docker/port/sylph-port b/docker/port/sylph-port index cd7d554f..beb274e2 100755 --- a/docker/port/sylph-port +++ b/docker/port/sylph-port @@ -114,6 +114,53 @@ docker_args() { fi [ -n "${ANTHROPIC_API_KEY:-}" ] && _out+=(-e "ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY") + + # ── GPU ── + # This block did not exist until 2026-09-01, and its absence was reported as + # a symptom rather than a cause: **the port agent reported low FPS.** Godot 4 + # renders through Vulkan, and with nothing passed through it was falling back + # to lavapipe — software Vulkan, which is correct and slow. The decoder's + # launcher had this logic; this one never did, so the container that actually + # runs a renderer was the one without a GPU. + # + # Three distinct cases, and conflating them is how you end up believing you + # have hardware Vulkan while running llvmpipe: + # + # NVIDIA needs the NVIDIA Container Toolkit (`--gpus all`). Passing + # /dev/dri alone does NOT work — Mesa cannot drive an NVIDIA card, + # and the proprietary userspace lives outside the image. + # Mesa (AMD/Intel) works with a plain /dev/dri passthrough plus the + # host's render/video GIDs. + # neither software Vulkan (lavapipe): correct, and slow. + if [ "${SYLPH_VULKAN:-auto}" = "sw" ]; then + _out+=(-e SYLPH_VULKAN=sw) + elif command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi -L >/dev/null 2>&1; then + if docker info --format '{{json .Runtimes}}' 2>/dev/null | grep -q nvidia; then + _out+=(--gpus all) + else + echo "==> NOTE: NVIDIA GPU found but the NVIDIA Container Toolkit is not" >&2 + echo " installed, so Godot falls back to lavapipe (software — correct," >&2 + echo " slow, and the reason for any low-FPS report). To enable it:" >&2 + echo " curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \\" >&2 + echo " | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg" >&2 + echo " curl -fsSL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \\" >&2 + echo " | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \\" >&2 + echo " | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list" >&2 + echo " sudo apt update && sudo apt install -y nvidia-container-toolkit" >&2 + echo " sudo nvidia-ctk runtime configure --runtime=docker" >&2 + echo " sudo systemctl restart docker" >&2 + _out+=(-e SYLPH_VULKAN=sw) + fi + elif [ -e /dev/dri/renderD128 ]; then + _out+=(--device /dev/dri) + for g in render video; do + gid=$(getent group "$g" | cut -d: -f3 || true) + [ -n "$gid" ] && _out+=(--group-add "$gid") + done + else + _out+=(-e SYLPH_VULKAN=sw) + fi + printf '%s\n' "${_out[@]}" }