diff --git a/misc/build.func b/misc/build.func index 0b56a247..6db16105 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1211,10 +1211,13 @@ EOF if [[ "$CT_TYPE" == "0" || "$is_vaapi_app" == "true" ]]; then VAAPI_DEVICES=() - for bypath in /dev/dri/by-path/*; do - [[ "$bypath" =~ -card$ || "$bypath" =~ -render$ ]] || continue - target=$(readlink -f "$bypath") - [[ -e "$target" ]] && VAAPI_DEVICES+=("$target") + for bypath in /dev/dri/by-path/*-render; do + dev_target=$(readlink -f "$bypath") + pci_addr=$(basename "$bypath" | cut -d- -f1 --complement | sed 's/-render//') + pci_info=$(lspci -nn | grep "$pci_addr") + name="${pci_info#*: }" + label="$(basename "$dev_target") - ${name:-Unknown GPU}" + VAAPI_DEVICES+=("$dev_target" "$label" "OFF") done [[ -e /dev/fb0 ]] && VAAPI_DEVICES+=("/dev/fb0") @@ -1243,15 +1246,9 @@ This allows GPU hardware acceleration (e.g., video transcoding for Jellyfin, Ple You will now be prompted to select which VAAPI devices should be passed through." 12 72 - CHOICES=() - for dev in "${VAAPI_DEVICES[@]}"; do - desc="$(basename "$dev")" - CHOICES+=("$dev" "$desc" "OFF") - done - SELECTED_DEVICES=$(whiptail --title "VAAPI Device Selection" \ - --checklist "Select VAAPI device(s) to passthrough:" 20 70 10 \ - "${CHOICES[@]}" 3>&1 1>&2 2>&3) + --checklist "Select VAAPI device(s) / GPU(s) to passthrough:" 20 70 10 \ + "${VAAPI_DEVICES[@]}" 3>&1 1>&2 2>&3) if [[ -n "$SELECTED_DEVICES" ]]; then IDX=0