ZCU106使用VCU TRD的MIPI的例子

作者:付汉杰,hankf@xilinx.com,文章转载自:博客园

在ZCU106上,使用VCU TRD的MIPI的例子,可以从MIPI摄像头采取图像数据,并使用GStreamer推送到HDMI显示器上。

echo -e "\n\nXilinx CSI2 Rx Subsystem Information: "
dmesg | grep -i "Xilinx CSI2 Rx Subsystem"

# echo -e "\n\nv4l2 Device Information: "
# v4l2-ctl --list-devices

echo -e "\n\nFind Media Pipeline: "
for m in /dev/media* ; do echo $m ; media-ctl -p -d $m | grep -B 3 /dev/video1 ; echo '-----------' ; done

echo -e "\n\nDisplay Media Pipeline Information: "
media-ctl -p -d /dev/media7

echo -e "\n\nFind Controls for MIPI CSI-2 RX: "
yavta -l /dev/v4l-subdev8

echo -e "\n\nUpdate Controls for MIPI CSI-2 RX: "
yavta -w '0x0098c981 4' /dev/v4l-subdev8
yavta -l /dev/v4l-subdev8

echo -e "\n\nUpdate the MIPI CSI-2 Rx Pipeline Formats: "
#SONY IMX274 Sensor
# VCU-TRD 2019.2, \"IMX274\":0
# VCU-TRD 2020.1, \"IMX274 3-001a\"
media-ctl -d /dev/media7 -V "\"IMX274\":0 [fmt:SRGGB8_1X8/1920x1080 field:none]"
# VCU-TRD 2020.1, media-ctl -d /dev/media7 -V "\"IMX274 3-001a\":0 [fmt:SRGGB8_1X8/1920x1080 field:none]"
#MIPI CSI2-Rx Subsystem
media-ctl -d /dev/media7 -V "\"a00f0000.mipi_csi2_rx_subsystem\":0 [fmt:SRGGB8_1X8/1920x1080 field:none]"
media-ctl -d /dev/media7 -V "\"a00f0000.mipi_csi2_rx_subsystem\":1 [fmt:SRGGB8_1X8/1920x1080 field:none]"
#Demosaic IP
media-ctl -d /dev/media7 -V "\"a0250000.v_demosaic\":0 [fmt:SRGGB8_1X8/1920x1080 field:none]"
media-ctl -d /dev/media7 -V "\"a0250000.v_demosaic\":1 [fmt:RBG888_1X24/1920x1080 field:none]"
#Gamma LUT IP
media-ctl -d /dev/media7 -V "\"a0270000.v_gamma_lut\":0 [fmt:RBG888_1X24/1920x1080 field:none]"
media-ctl -d /dev/media7 -V "\"a0270000.v_gamma_lut\":1 [fmt:RBG888_1X24/1920x1080 field:none]"
#VPSS: Color Space Conversion (CSC) Only
media-ctl -d /dev/media7 -V "\"a0240000.v_proc_ss\":0 [fmt:RBG888_1X24/1920x1080 field:none]"
media-ctl -d /dev/media7 -V "\"a0240000.v_proc_ss\":1 [fmt:RBG888_1X24/1920x1080 field:none]"
#VPSS: Scaler Only with CSC
media-ctl -d /dev/media7 -V "\"a0200000.v_proc_ss\":0 [fmt:RBG888_1X24/1920x1080 field:none]"
# VCU-TRD 2019.2, Failed to set VYYUYY8_1X24
# VCU-TRD 2020.1, Success to set VYYUYY8_1X24
media-ctl -d /dev/media7 -V "\"a0200000.v_proc_ss\":1 [fmt:VYYUYY8_1X24/1920x1080 field:none]"

echo -e "\nCheck the MIPI CSI-2 Rx Pipeline Formats: "
media-ctl -p -d /dev/media7

echo -e "\n\nFind Controls for CSC: "
yavta -l /dev/v4l-subdev11

echo -e "\nUpdate CSC Settings to improve colors: "
yavta -w '0x0098c9a1 80' /dev/v4l-subdev11
yavta -w '0x0098c9a2 55' /dev/v4l-subdev11
yavta -w '0x0098c9a3 35' /dev/v4l-subdev11
yavta -w '0x0098c9a4 24' /dev/v4l-subdev11
yavta -w '0x0098c9a5 40' /dev/v4l-subdev11

echo -e "\n\nVerify Controls for CSC: "
yavta -l /dev/v4l-subdev11

echo -e "\nList Video Frames format: "
yavta --enum-formats /dev/video1

echo -e "\nUse Yavta to dump frames: "
yavta -n 3 -c10 -f NV12 -s 1920x1080 --skip 7 -F /dev/video1

echo -e "\nCheck and set HDMI Monitor: "
ls -l /dev/dri/by-path/ | grep mix
modetest -D a0070000.v_mix | grep -C8 Connectors
modetest -D a0070000.v_mix -s 41:1920x1080-30@BG24

echo -e "\nUse GStreamer to send the output to HDIM Tx Subsystem for display on HDMI Monitor: "
gst-launch-1.0 v4l2src device=/dev/video1 \
! video/x-raw, width=1920, height=1080, framerate=60/1 ! queue \
! kmssink bus-id=a0070000.v_mix

echo -e "\nDone."

参考文档

Zynq UltraScale+ MPSoC VCU TRD - Debugging - MIPI CSI-2 Rx Capture Pipeline

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/174719104/Zynq+Ult...

推荐阅读