linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vin-tests: Add capture script for RDACM21
@ 2020-09-16 15:55 Jacopo Mondi
  2020-09-18 13:03 ` Kieran Bingham
  0 siblings, 1 reply; 3+ messages in thread
From: Jacopo Mondi @ 2020-09-16 15:55 UTC (permalink / raw)
  To: Niklas Söderlund; +Cc: Jacopo Mondi, linux-renesas-soc

Add script to capture from RDACM21 on Eagle V3-M.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 gmsl-rdacm21-yavta.sh | 104 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100755 gmsl-rdacm21-yavta.sh

diff --git a/gmsl-rdacm21-yavta.sh b/gmsl-rdacm21-yavta.sh
new file mode 100755
index 0000000..36ba024
--- /dev/null
+++ b/gmsl-rdacm21-yavta.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+base=$(dirname $(readlink -f $0))
+
+source $base/scripts/vin-tests.sh
+source $base/scripts/boards.sh
+
+mdev=$(mc_get_mdev)
+
+out=$base/output
+rm -fr $out
+mkdir $out
+
+function conf() {
+    CSI="$1"
+    IDX="$2"
+    VIN="$3"
+
+    media-ctl -d $mdev -V "'$CSI':$IDX [fmt:YUYV8_1X16/1280x1080 field:none]"
+    mc_set_link "$CSI" $IDX "$VIN" 1
+}
+
+function conf_gmsl() {
+	set -x
+	MAX9286="max9286 3-0048"
+
+    for pad in `seq 0 3`; do
+		media-ctl -d $mdev -V "'$MAX9286':$pad [fmt:YUYV8_1X16/1280x1080 field:none colorspace:srgb xfer:none ycbcr:601 quantization:full-range]"
+	done
+
+	set +x
+}
+
+function capture() {
+    VID="$1"
+    vid=$(eval echo \$$VID)
+    echo $vid
+
+    yavta -f YUYV -s 1280x1080 -c10 --skip 7 --file="$out/$VID-#.bin" /dev/$vid &
+}
+
+mc_reset
+
+# Need to configure all formats going through each MAX9286
+conf1234=0
+conf5678=0
+
+for cam in "$@"; do
+	case $cam in
+        1|2|3|4)
+            if [[ $conf1234 -ne 1 ]]; then
+                conf  "$csi40name" 1 "$vinname0"
+                conf  "$csi40name" 2 "$vinname1"
+                conf  "$csi40name" 3 "$vinname2"
+                conf  "$csi40name" 4 "$vinname3"
+                conf1234=1
+            fi
+            ;;
+        5|6|7|8)
+            if [[ $conf5678 -ne 1 ]]; then
+                conf  "$csi41name" 1 "$vinname4"
+                conf  "$csi41name" 2 "$vinname5"
+                conf  "$csi41name" 3 "$vinname6"
+                conf  "$csi41name" 4 "$vinname7"
+                conf5678=1
+            fi
+            ;;
+	    *)
+		echo "Unrecognised camera $cam"
+		;;
+	esac
+done
+
+conf_gmsl
+
+for cam in "$@"
+do
+	echo "Capturing camera $cam"
+	case $cam in
+	    1)	capture vin0 ;;
+	    2)	capture vin1 ;;
+	    3)	capture vin2 ;;
+	    4)	capture vin3 ;;
+
+	    5)	capture vin4 ;;
+	    6)	capture vin5 ;;
+	    7)	capture vin6 ;;
+	    8)	capture vin7 ;;
+
+	    *)
+		echo "Unrecognised camera $cam"
+		;;
+	esac
+done;
+
+wait
+
+for f in $out/*bin; do
+    name=$(basename $f .bin)
+    raw2rgbpnm -f YUYV -s 1280x1080 $out/$name.bin $out/$name.ppm
+    convert $out/$name.ppm $out/$name.png
+done
+
+convert $out/vin*-000007.png -background white -append $out/collage.png
--
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vin-tests: Add capture script for RDACM21
  2020-09-16 15:55 [PATCH] vin-tests: Add capture script for RDACM21 Jacopo Mondi
@ 2020-09-18 13:03 ` Kieran Bingham
  2020-10-15 23:32   ` Niklas Söderlund
  0 siblings, 1 reply; 3+ messages in thread
From: Kieran Bingham @ 2020-09-18 13:03 UTC (permalink / raw)
  To: Jacopo Mondi, Niklas Söderlund; +Cc: linux-renesas-soc

Hi Jacopo,

On 16/09/2020 16:55, Jacopo Mondi wrote:
> Add script to capture from RDACM21 on Eagle V3-M.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Can we make this generic in any way with-in gmsl-yavta.sh?

Am I right in thinking only the frame size has changed in this script
against the original?

Perhaps can we read the configuration of the sensor and just propagate
it forwards?

--
Kieran


> ---
>  gmsl-rdacm21-yavta.sh | 104 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 104 insertions(+)
>  create mode 100755 gmsl-rdacm21-yavta.sh
> 
> diff --git a/gmsl-rdacm21-yavta.sh b/gmsl-rdacm21-yavta.sh
> new file mode 100755
> index 0000000..36ba024
> --- /dev/null
> +++ b/gmsl-rdacm21-yavta.sh
> @@ -0,0 +1,104 @@
> +#!/bin/bash
> +
> +base=$(dirname $(readlink -f $0))
> +
> +source $base/scripts/vin-tests.sh
> +source $base/scripts/boards.sh
> +
> +mdev=$(mc_get_mdev)
> +
> +out=$base/output
> +rm -fr $out
> +mkdir $out
> +
> +function conf() {
> +    CSI="$1"
> +    IDX="$2"
> +    VIN="$3"
> +
> +    media-ctl -d $mdev -V "'$CSI':$IDX [fmt:YUYV8_1X16/1280x1080 field:none]"
> +    mc_set_link "$CSI" $IDX "$VIN" 1
> +}
> +
> +function conf_gmsl() {
> +	set -x
> +	MAX9286="max9286 3-0048"
> +
> +    for pad in `seq 0 3`; do
> +		media-ctl -d $mdev -V "'$MAX9286':$pad [fmt:YUYV8_1X16/1280x1080 field:none colorspace:srgb xfer:none ycbcr:601 quantization:full-range]"
> +	done
> +
> +	set +x
> +}
> +
> +function capture() {
> +    VID="$1"
> +    vid=$(eval echo \$$VID)
> +    echo $vid
> +
> +    yavta -f YUYV -s 1280x1080 -c10 --skip 7 --file="$out/$VID-#.bin" /dev/$vid &
> +}
> +
> +mc_reset
> +
> +# Need to configure all formats going through each MAX9286
> +conf1234=0
> +conf5678=0
> +
> +for cam in "$@"; do
> +	case $cam in
> +        1|2|3|4)
> +            if [[ $conf1234 -ne 1 ]]; then
> +                conf  "$csi40name" 1 "$vinname0"
> +                conf  "$csi40name" 2 "$vinname1"
> +                conf  "$csi40name" 3 "$vinname2"
> +                conf  "$csi40name" 4 "$vinname3"
> +                conf1234=1
> +            fi
> +            ;;
> +        5|6|7|8)
> +            if [[ $conf5678 -ne 1 ]]; then
> +                conf  "$csi41name" 1 "$vinname4"
> +                conf  "$csi41name" 2 "$vinname5"
> +                conf  "$csi41name" 3 "$vinname6"
> +                conf  "$csi41name" 4 "$vinname7"
> +                conf5678=1
> +            fi
> +            ;;
> +	    *)
> +		echo "Unrecognised camera $cam"
> +		;;
> +	esac
> +done
> +
> +conf_gmsl
> +
> +for cam in "$@"
> +do
> +	echo "Capturing camera $cam"
> +	case $cam in
> +	    1)	capture vin0 ;;
> +	    2)	capture vin1 ;;
> +	    3)	capture vin2 ;;
> +	    4)	capture vin3 ;;
> +
> +	    5)	capture vin4 ;;
> +	    6)	capture vin5 ;;
> +	    7)	capture vin6 ;;
> +	    8)	capture vin7 ;;
> +
> +	    *)
> +		echo "Unrecognised camera $cam"
> +		;;
> +	esac
> +done;
> +
> +wait
> +
> +for f in $out/*bin; do
> +    name=$(basename $f .bin)
> +    raw2rgbpnm -f YUYV -s 1280x1080 $out/$name.bin $out/$name.ppm
> +    convert $out/$name.ppm $out/$name.png
> +done
> +
> +convert $out/vin*-000007.png -background white -append $out/collage.png
> --
> 2.28.0
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vin-tests: Add capture script for RDACM21
  2020-09-18 13:03 ` Kieran Bingham
