From dc45da17fe7b4e7c050d56a719a42a8368b3177e Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 22 Sep 2025 14:33:30 +0200 Subject: [PATCH] Add GPU app check and normalize GPU app list Introduces the _is_gpu_app function to check if an app benefits from GPU passthrough, and updates the GPU app list to use lowercase names for consistency. The select_hw_passthrough function now only proceeds for GPU apps or when CTTYPE is 0. --- misc/passthrough.func | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/misc/passthrough.func b/misc/passthrough.func index f914e4c2..8524b1b7 100644 --- a/misc/passthrough.func +++ b/misc/passthrough.func @@ -19,6 +19,10 @@ select_hw_passthrough() { local CTID="$1" CTTYPE="$2" APP="$3" local LXC_CONFIG="/etc/pve/lxc/${CTID}.conf" + if ! _is_gpu_app "$APP" && [[ "$CTTYPE" != "0" ]]; then + return + fi + local choices=() [[ -d /dev/dri ]] && choices+=("VAAPI" "Intel/AMD GPU via VAAPI" OFF) compgen -G "/dev/nvidia*" >/dev/null && choices+=("NVIDIA" "NVIDIA GPU passthrough" OFF) @@ -58,22 +62,33 @@ select_hw_passthrough() { # Apps that benefit from GPU passthrough (VAAPI + NVIDIA) _GPU_APPS=( immich - Channels - Emby - ErsatzTV - Frigate - Jellyfin - Plex - Scrypted - Tdarr - Unmanic - Ollama - FileFlows - "Open WebUI" - Tunarr - Debian + channels + emby + ersatztv + frigate + jellyfin + plex + scrypted + tdarr + unmanic + ollama + fileflows + "open webui" + tunarr + debian ) +_is_gpu_app() { + local app="$1" + local a + shopt -s nocasematch + for a in "${_GPU_APPS[@]}"; do + [[ "$app" == "$a" ]] && shopt -u nocasematch && return 0 + done + shopt -u nocasematch + return 1 +} + # ------------------------------ USB ------------------------------------------- usb_handle_passthrough() {