diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-06-18 02:23:36 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-06-20 02:29:33 +0300 |
commit | 306c53b308c2ff7b6344b413332bf7ea040e852a (patch) | |
tree | b261f44ae828d5651c9fde114cf379d5333e8799 | |
parent | 6b5959c04c5afebded4471430fa7eceac81c1183 (diff) |
vsp-lib: Replace vsp-runner script with a function from vsp-lib
This allows reusing variables internal to vsp-lib and getting rid of the
mdev and format arguments to the vsp-runner invocations.
As part of the transition, handle additional options with an explicit
list of supported options instead of passing them straight to yavta.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rwxr-xr-x | scripts/vsp-lib.sh | 107 | ||||
-rwxr-xr-x | scripts/vsp-runner.sh | 149 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0001.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0002.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0003.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0004.sh | 6 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0005.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0006.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0007.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0008.sh | 4 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0009.sh | 4 |
11 files changed, 126 insertions, 168 deletions
diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh index 1f00481..bf80aa0 100755 --- a/scripts/vsp-lib.sh +++ b/scripts/vsp-lib.sh @@ -388,6 +388,7 @@ pipe_reset() { $mediactl -d $mdev -r __vsp_bru_inputs= + __vsp_rpf_format= __vsp_uds_scale= __vsp_wpf_index= __vsp_wpf_format= @@ -438,6 +439,8 @@ format_rpf() { local rpf=$3 $mediactl -d $mdev -V "'$dev rpf.$rpf':0 [fmt:$format/$size]" + + __vsp_rpf_format=$1 } format_rpf_bru() { @@ -458,6 +461,7 @@ format_rpf_bru() { $mediactl -d $mdev -V "'$dev wpf.0':0 [fmt:$format/$size]" $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$format/$size]" + __vsp_rpf_format=$1 __vsp_wpf_format=$1 } @@ -478,6 +482,7 @@ format_rpf_bru_uds() { $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$outfmt/$outsize]" [ $insize != $outsize ] && __vsp_uds_scale=true + __vsp_rpf_format=$1 __vsp_wpf_format=$3 } @@ -491,6 +496,7 @@ format_rpf_clu() { $mediactl -d $mdev -V "'$dev wpf.0':0 [fmt:$format/$size]" $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$format/$size]" + __vsp_rpf_format=$1 __vsp_wpf_format=$1 } @@ -505,6 +511,7 @@ format_rpf_hgo() { $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$format/$size]" $mediactl -d $mdev -V "'$dev hgo':0 [fmt:$format/$size $crop $compose]" + __vsp_rpf_format=$1 __vsp_wpf_format=$1 } @@ -518,6 +525,7 @@ format_rpf_lut() { $mediactl -d $mdev -V "'$dev wpf.0':0 [fmt:$format/$size]" $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$format/$size]" + __vsp_rpf_format=$1 __vsp_wpf_format=$1 } @@ -534,6 +542,7 @@ format_rpf_uds() { $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$outfmt/$outsize]" [ $insize != $outsize ] && __vsp_uds_scale=true + __vsp_rpf_format=$1 __vsp_wpf_format=$3 } @@ -554,6 +563,7 @@ format_rpf_uds_bru() { $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$outfmt/$outsize]" [ $insize != $outsize ] && __vsp_uds_scale=true + __vsp_rpf_format=$1 __vsp_wpf_format=$3 } @@ -577,6 +587,7 @@ format_rpf_wpf() { $mediactl -d $mdev -V "'$dev wpf.$wpf':0 [fmt:$infmt/$size $crop]" $mediactl -d $mdev -V "'$dev wpf.$wpf':1 [fmt:$outfmt/$outsize]" + __vsp_rpf_format=$3 __vsp_wpf_format=$5 } @@ -599,6 +610,101 @@ format_configure() { } # ------------------------------------------------------------------------------ +# Frame capture and output +# + +generate_input_frame() { + local file=$1 + local format=$2 + local size=$3 + + local alpha= + local options= + + case $format in + ARGB555) + alpha=255 + ;; + ABGR32 | ARGB32) + alpha=200 + ;; + XRGB555 | XBGR32 | XRGB32) + alpha=0 + ;; + *) + alpha=255 + ;; + esac + + $(format_v4l2_is_yuv $format) && options="$options -y" + + $genimage -f $format -s $size -a $alpha $options -o $file \ + frames/frame-reference-1024x768.pnm +} + +vsp_runner() { + local entity=$1 + shift + + local option + local buffers=4 + local count=10 + local skip=7 + + for option in $* ; do + case $option in + --buffers=*) + buffers=${option/--buffers=/} + ;; + + --count=*) + count=${option/--count=/} + ;; + + --skip=*) + skip=${option/--skip=/} + ;; + + *) + return 1 + ;; + esac + done + + local file + local videodev + local format + local size + + case $entity in + hgo) + videodev=$(vsp1_entity_subdev "hgo histo") + file="histo-#.bin" + buffers=10 + ;; + + rpf.*) + videodev=$(vsp1_entity_subdev "$entity input") + format=$__vsp_rpf_format + size=$(vsp1_entity_get_size $entity 0) + file=${entity}.bin + generate_input_frame $file $format $size + ;; + + wpf.*) + videodev=$(vsp1_entity_subdev "$entity output") + format=$__vsp_wpf_format + size=$(vsp1_entity_get_size $entity 1) + file="frame-#.bin" + ;; + esac + + $yavta -c$count -n $buffers ${format:+-f $format} ${size:+-s $size} \ + ${skip:+--skip $skip} ${file:+--file=$file} $videodev \ + | ./logger.sh $entity >> $logfile +} + +# ------------------------------------------------------------------------------ # Test run # @@ -671,6 +777,7 @@ test_complete() { rm -f frame-*.bin rm -f histo-*.bin + rm -f rpf.*.bin } test_run() { diff --git a/scripts/vsp-runner.sh b/scripts/vsp-runner.sh deleted file mode 100755 index c4745c3..0000000 --- a/scripts/vsp-runner.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/sh - -set -e - -source vsp-lib.sh - -genimage='./gen-image' -mediactl='media-ctl' -yavta='yavta' - -# ----------------------------------------------------------------------------- -# Input frame generation -# - -generate_input_frame() { - local file=$1 - local format=$2 - local size=$3 - - local alpha= - local options= - - case $format in - ARGB555) - alpha=255 - ;; - ABGR32 | ARGB32) - alpha=200 - ;; - XRGB555 | XBGR32 | XRGB32) - alpha=0 - ;; - *) - alpha=255 - ;; - esac - - $(format_v4l2_is_yuv $format) && options="$options -y" - - $genimage -f $format -s $size -a $alpha $options -o $file \ - frames/frame-reference-1024x768.pnm -} - -# ------------------------------------------------------------------------------ -# Parse the command line and retrieve the formats -# - -syntax() { - echo "Syntax: vsp-runner.sh dev cmd [...]" - echo "" - echo "Supported commands:" - echo " hgo [options]" - echo " input index infmt [options]" - echo " output index outfmt [options]" -} - -parse() { - if [ $# -lt 2 ] ; then - syntax - return 1 - fi - - mdev=$1 - cmd=$2 - - case $cmd in - hgo) - options=$3 - log=hgo - ;; - - input) - index=$3 - infmt=$4 - options=$5 - log=input.$index - ;; - - output) - index=$3 - outfmt=$4 - options=$5 - log=output.$index - ;; - - *) - echo "Invalid command $cmd" - ;; - esac -} - -# ------------------------------------------------------------------------------ -# Execute the command -# - -execute() { - dev=`$mediactl -d $mdev -p | grep 'bus info' | sed 's/.*platform://'` - - if [ -z $dev ] ; then - echo "Error: Device $dev doesn't exist" - syntax - return 1 - fi - - case $cmd in - hgo) - if [ "x$options" = xinfinite ] ; then - $yavta -c -n 4 $(vsp1_entity_subdev "hgo histo") - else - $yavta -c10 -n 10 --file=histo-#.bin $options \ - $(vsp1_entity_subdev "hgo histo") - fi - ;; - - input) - rpf=rpf.$index - size=$(vsp1_entity_get_size $rpf 0) - file=${rpf}.bin - - generate_input_frame $file $infmt $size - - if [ "x$options" = xinfinite ] ; then - $yavta -c -n 4 -f $infmt -s $size --file=$file $options \ - $(vsp1_entity_subdev "$rpf input") - else - $yavta -c10 -n 4 -f $infmt -s $size --file=$file $options \ - $(vsp1_entity_subdev "$rpf input") - fi - - rm -f $file - ;; - - output) - wpf=wpf.$index - size=$(vsp1_entity_get_size $wpf 1) - - if [ "x$options" = xinfinite ] ; then - $yavta -c -n 4 -f $outfmt -s $size \ - $(vsp1_entity_subdev "$wpf output") - else - $yavta -c10 -n 4 -f $outfmt -s $size --skip 7 -F $options \ - $(vsp1_entity_subdev "$wpf output") - fi - ;; - esac -} - -parse $* || exit 1 -execute | ./logger.sh $log >> $logfile diff --git a/tests/vsp-unit-test-0001.sh b/tests/vsp-unit-test-0001.sh index 887f23a..1357363 100755 --- a/tests/vsp-unit-test-0001.sh +++ b/tests/vsp-unit-test-0001.sh @@ -17,8 +17,8 @@ test_wpf_packing() { pipe_configure rpf-wpf 0 0 format_configure rpf-wpf 0 0 ARGB32 1024x768 $format - $vsp_runner $mdev input 0 ARGB32 & - $vsp_runner $mdev output 0 $format + vsp_runner rpf.0 & + vsp_runner wpf.0 result=$(compare_frames) diff --git a/tests/vsp-unit-test-0002.sh b/tests/vsp-unit-test-0002.sh index 35bb0ad..bc82b3c 100755 --- a/tests/vsp-unit-test-0002.sh +++ b/tests/vsp-unit-test-0002.sh @@ -17,8 +17,8 @@ test_wpf_packing() { pipe_configure rpf-wpf 0 0 format_configure rpf-wpf 0 0 YUV444M 1024x768 $format - $vsp_runner $mdev input 0 YUV444M & - $vsp_runner $mdev output 0 $format + vsp_runner rpf.0 & + vsp_runner wpf.0 result=$(compare_frames) diff --git a/tests/vsp-unit-test-0003.sh b/tests/vsp-unit-test-0003.sh index 30bf2df..9a11d9f 100755 --- a/tests/vsp-unit-test-0003.sh +++ b/tests/vsp-unit-test-0003.sh @@ -20,8 +20,8 @@ test_scale() { pipe_configure rpf-uds format_configure rpf-uds $format $insize $format $outsize - $vsp_runner $mdev input 0 $format & - $vsp_runner $mdev output 0 $format + vsp_runner rpf.0 & + vsp_runner wpf.0 result=$(compare_frames) diff --git a/tests/vsp-unit-test-0004.sh b/tests/vsp-unit-test-0004.sh index f3a6811..396e053 100755 --- a/tests/vsp-unit-test-0004.sh +++ b/tests/vsp-unit-test-0004.sh @@ -16,9 +16,9 @@ test_histogram() { pipe_configure rpf-hgo format_configure rpf-hgo $format 1024x768 - $vsp_runner $mdev hgo & - $vsp_runner $mdev input 0 $format & - $vsp_runner $mdev output 0 $format + vsp_runner hgo & + vsp_runner rpf.0 & + vsp_runner wpf.0 result=$(compare_histograms) diff --git a/tests/vsp-unit-test-0005.sh b/tests/vsp-unit-test-0005.sh index caf0c9c..9cb46c6 100755 --- a/tests/vsp-unit-test-0005.sh +++ b/tests/vsp-unit-test-0005.sh @@ -19,8 +19,8 @@ test_rpf() { pipe_configure rpf-wpf $rpf 0 format_configure rpf-wpf $rpf 0 $format 1024x768 $format - $vsp_runner $mdev input $rpf $format & - $vsp_runner $mdev output 0 $format + vsp_runner rpf.$rpf & + vsp_runner wpf.0 result=$(compare_frames) diff --git a/tests/vsp-unit-test-0006.sh b/tests/vsp-unit-test-0006.sh index a7daad7..8e6a3fb 100755 --- a/tests/vsp-unit-test-0006.sh +++ b/tests/vsp-unit-test-0006.sh @@ -15,7 +15,7 @@ test_no_rpf() { pipe_configure none format_configure wpf $format 1024x768 0 - $vsp_runner $mdev output 0 $format + vsp_runner wpf.0 # The test always passes if the kernel doesn't crash test_complete pass @@ -27,7 +27,7 @@ test_no_wpf() { pipe_configure none format_configure rpf $format 1024x768 0 - $vsp_runner $mdev input 0 $format + vsp_runner rpf.0 # The test always passes if the kernel doesn't crash test_complete pass diff --git a/tests/vsp-unit-test-0007.sh b/tests/vsp-unit-test-0007.sh index 8d86b66..3f769ab 100755 --- a/tests/vsp-unit-test-0007.sh +++ b/tests/vsp-unit-test-0007.sh @@ -19,9 +19,9 @@ test_bru() { format_configure rpf-bru $format 1024x768 $ninputs for input in `seq 0 1 $((ninputs-1))` ; do - $vsp_runner $mdev input $input $format & + vsp_runner rpf.$input & done - $vsp_runner $mdev output 0 $format + vsp_runner wpf.0 result=$(compare_frames) diff --git a/tests/vsp-unit-test-0008.sh b/tests/vsp-unit-test-0008.sh index ef3e4c2..fb29b8d 100755 --- a/tests/vsp-unit-test-0008.sh +++ b/tests/vsp-unit-test-0008.sh @@ -27,8 +27,8 @@ test_scale() { pipe_configure $pipe format_configure $pipe $format $insize $format $outsize - $vsp_runner $mdev input 0 $format & - $vsp_runner $mdev output 0 $format + vsp_runner rpf.0 & + vsp_runner wpf.0 result=$(compare_frames) diff --git a/tests/vsp-unit-test-0009.sh b/tests/vsp-unit-test-0009.sh index 9741584..395e660 100755 --- a/tests/vsp-unit-test-0009.sh +++ b/tests/vsp-unit-test-0009.sh @@ -19,8 +19,8 @@ test_wpf() { pipe_configure rpf-wpf 0 $wpf format_configure rpf-wpf 0 $wpf $format 1024x768 $format - $vsp_runner $mdev input 0 $format & - $vsp_runner $mdev output $wpf $format + vsp_runner rpf.0 & + vsp_runner wpf.$wpf result=$(compare_frames) |