Update build.func

This commit is contained in:
CanbiZ 2025-07-28 11:58:38 +02:00
parent 40b3ec344a
commit d28237502d

View File

@ -1188,20 +1188,9 @@ EOF
# VAAPI passthrough for privileged containers or known apps # VAAPI passthrough for privileged containers or known apps
VAAPI_APPS=( VAAPI_APPS=(
"immich" "immich" "Channels" "Emby" "ErsatzTV" "Frigate" "Jellyfin"
"Channels" "Plex" "Scrypted" "Tdarr" "Unmanic" "Ollama" "FileFlows"
"Emby" "Open WebUI" "Debian"
"ErsatzTV"
"Frigate"
"Jellyfin"
"Plex"
"Scrypted"
"Tdarr"
"Unmanic"
"Ollama"
"FileFlows"
"Open WebUI"
"Debian"
) )
is_vaapi_app=false is_vaapi_app=false
@ -1216,9 +1205,9 @@ EOF
declare -A seen_devices declare -A seen_devices
VAAPI_DEVICES=() VAAPI_DEVICES=()
for bypath in /dev/dri/by-path/*-render /dev/dri/renderD*; do for bypath in /dev/dri/by-path/*-render /dev/dri/renderD* /dev/dri/card*; do
[[ -e "$bypath" ]] || continue [[ -e "$bypath" ]] || continue
dev_target=$(readlink -f "$bypath") || continue dev_target=$(readlink -f "$bypath" 2>/dev/null || echo "$bypath")
[[ -n "${seen_devices[$dev_target]}" ]] && continue [[ -n "${seen_devices[$dev_target]}" ]] && continue
seen_devices["$dev_target"]=1 seen_devices["$dev_target"]=1
@ -1230,18 +1219,17 @@ EOF
label="$(basename "$dev_target") - $name" label="$(basename "$dev_target") - $name"
VAAPI_DEVICES+=("$dev_target" "$label" "OFF") VAAPI_DEVICES+=("$dev_target" "$label" "OFF")
done done
[[ -e /dev/fb0 ]] && VAAPI_DEVICES+=("/dev/fb0") [[ -e /dev/fb0 ]] && VAAPI_DEVICES+=("/dev/fb0" "fb0 - Framebuffer" "OFF")
# Dynamically resolve group IDs
GID_VIDEO=$(getent group video | cut -d: -f3) GID_VIDEO=$(getent group video | cut -d: -f3)
GID_RENDER=$(getent group render | cut -d: -f3) GID_RENDER=$(getent group render | cut -d: -f3)
[[ -z "$GID_VIDEO" ]] && GID_VIDEO=44 && msg_warn "'video' group not found, falling back to GID 44" [[ -z "$GID_VIDEO" ]] && GID_VIDEO=44 && msg_warn "'video' group not found, falling back to GID 44"
[[ -z "$GID_RENDER" ]] && GID_RENDER=104 && msg_warn "'render' group not found, falling back to GID 104" [[ -z "$GID_RENDER" ]] && GID_RENDER=104 && msg_warn "'render' group not found, falling back to GID 104"
if [[ "${#VAAPI_DEVICES[@]}" -eq 0 ]]; then if [[ "${#VAAPI_DEVICES[@]}" -eq 0 ]]; then
: msg_warn "No VAAPI-compatible devices found."
elif [[ "${#VAAPI_DEVICES[@]}" -eq 1 && "$CT_TYPE" == "0" ]]; then elif [[ "${#VAAPI_DEVICES[@]}" -eq 3 && "$CT_TYPE" == "0" ]]; then
# Privileged + 1 device → silent passthrough # Only one device and privileged → silent passthrough
device="${VAAPI_DEVICES[0]}" device="${VAAPI_DEVICES[0]}"
if ! major_minor=$(stat -c '%t:%T' "$device" 2>/dev/null | awk -F: '{ printf "%d:%d", "0x"$1, "0x"$2 }'); then if ! major_minor=$(stat -c '%t:%T' "$device" 2>/dev/null | awk -F: '{ printf "%d:%d", "0x"$1, "0x"$2 }'); then
msg_warn "Could not stat $device skipping passthrough." msg_warn "Could not stat $device skipping passthrough."
@ -1252,30 +1240,26 @@ EOF
else else
if [[ "$CT_TYPE" == "0" ]]; then if [[ "$CT_TYPE" == "0" ]]; then
whiptail --title "VAAPI passthrough" --msgbox "\ whiptail --title "VAAPI passthrough" --msgbox "\
⚙️ VAAPI passthrough enabled ✅ VAAPI passthrough has been enabled
GPU hardware acceleration will be available inside the container GPU hardware acceleration will be available inside the container
(e.g., for Jellyfin, Plex, Frigate, etc.). (e.g., for Jellyfin, Plex, Frigate, etc.)
⚠️ Note: You may need to install drivers manually inside the container, Note: You may need to install drivers manually inside the container,
such as 'intel-media-driver', 'libva2', or 'vainfo'. such as 'intel-media-driver', 'libva2', or 'vainfo'." 15 74
You can now select which VAAPI devices to passthrough." 15 74
else else
whiptail --title "VAAPI passthrough (limited)" --msgbox "\ whiptail --title "VAAPI passthrough (limited)" --msgbox "\
⚠️ Limited VAAPI support in unprivileged container ⚠️ VAAPI passthrough in unprivileged containers may be limited
Some drivers (e.g., iHD) may not work due to LXC restrictions. Some drivers (e.g., iHD) require privileged access to DRM subsystems.
If VAAPI fails, consider using a privileged container. If VAAPI fails, consider switching to a privileged container.
⚠️ Note: You may need to install drivers manually inside the container, Note: You may need to install drivers manually inside the container,
such as 'intel-media-driver', 'libva2', or 'vainfo'. such as 'intel-media-driver', 'libva2', or 'vainfo'." 15 74
You can now select which VAAPI devices to passthrough." 15 74
fi fi
SELECTED_DEVICES=$(whiptail --title "VAAPI Device Selection" \ SELECTED_DEVICES=$(whiptail --title "VAAPI Device Selection" \
--checklist "Select VAAPI device(s) / GPU(s) to passthrough:" 20 70 10 \ --checklist "Select VAAPI device(s) / GPU(s) to passthrough:" 20 72 10 \
"${VAAPI_DEVICES[@]}" 3>&1 1>&2 2>&3) "${VAAPI_DEVICES[@]}" 3>&1 1>&2 2>&3)
if [[ -n "$SELECTED_DEVICES" ]]; then if [[ -n "$SELECTED_DEVICES" ]]; then