From 604cad0207553dfa2e52829d6292809bc47f6f82 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 18 Aug 2026 03:23:38 +0200 Subject: [PATCH] feat: Support GPU acceleration for AMD GPU's (#1391) --- src/display.sh | 69 -------------------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 src/display.sh diff --git a/src/display.sh b/src/display.sh deleted file mode 100644 index 56d5d41..0000000 --- a/src/display.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -# Docker environment variables - -: "${GPU:="N"}" # GPU passthrough -: "${VGA:="virtio"}" # VGA adaptor -: "${DISPLAY:="none"}" # Display type -: "${LOSSY:="N"}" # Lossy VNC compression -: "${RENDERNODE:="/dev/dri/renderD128"}" # Render node - -# Sanitize variables -VGA=$(strip "$VGA") -LOSSY=$(strip "$LOSSY") -DISPLAY=$(strip "$DISPLAY") -RENDERNODE=$(strip "$RENDERNODE") - -CPU_VENDOR=$(lscpu | awk '/Vendor ID/{print $3}') - -# The accelerated Intel render-node path is restricted to x86 Intel hosts; -# other platforms retain the normal QEMU display backend. -if ! enabled "$GPU" || isAmdCpu || [[ "$ARCH" != "amd64" ]]; then - - # A disabled frontend also removes the emulated VGA device to keep the guest - # hardware layout headless. - [[ "${DISPLAY,,}" == "none" ]] && VGA="none" - - if enabled "$LOSSY" && [[ "${DISPLAY,,}" == vnc=* ]]; then - DISPLAY+=",lossy=on" - fi - - DISPLAY_OPTS="-display ${DISPLAY} -vga ${VGA}" - return 0 - -fi - -msg="Configuring display drivers..." - -html "$msg" -enabled "$DEBUG" && echo "$msg" - -DISPLAY_OPTS="-display egl-headless,rendernode=${RENDERNODE}" -DISPLAY_OPTS+=" -vga $VGA" - -[ ! -d /dev/dri ] && mkdir -m 755 /dev/dri - -# Extract the card number from the render node -# Linux renderD128 corresponds to card0; derive both device minors because -# container device bindings may expose only the render node. -CARD_NUMBER=$(echo "$RENDERNODE" | grep -oP '(?<=renderD)\d+') -CARD_DEVICE="/dev/dri/card$((CARD_NUMBER - 128))" - -if [ ! -c "$CARD_DEVICE" ]; then - if mknod "$CARD_DEVICE" c 226 $((CARD_NUMBER - 128)); then - chmod 666 "$CARD_DEVICE" - fi -fi - -if [ ! -c "$RENDERNODE" ]; then - if mknod "$RENDERNODE" c 226 "$CARD_NUMBER"; then - chmod 666 "$RENDERNODE" - fi -fi - -if [ ! -c "$RENDERNODE" ] || [ ! -r "$RENDERNODE" ] || [ ! -w "$RENDERNODE" ]; then - warn "render device '${RENDERNODE}' is unavailable or inaccessible." -fi - -return 0