Skip to contentSkip to conversation

vin-tests: Add D3 Draak support

PATCH Superseded Jacopo Mondi 2 participants 11 messages May 11, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover vin-tests: Add D3 Draak support

Hello Niklas,
this series extends the vin-test suites to allow capture from HDMI
input on D3 Draak board.

I have re-used as much as possible of the existing scripts, but had to extend and generalize some assumptions, as so far Gen3 had only been used and tested with CSI-2 inputs.

To capture from D3:

[root@alarm ~]# ./vin-tests/yavta-hdmi
Board: D3
Board: D3
'adv7612 0-004c':1 -> 'VIN4 output':0 : OKEY - Link set 1
Opening media device /dev/media1
Enumerating entities
looking up device: 81:9
looking up device: 81:10
Found 2 entities
Enumerating pads and links
Setting up format RGB888_1X24 640x480 on pad adv7612 0-004c/1
Format set: RGB888_1X24 640x480
Device /dev/video3 opened.
Device R_Car_VIN' on platform:e6ef4000.video' (driver 'rcar_vin') supports video, capture, without mplanes. Video format set: XBGR32 (34325258) 640x480 (stride 2560) field none buffer size 1228800 Video format: XBGR32 (34325258) 640x480 (stride 2560) field none buffer size 1228800
Device /dev/video3 opened.
Device R_Car_VIN' on platform:e6ef4000.video' (driver 'rcar_vin') supports video, capture, without mplanes. iedeo [fo rma5t5:5 4X.B0GR323 (3453621532]5 8)W 6=4 06x4408 0 ;( st rHi d=e 24560)8 0f
ld none buffer size 1228800
4 buffers requested.
length: 1228800 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xffffaa668000.
length: 1228800 offset: 1228800 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0xffffaa53c000.
length: 1228800 offset: 2457600 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0xffffaa410000.
length: 1228800 offset: 3686400 timestamp type/source: mono/EoF
Buffer 3/0 mapped at address 0xffffaa2e4000.
0 (1) [-] none 0 1228800 B 5554.099816 5554.099894 24.195 fps ts mono/EoF
1 (2) [-] none 1 1228800 B 5554.116503 5554.122945 59.927 fps ts mono/EoF
2 (0) [-] none 2 1228800 B 5554.133188 5554.146213 59.934 fps ts mono/EoF
3 (3) [-] none 3 1228800 B 5554.149875 5554.169601 59.927 fps ts mono/EoF
4 (1) [-] none 5 1228800 B 5554.183247 5554.192933 29.965 fps ts mono/EoF
5 (2) [-] none 6 1228800 B 5554.199918 5554.216359 59.984 fps ts mono/EoF
6 (0) [-] none 8 1228800 B 5554.233291 5554.239657 29.964 fps ts mono/EoF
7 (3) [-] none 9 1228800 B 5554.249975 5554.262959 59.938 fps ts mono/EoF
8 (1) [-] none 10 1228800 B 5554.266665 5554.286175 59.916 fps ts mono/EoF
9 (2) [-] none 12 1228800 B 5554.300167 5554.309427 29.849 fps ts mono/EoF
Captured 10 frames in 0.250941 seconds (39.849961 fps, 48967631.968874 B/s).
4 buffers released.
0

b1d594f1ef685c5dc9a12e2f20f73da1  /tmp/vin-tests/frame-000000.bin
70eab01ac30be086e3c26001b8c8d018  /tmp/vin-tests/frame-000001.bin
b43d9423a64ace2627b585ba855e2ae5  /tmp/vin-tests/frame-000002.bin
b43d9423a64ace2627b585ba855e2ae5  /tmp/vin-tests/frame-000003.bin
25528dc1bf8677435cbc19d46c712fad  /tmp/vin-tests/frame-000004.bin
b43d9423a64ace2627b585ba855e2ae5  /tmp/vin-tests/frame-000005.bin
b43d9423a64ace2627b585ba855e2ae5  /tmp/vin-tests/frame-000006.bin
b43d9423a64ace2627b585ba855e2ae5  /tmp/vin-tests/frame-000007.bin
25528dc1bf8677435cbc19d46c712fad  /tmp/vin-tests/frame-000008.bin
b43d9423a64ace2627b585ba855e2ae5  /tmp/vin-tests/frame-000009.bin

