From 90e9b0e49633a5b9bb6b875f2b0bde52a1bd36b7 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Thu, 9 Jul 2026 11:06:34 +0300 Subject: [PATCH] fluster.sh: detect codecs With the patchset to support VP8 and MPEG2 in Iris being around the corner, add a way to detect the codecs supported by the M2M device instead of relying on Venus vs Iris driver being a key decision point. Signed-off-by: Dmitry Baryshkov --- fluster.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/fluster.sh b/fluster.sh index 0ad1a5a..4cc4cd7 100755 --- a/fluster.sh +++ b/fluster.sh @@ -8,17 +8,21 @@ then exit 1 fi -if [ -d /sys/bus/platform/drivers/qcom-iris ] && [ "$(find /sys/bus/platform/drivers/qcom-iris -name "*.video-codec")" != "" ] +DEV=$(find /sys/bus/platform/devices/ -name "*.video-codec") +if [ ! -e "$DEV" ] then - DRV=iris -elif [ -d /sys/bus/platform/drivers/qcom-venus ] && [ "$(find /sys/bus/platform/drivers/qcom-venus -name "*.video-codec")" != "" ] + echo "$0: can't find videoc-codec device" + exit 2 +fi + +if [ ! -e "$DEV/driver" ] then - DRV=venus -else echo "$0: can't detect video driver, check that the device is bound" exit 2 fi +DRV=$(basename $(readlink "$DEV/driver") | sed -e 's/qcom-//') + MACHINE="$1" SKIPFILE="$(dirname $0)/${DRV}-${MACHINE}-skip.txt" @@ -52,11 +56,42 @@ fi # Skip the machine shift -if [ "$DRV" = "iris" ] +if [ "$(which v4l2-ctl)" = "" ] then - CODECS="VP9 H.264 H.265" -else - CODECS="VP9 H.264 H.265 VP8 MPEG2_VIDEO" + echo "$0: v4l2-ctl not found, please install v4l-utils" + exit 3 +fi + +fourcc_to_codec() { + case "$1" in + H264) echo "H.264" ;; + HEVC) echo "H.265" ;; + VP80) echo "VP8" ;; + VP90) echo "VP9" ;; + MPG2) echo "MPEG2_VIDEO" ;; + *) ;; + esac +} + +CODECS="" +for vid in "$DEV"/video4linux/video* +do + for fourcc in $(v4l2-ctl -d "/dev/$(basename "$vid")" --list-formats-out 2>/dev/null | \ + sed -n "s/.*'\(....\)'.*compressed.*/\1/p") + do + codec=$(fourcc_to_codec "$fourcc") + [ -n "$codec" ] || continue + case " $CODECS " in + *" $codec "*) ;; + *) CODECS="${CODECS:+$CODECS }$codec" ;; + esac + done +done + +if [ -z "$CODECS" ] +then + echo "$0: no supported compressed formats found for $DEV" + exit 2 fi DECODERS=""