Update build.func

This commit is contained in:
CanbiZ 2025-07-28 13:41:31 +02:00
parent 2003628036
commit 0df796a730

View File

@ -1202,10 +1202,8 @@ EOF
done
if [[ "$CT_TYPE" == "0" || "$is_vaapi_app" == "true" ]]; then
declare -A seen_devices
VAAPI_DEVICES=()
VAAPI_DEVICES=()
SINGLE_VAAPI_DEVICE=""
seen_ids=()
for bypath in /dev/dri/by-path/*-render /dev/dri/renderD*; do
@ -1228,7 +1226,6 @@ EOF
[[ -e "$card" ]] && label+=" + $(basename "$card")"
label+=" $name"
# Encode both devices with ":" separated, e.g.: /dev/dri/renderD128:/dev/dri/card0
VAAPI_DEVICES+=("$(
IFS=:
echo "${combo_devices[*]}"
@ -1245,10 +1242,12 @@ EOF
if [[ "${#VAAPI_DEVICES[@]}" -eq 0 ]]; then
msg_warn "No VAAPI-compatible devices found."
elif [[ "${#VAAPI_DEVICES[@]}" -eq 3 && "$CT_TYPE" == "0" ]]; then
# Silent passthrough mit ggf. mehreren Subdevices
IDX=0
# Auto passthrough for single device
msg_info "Only one VAAPI-compatible device found enabling passthrough."
IFS=":" read -ra devices <<<"${VAAPI_DEVICES[0]//\"/}"
DID_MOUNT_DRI=0
IFS=":" read -ra devices <<<"$(sed 's/"//g' <<<"${VAAPI_DEVICES[0]}")"
for d in "${devices[@]}"; do
if [[ "$DID_MOUNT_DRI" -eq 0 && -d /dev/dri ]]; then
echo "lxc.mount.entry: /dev/dri /dev/dri none bind,optional,create=dir" >>"$LXC_CONFIG"
@ -1286,8 +1285,7 @@ such as 'intel-media-driver', 'libva2', or 'vainfo'." 15 74
--checklist "Select VAAPI device(s) / GPU(s) to passthrough:" 20 100 6 \
"${VAAPI_DEVICES[@]}" 3>&1 1>&2 2>&3)
WHIPTAIL_EXIT=$?
if [[ "$WHIPTAIL_EXIT" -ne 0 ]]; then
if [[ $? -ne 0 ]]; then
exit_script
msg_error "VAAPI passthrough selection cancelled by user."
fi
@ -1296,11 +1294,9 @@ such as 'intel-media-driver', 'libva2', or 'vainfo'." 15 74
IDX=0
DID_MOUNT_DRI=0
for dev in $SELECTED_DEVICES; do
dev="${dev%\"}" # remove trailing "
dev="${dev#\"}" # remove leading "
dev="${dev%\"}"
dev="${dev#\"}" # strip quotes
IFS=":" read -ra devices <<<"$dev"
for d in "${devices[@]}"; do
for d in "${devices[@]}"; do
if [[ "$CT_TYPE" == "0" ]]; then
if [[ "$DID_MOUNT_DRI" -eq 0 && -d /dev/dri ]]; then
@ -1320,7 +1316,6 @@ such as 'intel-media-driver', 'libva2', or 'vainfo'." 15 74
fi
done
done
done
else
msg_warn "No VAAPI devices selected passthrough skipped."
fi