0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000000.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000001.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000002.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000003.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000004.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000005.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000006.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000007.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000008.pnm'...
0 padding bytes detected at end of line
Image size: 640x480, bytes per pixel: 32, format: BGR32 (32 BGR-8-8-8-8) Writing to file `/tmp/vin-tests/frame-000009.pnm'...

Thanks
j

Jacopo Mondi (5):
boards: Add R8A77995 D3 Draak board
vin-tests: Add function to propagate digital format
gen3-links: Support linking for digital input
yavta-hdmi: Generalize capture parameters
convert: Accept destination format as parameter

 convert.sh           |  3 ++-
 gen3-links.sh        | 14 ++++++++++----
 scripts/boards.sh    | 31 +++++++++++++++++++++++++++++++
 scripts/vin-tests.sh |  9 +++++++++
 yavta-hdmi           |  6 +++---
 5 files changed, 55 insertions(+), 8 deletions(-)

--
2.7.4

#1 lore raw

PATCH 1/5 boards: Add R8A77995 D3 Draak board

Add support for R-Car Gen3 Draak board based on R8A77995 SoC. Define additional variables such as which vin should be used to perform capture operations and which is the destination image format for each board. These variables will be used later to generalize the image scripts.

---
 scripts/boards.sh | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
scripts/boards.sh +31 -0
index e078ba5..f265463 100644
@@ -16,6 +16,8 @@ case $info in
         vin6=$(basename /sys/devices/platform/soc/e6ef6000.video/video4linux/video*)
         vin7=$(basename /sys/devices/platform/soc/e6ef7000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -35,6 +37,8 @@ case $info in
 
         txaname="adv748x 4-0070 txa"
         txbname="adv748x 4-0070 txb"
+
+        convert_format="RGB565"
         ;;
 
     "Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+")
@@ -50,6 +54,8 @@ case $info in
         vin6=$(basename /sys/devices/platform/soc/e6ef6000.video/video4linux/video*)
         vin7=$(basename /sys/devices/platform/soc/e6ef7000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -68,6 +74,8 @@ case $info in
 
         txaname="adv748x 4-0070 txa"
         txbname="adv748x 4-0070 txb"
+
+        convert_format="RGB565"
         ;;
 
     "Renesas Salvator-X board based on r8a7796")
@@ -82,6 +90,8 @@ case $info in
         vin6=$(basename /sys/devices/platform/soc/e6ef6000.video/video4linux/video*)
         vin7=$(basename /sys/devices/platform/soc/e6ef7000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -99,6 +109,8 @@ case $info in
 
         txaname="adv748x 4-0070 txa"
         txbname="adv748x 4-0070 txb"
+
+        convert_format="RGB565"
         ;;
 
     "Renesas Eagle board based on r8a77970")
@@ -109,6 +121,8 @@ case $info in
         vin2=$(basename /sys/devices/platform/soc/e6ef2000.video/video4linux/video*)
         vin3=$(basename /sys/devices/platform/soc/e6ef3000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -121,6 +135,23 @@ case $info in
 
         txaname="adv748x 0-0070 txa"
         txbname="adv748x 0-0070 txb"
+
+        convert_format="RGB565"
+        ;;
+
+    "Renesas Draak board based on r8a77995")
+        echo "Board: D3"
+        gen="gen3"
+        digital=1
+        vin4=$(basename /sys/devices/platform/soc/e6ef4000.video/video4linux/video*)
+
+        capture_vin="${vin4}"
+
+        vinname4="VIN4 output"
+
+        hdminame="adv7612 0-004c"
+
+        convert_format="BGR32"
         ;;
 
     "Koelsch")
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/5] boards: Add R8A77995 D3 Draak board

Hi Jacopo,

Thanks for your patch.

Quoted 16 lines · Jacopo Mondi

Add support for R-Car Gen3 Draak board based on R8A77995 SoC. Define additional variables such as which vin should be used to perform capture operations and which is the destination image format for each board. These variables will be used later to generalize the image scripts.

---
 scripts/boards.sh | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
scripts/boards.sh +0 -0
index e078ba5..f265463 100644

scripts/boards.sh case $info in · line 20

Quoted 5 lines
scripts/boards.sh +2 -0
@@ -16,6 +16,8 @@ case $info in
         vin6=$(basename /sys/devices/platform/soc/e6ef6000.video/video4linux/video*)
         vin7=$(basename /sys/devices/platform/soc/e6ef7000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+

I don't like this I'm afraid :-(

I think if there is a need to switch which VIN is used to capture from it should be an argument to the capture function and not a variable in board.sh.

Quoted 84 lines
scripts/boards.sh +29 -0
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -35,6 +37,8 @@ case $info in
 
         txaname="adv748x 4-0070 txa"
         txbname="adv748x 4-0070 txb"
+
+        convert_format="RGB565"
         ;;
 
     "Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+")
@@ -50,6 +54,8 @@ case $info in
         vin6=$(basename /sys/devices/platform/soc/e6ef6000.video/video4linux/video*)
         vin7=$(basename /sys/devices/platform/soc/e6ef7000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -68,6 +74,8 @@ case $info in
 
         txaname="adv748x 4-0070 txa"
         txbname="adv748x 4-0070 txb"
+
+        convert_format="RGB565"
         ;;
 
     "Renesas Salvator-X board based on r8a7796")
@@ -82,6 +90,8 @@ case $info in
         vin6=$(basename /sys/devices/platform/soc/e6ef6000.video/video4linux/video*)
         vin7=$(basename /sys/devices/platform/soc/e6ef7000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -99,6 +109,8 @@ case $info in
 
         txaname="adv748x 4-0070 txa"
         txbname="adv748x 4-0070 txb"
+
+        convert_format="RGB565"
         ;;
 
     "Renesas Eagle board based on r8a77970")
@@ -109,6 +121,8 @@ case $info in
         vin2=$(basename /sys/devices/platform/soc/e6ef2000.video/video4linux/video*)
         vin3=$(basename /sys/devices/platform/soc/e6ef3000.video/video4linux/video*)
 
+        capture_vin="${vin0}"
+
         vinname0="VIN0 output"
         vinname1="VIN1 output"
         vinname2="VIN2 output"
@@ -121,6 +135,23 @@ case $info in
 
         txaname="adv748x 0-0070 txa"
         txbname="adv748x 0-0070 txb"
+
+        convert_format="RGB565"
+        ;;
+
+    "Renesas Draak board based on r8a77995")
+        echo "Board: D3"
+        gen="gen3"
+        digital=1
+        vin4=$(basename /sys/devices/platform/soc/e6ef4000.video/video4linux/video*)
+
+        capture_vin="${vin4}"
+
+        vinname4="VIN4 output"
+
+        hdminame="adv7612 0-004c"
+
+        convert_format="BGR32"
         ;;
 
     "Koelsch")
Signature · 1 line
2.7.4
Signature · 2 lines
Regards,
Niklas S�derlund
#3 lore raw

PATCH 2/5 vin-tests: Add function to propagate digital format

In reply to Jacopo Mondi

Add function to vin-tests.sh to propagate the HDMI format for the digital input use case. This is useful for D3 when capturing HDMI input from adv7612 at 640x480 resolution.

---
 scripts/vin-tests.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/vin-tests.sh +9 -0
index 4a38d43..52e25b9 100644
@@ -206,3 +206,12 @@ mc_propagate_cvbs() {
 
     mc_propagate_format "$cvbsname" 8 "$txbname" 0 "$csi20name" 1 "$vin"
 }
+
+# HDMI input from ADV7612 (D3 Draak)
+mc_propagate_hdmi_digital() {
+    vin="$1"
+    vdev=$($mediactl -d $mdev -e "$vin" )
+
+    media-ctl -v -d $mdev -V "'$hdminame':1 [fmt:RGB888_1X24/640x480 field:none]"
+    yavta -f XBGR32 -s 640x480 --field none $vdev
+}
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH 2/5] vin-tests: Add function to propagate digital format

Hi Jacopo,

Thanks for your patch,

Quoted 3 lines · Jacopo Mondi

Add function to vin-tests.sh to propagate the HDMI format for the digital input use case. This is useful for D3 when capturing HDMI input from adv7612 at 640x480 resolution.

Why is there a need to hard code the HDMI capture format? Can't the existing propagate functions which checks the format of the video source be extended to support the parallel capture tests?

Quoted 26 lines
---
 scripts/vin-tests.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/vin-tests.sh +9 -0
index 4a38d43..52e25b9 100644
@@ -206,3 +206,12 @@ mc_propagate_cvbs() {
 
     mc_propagate_format "$cvbsname" 8 "$txbname" 0 "$csi20name" 1 "$vin"
 }
+
+# HDMI input from ADV7612 (D3 Draak)
+mc_propagate_hdmi_digital() {
+    vin="$1"
+    vdev=$($mediactl -d $mdev -e "$vin" )
+
+    media-ctl -v -d $mdev -V "'$hdminame':1 [fmt:RGB888_1X24/640x480 field:none]"
+    yavta -f XBGR32 -s 640x480 --field none $vdev
+}
Signature · 1 line
2.7.4
Signature · 2 lines
Regards,
Niklas S�derlund
#5 lore raw

PATCH 3/5 gen3-links: Support linking for digital input

In reply to Jacopo Mondi

Add support for linking the digital subdevice to a vin instance. This is useful for D3 board.

---
 gen3-links.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
gen3-links.sh +10 -4
index cfcdeb7..0ec30e4 100755
@@ -8,8 +8,14 @@ source $base/scripts/vin-tests.sh
 source $base/scripts/boards.sh
 
 mc_reset
-mc_set_link "$csi40name" 1 "$vinname0" 1
-mc_set_link "$csi20name" 1 "$vinname1" 1
 
-mc_propagate_hdmi "$vinname0"
-mc_propagate_cvbs "$vinname1"
+if [[ $digital -eq 1 ]]; then
+	mc_set_link "$hdminame" 1  "$vinname4" 1
+	mc_propagate_hdmi_digital "$vinname4"
+else
+	mc_set_link "$csi40name" 1 "$vinname0" 1
+	mc_set_link "$csi20name" 1 "$vinname1" 1
+
+	mc_propagate_hdmi "$vinname0"
+	mc_propagate_cvbs "$vinname1"
+fi
Signature · 1 line
2.7.4
Acked-by Niklas S�derlund on v1 3/5
#6 lore raw

Re: [PATCH 3/5] gen3-links: Support linking for digital input

Hi Jacopo,

Quoted 4 lines · Jacopo Mondi

Add support for linking the digital subdevice to a vin instance. This is useful for D3 board.

As you might have noticed the vin-tests are in need of a big rework. But for now I'm happy with the digital property in board.sh. Or maybe we should start the renaming process of s/digital/parallel/ as it was a really bad name on my behalf to begin with. In any case.

Quoted 30 lines
---
 gen3-links.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
gen3-links.sh +10 -4
index cfcdeb7..0ec30e4 100755
@@ -8,8 +8,14 @@ source $base/scripts/vin-tests.sh
 source $base/scripts/boards.sh
 
 mc_reset
-mc_set_link "$csi40name" 1 "$vinname0" 1
-mc_set_link "$csi20name" 1 "$vinname1" 1
 
-mc_propagate_hdmi "$vinname0"
-mc_propagate_cvbs "$vinname1"
+if [[ $digital -eq 1 ]]; then
+	mc_set_link "$hdminame" 1  "$vinname4" 1
+	mc_propagate_hdmi_digital "$vinname4"
+else
+	mc_set_link "$csi40name" 1 "$vinname0" 1
+	mc_set_link "$csi20name" 1 "$vinname1" 1
+
+	mc_propagate_hdmi "$vinname0"
+	mc_propagate_cvbs "$vinname1"
+fi
Signature · 1 line
2.7.4
Signature · 2 lines
Regards,
Niklas S�derlund
#7 lore raw

PATCH 4/5 yavta-hdmi: Generalize capture parameters

In reply to Jacopo Mondi

Use the newly defined ${capture_vin} and ${convert_format} to generalize capture operations from HDMI sources.

---
 yavta-hdmi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
yavta-hdmi +3 -3
index a0a09a3..5806a0d 100755
@@ -11,10 +11,10 @@ out=/tmp/vin-tests
 rm -fr $out
 mkdir -p $out
 
-size=$(v4l2-ctl --all -d /dev/$vin0  | awk '/Width/{print $3}' | tr '/' 'x')
+size=$(v4l2-ctl --all -d /dev/$capture_vin  | awk '/Width/{print $3}' | tr '/' 'x')
 
-yavta -n 4 --capture=10 /dev/$vin0 --file=$out/frame-#.bin $*
+yavta -n 4 --capture=10 /dev/$capture_vin --file=$out/frame-#.bin $*
 
 strings $out/frame*.bin | head | wc -l
 md5sum $out/frame*.bin
-for f in $out/frame*.bin ; do $base/convert.sh $f $size ; done;
+for f in $out/frame*.bin ; do $base/convert.sh $f $size $convert_format; done;
Signature · 1 line
2.7.4
Acked-by Niklas S�derlund on v1 4/5
#8 lore raw

Re: [PATCH 4/5] yavta-hdmi: Generalize capture parameters

Hi Jacopo,

Thanks for your work.

Quoted 16 lines · Jacopo Mondi

Use the newly defined ${capture_vin} and ${convert_format} to generalize capture operations from HDMI sources.

---
 yavta-hdmi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
yavta-hdmi +0 -0
index a0a09a3..5806a0d 100755
@@ -11,10 +11,10 @@ out=/tmp/vin-tests
 rm -fr $out
 mkdir -p $out
 

yavta-hdmi out=/tmp/vin-tests · line 20

Quoted 10 lines
yavta-hdmi +3 -3
-size=$(v4l2-ctl --all -d /dev/$vin0  | awk '/Width/{print $3}' | tr '/' 'x')
+size=$(v4l2-ctl --all -d /dev/$capture_vin  | awk '/Width/{print $3}' | tr '/' 'x')
 
-yavta -n 4 --capture=10 /dev/$vin0 --file=$out/frame-#.bin $*
+yavta -n 4 --capture=10 /dev/$capture_vin --file=$out/frame-#.bin $*
 
 strings $out/frame*.bin | head | wc -l
 md5sum $out/frame*.bin
-for f in $out/frame*.bin ; do $base/convert.sh $f $size ; done;
+for f in $out/frame*.bin ; do $base/convert.sh $f $size $convert_format; done;

As stated before I don't like that $convert_format comes from board.sh but that it can be provided to convert.sh I do like.

Quoted 3 lines
Signature · 1 line
2.7.4
Signature · 2 lines
Regards,
Niklas S�derlund
#9 lore raw

PATCH 5/5 convert: Accept destination format as parameter

In reply to Jacopo Mondi

Accept the destination image format as thrid parameter of the convert function.

---
 convert.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
convert.sh +2 -1
index 4059868..878ac63 100755
@@ -2,6 +2,7 @@
 
 F=$(dirname $1)/$(basename $1 .bin)
 FRAME_SIZE=${2:-1280x720}
+FORMAT=${3:-RGB565}
 
-raw2rgbpnm -f RGB565 -s $FRAME_SIZE $F.bin $F.pnm
+raw2rgbpnm -f $FORMAT -s $FRAME_SIZE $F.bin $F.pnm
 convert $F.pnm $F.png
Signature · 1 line
2.7.4
Acked-by Niklas S�derlund on v1 5/5
#10 lore raw

Re: [PATCH 5/5] convert: Accept destination format as parameter

Hi Jacopo,

Thanks for your work.

Quoted 4 lines · Jacopo Mondi

Accept the destination image format as thrid parameter of the convert function.

Quoted 20 lines
---
 convert.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
convert.sh +2 -1
index 4059868..878ac63 100755
@@ -2,6 +2,7 @@
 
 F=$(dirname $1)/$(basename $1 .bin)
 FRAME_SIZE=${2:-1280x720}
+FORMAT=${3:-RGB565}
 
-raw2rgbpnm -f RGB565 -s $FRAME_SIZE $F.bin $F.pnm
+raw2rgbpnm -f $FORMAT -s $FRAME_SIZE $F.bin $F.pnm
 convert $F.pnm $F.png
Signature · 1 line
2.7.4
Signature · 2 lines
Regards,
Niklas S�derlund