port: give the port container a GPU path -- it never had one

Reported as "the port has low FPS". Godot 4 renders through Vulkan and this
launcher passed nothing through, so it fell back to lavapipe: software Vulkan,
correct and slow. The decoder's launcher has had this block for a long time;
the container that actually runs a renderer was the one without it.

Same three cases as the decoder, including the part worth repeating: passing
/dev/dri alone does NOT work for NVIDIA -- Mesa cannot drive the card and the
proprietary userspace lives outside the image. It needs the container toolkit.

The NOTE now prints the full repo-add sequence, because the package is not in
Ubuntu's default repos and `apt install nvidia-container-toolkit` on its own
fails with 'no installation candidate' -- which reads like the package is
wrong rather than the source being missing.
This commit is contained in:
MechaCat02
2026-09-01 20:22:25 +02:00
parent 4ac23b94dd
commit 18b5b3d5f1

View File

@@ -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[@]}"
}