@ 2020-10-15 23:32   ` Niklas Söderlund
  0 siblings, 0 replies; 3+ messages in thread
From: Niklas Söderlund @ 2020-10-15 23:32 UTC (permalink / raw)
  To: Kieran Bingham; +Cc: Jacopo Mondi, linux-renesas-soc

Hi Jacopo, Kieran,

On 2020-09-18 14:03:51 +0100, Kieran Bingham wrote:
> Hi Jacopo,
> 
> On 16/09/2020 16:55, Jacopo Mondi wrote:
> > Add script to capture from RDACM21 on Eagle V3-M.
> > 
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> Can we make this generic in any way with-in gmsl-yavta.sh?
> 
> Am I right in thinking only the frame size has changed in this script
> against the original?
> 
> Perhaps can we read the configuration of the sensor and just propagate
> it forwards?

It has long been in my list to rewrite this ugly hack (all of vin-tests) 
with something more competent, maybe something in python? I'm not sure 
when I would find the time tho. Maybe we could do it in steps and have 
something generate a configuration.sh file that is sourced instead 
boards.sh to setup the local environment?

If anyone plans to  work on something like this please let me know. I'm 
also fine accumulating on helper scripts like this in vin-tests as I 
think it brings value in documenting our test setups and what needs to 
be considered if/when something more modular is built to replace it.

> 
> --
> Kieran
> 
> 
> > ---
> >  gmsl-rdacm21-yavta.sh | 104 ++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 104 insertions(+)
> >  create mode 100755 gmsl-rdacm21-yavta.sh
> > 
> > diff --git a/gmsl-rdacm21-yavta.sh b/gmsl-rdacm21-yavta.sh
> > new file mode 100755
> > index 0000000..36ba024
> > --- /dev/null
> > +++ b/gmsl-rdacm21-yavta.sh
> > @@ -0,0 +1,104 @@
> > +#!/bin/bash
> > +
> > +base=$(dirname $(readlink -f $0))
> > +
> > +source $base/scripts/vin-tests.sh
> > +source $base/scripts/boards.sh
> > +
> > +mdev=$(mc_get_mdev)
> > +
> > +out=$base/output
> > +rm -fr $out
> > +mkdir $out
> > +
> > +function conf() {
> > +    CSI="$1"
> > +    IDX="$2"
> > +    VIN="$3"
> > +
> > +    media-ctl -d $mdev -V "'$CSI':$IDX [fmt:YUYV8_1X16/1280x1080 field:none]"
> > +    mc_set_link "$CSI" $IDX "$VIN" 1
> > +}
> > +
> > +function conf_gmsl() {
> > +	set -x
> > +	MAX9286="max9286 3-0048"
> > +
> > +    for pad in `seq 0 3`; do
> > +		media-ctl -d $mdev -V "'$MAX9286':$pad [fmt:YUYV8_1X16/1280x1080 field:none colorspace:srgb xfer:none ycbcr:601 quantization:full-range]"
> > +	done
> > +
> > +	set +x
> > +}
> > +
> > +function capture() {
> > +    VID="$1"
> > +    vid=$(eval echo \$$VID)
> > +    echo $vid
> > +
> > +    yavta -f YUYV -s 1280x1080 -c10 --skip 7 --file="$out/$VID-#.bin" /dev/$vid &
> > +}
> > +
> > +mc_reset
> > +
> > +# Need to configure all formats going through each MAX9286
> > +conf1234=0
> > +conf5678=0
> > +
> > +for cam in "$@"; do
> > +	case $cam in
> > +        1|2|3|4)
> > +            if [[ $conf1234 -ne 1 ]]; then
> > +                conf  "$csi40name" 1 "$vinname0"
> > +                conf  "$csi40name" 2 "$vinname1"
> > +                conf  "$csi40name" 3 "$vinname2"
> > +                conf  "$csi40name" 4 "$vinname3"
> > +                conf1234=1
> > +            fi
> > +            ;;
> > +        5|6|7|8)
> > +            if [[ $conf5678 -ne 1 ]]; then
> > +                conf  "$csi41name" 1 "$vinname4"
> > +                conf  "$csi41name" 2 "$vinname5"
> > +                conf  "$csi41name" 3 "$vinname6"
> > +                conf  "$csi41name" 4 "$vinname7"
> > +                conf5678=1
> > +            fi
> > +            ;;
> > +	    *)
> > +		echo "Unrecognised camera $cam"
> > +		;;
> > +	esac
> > +done
> > +
> > +conf_gmsl
> > +
> > +for cam in "$@"
> > +do
> > +	echo "Capturing camera $cam"
> > +	case $cam in
> > +	    1)	capture vin0 ;;
> > +	    2)	capture vin1 ;;
> > +	    3)	capture vin2 ;;
> > +	    4)	capture vin3 ;;
> > +
> > +	    5)	capture vin4 ;;
> > +	    6)	capture vin5 ;;
> > +	    7)	capture vin6 ;;
> > +	    8)	capture vin7 ;;
> > +
> > +	    *)
> > +		echo "Unrecognised camera $cam"
> > +		;;
> > +	esac
> > +done;
> > +
> > +wait
> > +
> > +for f in $out/*bin; do
> > +    name=$(basename $f .bin)
> > +    raw2rgbpnm -f YUYV -s 1280x1080 $out/$name.bin $out/$name.ppm
> > +    convert $out/$name.ppm $out/$name.png
> > +done
> > +
> > +convert $out/vin*-000007.png -background white -append $out/collage.png
> > --
> > 2.28.0
> > 
> 

-- 
Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-15 23:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 15:55 [PATCH] vin-tests: Add capture script for RDACM21 Jacopo Mondi
2020-09-18 13:03 ` Kieran Bingham
2020-10-15 23:32   ` Niklas Söderlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).