set LIBVA_DRIVER_NAME for arch

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2024-11-15 01:07:22 -05:00
parent a742bebe3d
commit 5215868d3d

View file

@ -15,3 +15,21 @@ fi
export PKGEXT=".pkg.tar"
export TENDS_TO=42
DISTRO=$(cat /etc/os-release | grep '^ID=' | awk -F'=' '{print $2}')
if [ $DISTRO = 'arch' ]; then
# configure VA-API for hardware video acceleration
VIDEO_DRIVERS=($(ls /usr/lib/dri | grep drv_video | awk -F_ '{print $1}'))
VIDEO_DRIVERS_LEN=${#VIDEO_DRIVERS[@]}
if [ $VIDEO_DRIVERS_LEN -eq 1 ]; then
export LIBVA_DRIVER_NAME=$VIDEO_DRIVERS
elif [ $VIDEO_DRIVERS_LEN -gt 1 ]; then
if [ ! -v $LIBVA_DRIVER_NAME]; then
echo "Warning: more than one VA-API driver detected! Found: ${VIDEO_DRIVERS}." >&2
echo "Either delete the wrong driver or choose one manually by setting LIBVA_DRIVER_NAME." >&2
fi
fi
export LC_ALL=C
fi