• 编译和运行VCK190 TRD 2022.1


    环境

    参考设计: VCK190 Base TRD 2022.1
    代码: https://github.com/Xilinx/vck190-base-trd
    文档: https://xilinx.github.io/vck190-base-trd/2022.1/html/intro.html
    工具版本: Vivado/Vitis 2022.1, PetaLinux 2022.1
    开发板: VCK190 Production Version

    编译

    OS

    强烈推荐使用Ubuntu 18.04、20.04。
    请按照UG1144要求进行设置,和安装OS的软件包。

    Shell

    使用Bash作为system shell,不使用Dash。也就是“"/bin/sh"”应该指向bash。否则可能遇到错误"/bin/sh: 1: source: not found"。使用命令“sudo dpkg-reconfigure dash”更改。
    更改Shell后,最好清除整个工程,然后从头编译。如果不清除整个工程,可能遇到错误,比如“cp: cannot stat 'aie/ip/libadf.a': No such file or directory”。

    hankf@XSZGS4:vck190-base-trd-hdmirx-xvdpu$ ls -l /bin/sh
    lrwxrwxrwx 1 root root 4 Oct 19  2020 /bin/sh -> dash
    hankf@XSZGS4:vck190-base-trd-hdmirx-xvdpu$  sudo dpkg-reconfigure dash
    [sudo] password for hankf:
    Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
    Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
    Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
    Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash'
    hankf@XSZGS4:vck190-base-trd-hdmirx-xvdpu$ ls -l /bin/sh
    lrwxrwxrwx 1 root root 4 Aug 30 09:03 /bin/sh -> bash
    

    make命令

    不能使用“make all”, 要使用下列命令。

    make platform PFM=vck190_mipiRxSingle_hdmiTx
    make overlay PFM=vck190_mipiRxSingle_hdmiTx OVERLAY=xvdpu
    make sdcard PFM=vck190_mipiRxSingle_hdmiTx OVERLAY=xvdpu
    

    建议使用脚本编译。下面是一个可以使用的脚本。

    #!/bin/sh
    
    # nohup
    
    echo "Begin of script $0... "  2>&1 | tee -a $log_file
    
    date_time=`date +%0m%0d-%0k%0M`
    date && date -u &&  date +%s
    
    hostname=`cat /etc/hostname`
    export platform=vck190_mipiRxSingle_hdmiTx
    export kernel=xvdpu
    export log_file_dir=`pwd`
    export log_file=$log_file_dir/$platform-$kernel-log-$hostname-$date_time.txt
    rm -f $log_file
    echo "log_file: $log_file"
    
    echo "platform: $platform"  2>&1 | tee -a $log_file
    echo "kernel: $kernel"  2>&1 | tee -a $log_file
    export kernel_dir=overlays/$kernel/kernels
    echo "kernel dir: $kernel_dir"  2>&1 | tee -a $log_file
    export kernel_vivado_prj_dir=$kernel_dir/$kernel_combined/_x/link/vivado/vpl/prj/
    echo "kernel vivado prj dir: $kernel_vivado_prj_dir"  2>&1 | tee -a $log_file
    
    #Setup environment on GUUP server.
    # ts 2022.1
    # ts -petalinux 2022.1
    which vivado  2>&1 | tee -a $log_file
    which vitis  2>&1 | tee -a $log_file
    which petalinux-build  2>&1 | tee -a $log_file
    
    vivado_file=`which vivado`
    echo $vivado_file  2>&1 | tee -a $log_file
    if [ "$vivado_file" = "" ]; then
        echo "Setup vivado environment."  2>&1 | tee -a $log_file
        exit
    fi
    
    vitis_file=`which vitis`
    echo $vitis_file  2>&1 | tee -a $log_file
    if [ "$vitis_file" = "" ]; then
        echo "Setup vitis environment."  2>&1 | tee -a $log_file
        exit
    fi
    
    petalinux_build_file=`which petalinux-build`
    echo $petalinux_build_file  2>&1 | tee -a $log_file
    if [ "$petalinux_build_file" = "" ]; then
        echo "Setup petalinux environment."  2>&1 | tee -a $log_file
        exit
    fi
    
    pwd  2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Step 1: clone.... "  2>&1 | tee -a $log_file
    # vck190-base-trd clean repo: 1.8GB
    # git clone failed sometimes. error: 
    # RPC failed; curl 56 GnuTLS recv error
    # git clone --branch 2022.1 --recursive https://github.com/Xilinx/vck190-base-trd.git  2>&1 | tee -a $log_file
    
    # use local copy instead "git clone" 
    echo "Step 1a: copy local repo.... "  2>&1 | tee -a $log_file
    ls -l ../  2>&1 | tee -a $log_file
    ls -l ../vck190-base-trd-orig-0831/  2>&1 | tee -a $log_file
    if [ ! -d ../vck190-base-trd-orig-0831 ]; then 
        echo "No local repo of vck190-base-trd."  2>&1 | tee -a $log_file
        exit	
    fi
    cp -rd ../vck190-base-trd-orig-0831 vck190-base-trd  2>&1 | tee -a $log_file
    ls -l  2>&1 | tee -a $log_file
    du --max-depth=3 -h  2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Enter work dir"   2>&1 | tee -a $log_file
    cd vck190-base-trd
    pwd  2>&1 | tee -a $log_file
    export working_dir=`pwd`
    echo "working_dir: $working_dir"   2>&1 | tee -a $log_file
    ls -l  2>&1 | tee -a $log_file
    
    echo "Step 1b: git clean repo.... "  2>&1 | tee -a $log_file
    git checkout 2022.1
    git clean -xdf   2>&1 | tee -a $log_file
    git checkout .  2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Step 1c: git clean kernels vvas repo.... "  2>&1 | tee -a $log_file
    cd overlays/xvdpu/kernels/vitis_prj/vvas/  2>&1 | tee -a $log_file
    pwd  2>&1 | tee -a $log_file
    git status  2>&1 | tee -a $log_file
    git clean -xdf  2>&1 | tee -a $log_file
    git checkout .  2>&1 | tee -a $log_file
    git status  2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Step 1d: return to dir: $working_dir.... "  2>&1 | tee -a $log_file
    cd $working_dir   2>&1 | tee -a $log_file
    pwd  2>&1 | tee -a $log_file
    git status  2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Step 1e: git pull repo.... "  2>&1 | tee -a $log_file
    # can "git pull" fix "git clone" problem
    git pull | tee -a $log_file
    git fetch --recurse-submodules | tee -a $log_file
    git fetch --recurse-submodules | tee -a $log_file
    git status | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Step 2: build platform.... "  2>&1 | tee -a $log_file
    make platform PFM=$platform  2>&1 | tee -a $log_file
    ls -l  2>&1 | tee -a $log_file
    echo "Step 2b: check platform.... "  2>&1 | tee -a $log_file
    ls -l  platforms/xilinx_$platform_202210_1/ 2>&1 | tee -a $log_file
    echo "Step 2c: check platform IP files.... "  2>&1 | tee -a $log_file
    ls -l  platforms/vivado/ip 2>&1 | tee -a $log_file
    echo "Step 2d: check platform Vivado project.... "  2>&1 | tee -a $log_file
    ls -l  platforms/vivado/$platform/project/ 2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Step 3: build overlay xvdpu.... "  2>&1 | tee -a $log_file
    make overlay PFM=$platform OVERLAY=xvdpu  2>&1 | tee -a $log_file
    ls -l  2>&1 | tee -a $log_file
    echo "Step 3b: check Kernel.... "  2>&1 | tee -a $log_file
    ls -l  $kernel_dir/ 2>&1 | tee -a $log_file
    ls -l  $kernel_dir/*.xsa 2>&1 | tee -a $log_file
    echo "Step 3c: check Kernel Vivado project.... "  2>&1 | tee -a $log_file
    ls -l  $kernel_vivado_prj_dir/ 2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "Step 4: build sdcard xvdpu.... "  2>&1 | tee -a $log_file
    make sdcard PFM=$platform OVERLAY=xvdpu  2>&1 | tee -a $log_file
    ls -l  2>&1 | tee -a $log_file
    echo "Step 4b: Check sdcard image.... "  2>&1 | tee -a $log_file
    ls -l petalinux/xilinx-vck190-base-trd/images/linux/ 2>&1 | tee -a $log_file
    date && date -u &&  date +%s  2>&1 | tee -a $log_file
    
    echo "End of script $0... "  2>&1 | tee -a $log_file
    

    GCC版本

    如果使用Centos 7,自带的GCC版本太低,需要在“petalinux-config”中使能选项"Enable buildtools-extended"。
    Ubuntu 18.04带的是GCC 7.5.0。
    更改GCC后,最好清除整个工程,然后从头编译。如果不清除整个工程,可能遇到错误,比如“ uns_test.c:118:5: error: ‘for’ loop initial declarations are only allowed in C99 mode”。

    Csh shell

    使用Tcsh作为Csh shell。否则会遇到错误"compile_ip.csh Word too long"。命令如下:

    sudo apt-get install tcsh
    sudo update-alternatives --config csh
    

    记录如下:

    hankf@XSZGS4:sxvdpu$ sudo apt-get install tcsh
    [sudo] password for hankf: 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following NEW packages will be installed:
      tcsh
    0 upgraded, 1 newly installed, 0 to remove and 213 not upgraded.
    Need to get 428 kB of archives.
    After this operation, 1,357 kB of additional disk space will be used.
    Get:1 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 tcsh amd64 6.20.00-7 [428 kB]
    Fetched 428 kB in 8s (53.0 kB/s)                                                                                                                                                             
    Selecting previously unselected package tcsh.
    (Reading database ... 658787 files and directories currently installed.)
    Preparing to unpack .../tcsh_6.20.00-7_amd64.deb ...
    Unpacking tcsh (6.20.00-7) ...
    Setting up tcsh (6.20.00-7) ...
    Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
    
    hankf@XSZGS4:sxvdpu$ sudo update-alternatives --config csh
    There are 2 choices for the alternative csh (providing /bin/csh).
    
      Selection    Path            Priority   Status
    ------------------------------------------------------------
    * 0            /bin/bsd-csh     30        auto mode
      1            /bin/bsd-csh     30        manual mode
      2            /bin/tcsh        20        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number: 2
    update-alternatives: using /bin/tcsh to provide /bin/csh (csh) in manual mode
     
    hankf@XSZGS4:sxvdpu$ ls -l /bin/*csh 
    -rwxr-xr-x 1 root root 170456 Sep 21  2019 /bin/bsd-csh
    lrwxrwxrwx 1 root root     21 May 24 17:51 /bin/csh -> /etc/alternatives/csh
    -rwxr-xr-x 1 root root 439544 Feb  9  2017 /bin/tcsh
    
    hankf@XSZGS4:sxvdpu$ ls -l /etc/alternatives/csh
    lrwxrwxrwx 1 root root 9 Sep  6 15:32 /etc/alternatives/csh -> /bin/tcsh
    

    NFS目录

    有些服务器的存储使用NFS实现,导致PetaLinux报告错误“tmp can't be located on nfs.”。一般来说,服务器的目录“/tmp/”还是本地硬盘。使用命令“petalinux-config”, 在“Yocto Setting”中,更改TMPDIR为目录“/tmp/”的一个子目录。

    生成wic映像

    PetaLinux生成wic映像的命令是“petalinux-package --wic”。但是它不会包含额外文件,比如VCKTRD中的kernel文件“binary_container_1.xclbin”。
    如果缺少文件“binary_container_1.xclbin”,运行时会遇到错误“ Check failed: fd_ > 0 (-1 vs. 0) , open(/boot/binary_container_1.xclbin) failed”。

    使用下列命令,能在wic映像文件中包含kernel文件“binary_container_1.xclbin”。

    petalinux-package --wic --bootfiles "BOOT.BIN boot.scr Image ramdisk.cpio.gz.u-boot binary_container_1.xclbin"
    

    运行

    System Contoller 和BoardUI版本

    建议使用最新版本。这次运行使用的是2021.2, 对应的文件是xtp613-vck190-bit-c-2021-2.pdf, rdf0574-vck190-bit-c-2021-2.zip, sc2.2_01.img.zip。

    单板设置

    https://xilinx.github.io/vck190-base-trd/2022.1/html/run/run-setup.html, 完成下列设置

    1. 去掉J326 (7-8) 的跳线帽.
    2. 在BoardUI GUI的“System Contoller”的“Set VADJ”的“Boot Up”里,设置FMC电压是1.2V,而且读回来也要是1.2V。VCK190掉电重启后,读回来也要是1.2V。在使用2020.2的BoardUI版本时,没有读回来电压,应该是没有设置成功,导致后续i2c操作失败,Linux报告错误“imx274_read_mbreg : i2c bulk read failed, 300e (2 bytes)”。

    电脑区域设置

    建议Regional Format使用"Recommended [English (United States)]"。
    电脑是Windows 10 英文版。当Regional Format使用"Chinese [Simplified, Singapore]"时,BoardUI报告执行脚本错误。在目录vck190_bit\BoardUI\tests\VCK190\logs下的log文件中,能找到详细错误“'ascii' codec can't decode byte 0xd6 in position 10”。更改Regional Format设置后,错误消失。

    System Contoller的start_boardframework

    2020.2的start_boardframework的脚本如下

    root@xilinx-vck190-SC-2020_2:~# cat /etc/init.d/start_boardframework.sh
    echo "******************************************************"
    echo "*  Enter these key-sequence to exit Board Framework  *"
    echo "*                                                    *"
    echo "*              EXT<Enter key><Tab key>               *"
    echo "******************************************************"
    nohup /usr/bin/boardframework.sh > /usr/share/BoardFramework/logs/BoardFramework.log
    root@xilinx-vck190-SC-2020_2:~# sed -i -e 's/^#//' /etc/init.d/start_boardframework.sh
    root@xilinx-vck190-SC-2020_2:~# cat /etc/init.d/start_boardframework.sh
    echo "******************************************************"
    echo "*  Enter these key-sequence to exit Board Framework  *"
    echo "*                                                    *"
    echo "*              EXT<Enter key><Tab key>               *"
    echo "******************************************************"
    nohup /usr/bin/boardframework.sh > /usr/share/BoardFramework/logs/BoardFramework.log
    root@xilinx-vck190-SC-2020_2:~# /etc/init.d/start_boardframework.sh
    ******************************************************
    *  Enter these key-sequence to exit Board Framework  *
    *                                                    *
    *              EXT<Enter key><Tab key>               *
    ***************************************************[ 85.14 ]    DONE
    

    测试V4L2设备

    测试V4L2设备的命令如下:

    dmesg | grep -i imx
    
    ls /dev/med*
    media-ctl -p -d /dev/media0
    media-ctl -p -d /dev/media1
    
    media-ctl -d /dev/media1 -V '"IMX274 2-001a":0 [fmt:SRGGB10_1X10/3840x2160@1/60 field:none colorspace:srgb]'
    media-ctl -d /dev/media1 -V "\"IMX274 2-001a\":0 [fmt:SRGGB10_1X10/3840x2160 field:none]"
    media-ctl -d /dev/media1 -V "\"IMX274 2-001a\":0 [fmt:SRGGB10_1X10/3840x2160 field:none]"
    media-ctl -d /dev/media1 -V "\"a4060000.csiss\":0 [fmt:SRGGB10_1X10/3840x2160 field:none]"
    media-ctl -d /dev/media1 -V "\"a40c0000.isp\":0 [fmt:SRGGB10_1X10/3840x2160 field:none]"
    media-ctl -d /dev/media1 -V "\"a40c0000.isp\":1 [fmt:RBG888_1X24/3840x2160 field:none]"
    media-ctl -d /dev/media1 -V "\"a4080000.scaler\":0 [fmt:RBG888_1X24/3840x2160 field:none]"
    media-ctl -d /dev/media1 -V "\"a4080000.scaler\":1 [fmt:UYVY/1920x1080 field:none]"
    
    media-ctl -p -d /dev/media1
    
    ls /dev/v4l*
    
    yavta -l /dev/v4l-subdev1
    
    yavta --enum-formats /dev/video4
    
    yavta -n 3 -c10 -f YUYV -s 1920x1080 --skip 9 -F /dev/video4
    

    测试V4L2设备的记录如下:

    xilinx-vck190-20221:/home/petalinux# media-ctl -d /dev/media1 -V "\"a40c0000.isp\":0 [fmt:SRGGB10_1X10/3840x2160 field:none]"
    xilinx-vck190-20221:/home/petalinux# media-ctl -d /dev/media1 -V "\"a40c0000.isp\":1 [fmt:RBG888_1X24/3840x2160 field:none]"
    xilinx-vck190-20221:/home/petalinux# media-ctl -d /dev/media1 -V "\"a4080000.scaler\":0 [fmt:RBG888_1X24/3840x2160 field:none]"
    xilinx-vck190-20221:/home/petalinux# media-ctl -d /dev/media1 -V "\"a4080000.scaler\":1 [fmt:UYVY/1920x1080 field:none]"
    
    xilinx-vck190-20221:/home/petalinux# media-ctl -p -d /dev/media1
    Media controller API version 5.15.19
    
    Media device information
    ------------------------
    driver          xilinx-video
    model           Xilinx Video Composite Device
    serial
    bus info
    hw revision     0x0
    driver version  5.15.19
    
    Device topology
    - entity 1: vcap_csi output 0 (1 pad, 1 link)
                type Node subtype V4L flags 0
                device node name /dev/video4
            pad0: Sink
                    <- "a4080000.scaler":1 [ENABLED]
    
    - entity 5: IMX274 2-001a (1 pad, 1 link)
                type V4L2 subdev subtype Sensor flags 0
                device node name /dev/v4l-subdev0
            pad0: Source
                    [fmt:SRGGB10_1X10/3840x2160@1/60 field:none
                     crop.bounds:(0,0)/3840x2160
                     crop:(0,0)/3840x2160
                     compose.bounds:(0,0)/3840x2160
                     compose:(0,0)/3840x2160]
                    -> "a4060000.csiss":0 [ENABLED]
    
    - entity 7: a4060000.csiss (2 pads, 2 links)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            pad0: Sink
                    [fmt:SRGGB10_1X10/3840x2160 field:none]
                    <- "IMX274 2-001a":0 [ENABLED]
            pad1: Source
                    [fmt:SRGGB10_1X10/3840x2160 field:none]
                    -> "a40c0000.isp":0 [ENABLED]
    
    - entity 10: a40c0000.isp (2 pads, 2 links)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev2
            pad0: Sink
                    [fmt:SRGGB10_1X10/3840x2160 field:none]
                    <- "a4060000.csiss":1 [ENABLED]
            pad1: Source
                    [fmt:RBG888_1X24/3840x2160 field:none]
                    -> "a4080000.scaler":0 [ENABLED]
    
    - entity 13: a4080000.scaler (2 pads, 2 links)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev3
            pad0: Sink
                    [fmt:RBG888_1X24/3840x2160 field:none]
                    <- "a40c0000.isp":1 [ENABLED]
            pad1: Source
                    [fmt:UYVY8_1X16/1920x1080 field:none]
                    -> "vcap_csi output 0":0 [ENABLED]
    
    xilinx-vck190-20221:/home/petalinux# yavta --enum-formats /dev/video4
    Device /dev/video4 opened.
    Device `vcap_csi output 0' on `platform:vcap_csi:0' is a video output (without mplanes) device.
    - Available formats:
            Format 0: YUYV (56595559)
            Type: Video capture mplanes (9)
            Name: YUYV 4:2:2
    
    Video format: BGR24 (33524742) 3840x2160 field none, 1 planes:
     * Stride 11520, buffer size 24883200
    
    xilinx-vck190-20221:/home/petalinux# yavta -n 3 -c10 -f YUYV -s 1920x1080 --skip 9 -F /dev/video4
    Device /dev/video4 opened.
    Device `vcap_csi output 0' on `platform:vcap_csi:0' is a video output (without mplanes) device.
    Video format set: YUYV (56595559) 1920x1080 field none, 1 planes:
     * Stride 3840, buffer size 4147200
    Video format: YUYV (56595559) 1920x1080 field none, 1 planes:
     * Stride 3840, buffer size 4147200
    3 buffers requested.
    length: 1 offset: 3918719344 timestamp type/source: mono/EoF
    Buffer 0/0 mapped at address 0xffff997ae000.
    length: 1 offset: 3918719344 timestamp type/source: mono/EoF
    Buffer 1/0 mapped at address 0xffff993b9000.
    length: 1 offset: 3918719344 timestamp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xffff98fc4000.
    0 (0) [-] none 0 0 B 1707.959100 1707.959110 25.017 fps ts mono/EoF
    1 (1) [-] none 1 0 B 1707.975763 1707.975772 60.013 fps ts mono/EoF
    2 (2) [-] none 2 0 B 1707.992427 1707.992435 60.010 fps ts mono/EoF
    3 (0) [-] none 3 0 B 1708.009091 1708.009099 60.010 fps ts mono/EoF
    4 (1) [-] none 4 0 B 1708.025755 1708.025763 60.010 fps ts mono/EoF
    5 (2) [-] none 5 0 B 1708.042419 1708.042427 60.010 fps ts mono/EoF
    6 (0) [-] none 6 0 B 1708.059083 1708.059091 60.010 fps ts mono/EoF
    7 (1) [-] none 7 0 B 1708.075747 1708.075755 60.010 fps ts mono/EoF
    8 (2) [-] none 8 0 B 1708.092408 1708.092416 60.020 fps ts mono/EoF
    9 (0) [-] none 9 0 B 1708.109072 1708.109080 60.010 fps ts mono/EoF
    Captured 10 frames in 0.189952 seconds (52.644662 fps, 0.000000 B/s).
    3 buffers released.
    
    xilinx-vck190-20221:/home/petalinux# ls -l
    total 52656
    -rw-r--r-- 1 root root 24883200 Sep  5 23:33 frame-000007.bin
    -rw-r--r-- 1 root root 24883200 Sep  5 23:33 frame-000008.bin
    -rw-r--r-- 1 root root  4147200 Sep  5 23:58 frame-000009.bin
    drwxr-xr-x 2 root root     4096 Sep  5 23:34 gstshark_2022-09-05_23:34:08
    xilinx-vck190-20221:/home/petalinux# mv frame-000009.bin mipi-video4-1920x1080-yuyv.bin.img
    xilinx-vck190-20221:/home/petalinux# rm *.bin
    

    如果使用4K RBG888格式,记录如下:

    xilinx-vck190-20221:/home/petalinux# media-ctl -d /dev/media1 -V "\"a4080000.scaler\":1 [fmt:RBG888_1X24/3840x2160 field:none]"
    
    xilinx-vck190-20221:/home/petalinux# media-ctl -p -d /dev/media1
    Media controller API version 5.15.19
    
    Media device information
    ------------------------
    driver          xilinx-video
    model           Xilinx Video Composite Device
    serial
    bus info
    hw revision     0x0
    driver version  5.15.19
    
    Device topology
    - entity 1: vcap_csi output 0 (1 pad, 1 link)
                type Node subtype V4L flags 0
                device node name /dev/video4
            pad0: Sink
                    <- "a4080000.scaler":1 [ENABLED]
    
    - entity 5: IMX274 2-001a (1 pad, 1 link)
                type V4L2 subdev subtype Sensor flags 0
                device node name /dev/v4l-subdev0
            pad0: Source
                    [fmt:SRGGB10_1X10/3840x2160@1/60 field:none
                     crop.bounds:(0,0)/3840x2160
                     crop:(0,0)/3840x2160
                     compose.bounds:(0,0)/3840x2160
                     compose:(0,0)/3840x2160]
                    -> "a4060000.csiss":0 [ENABLED]
    
    - entity 7: a4060000.csiss (2 pads, 2 links)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            pad0: Sink
                    [fmt:SRGGB10_1X10/3840x2160 field:none]
                    <- "IMX274 2-001a":0 [ENABLED]
            pad1: Source
                    [fmt:SRGGB10_1X10/3840x2160 field:none]
                    -> "a40c0000.isp":0 [ENABLED]
    
    - entity 10: a40c0000.isp (2 pads, 2 links)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev2
            pad0: Sink
                    [fmt:SRGGB10_1X10/3840x2160 field:none]
                    <- "a4060000.csiss":1 [ENABLED]
            pad1: Source
                    [fmt:RBG888_1X24/3840x2160 field:none]
                    -> "a4080000.scaler":0 [ENABLED]
    
    - entity 13: a4080000.scaler (2 pads, 2 links)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev3
            pad0: Sink
                    [fmt:RBG888_1X24/3840x2160 field:none]
                    <- "a40c0000.isp":1 [ENABLED]
            pad1: Source
                    [fmt:RBG888_1X24/3840x2160 field:none]
                    -> "vcap_csi output 0":0 [ENABLED]
    				
    xilinx-vck190-20221:/home/petalinux# yavta --enum-formats /dev/video4
    Device /dev/video4 opened.
    Device `vcap_csi output 0' on `platform:vcap_csi:0' is a video output (without mplanes) device.
    - Available formats:
            Format 0: BGR24 (33524742)
            Type: Video capture mplanes (9)
            Name: 24-bit BGR 8-8-8
    
    Video format: YUYV (56595559) 3840x2160 field none, 1 planes:
     * Stride 7680, buffer size 16588800
     
    xilinx-vck190-20221:/home/petalinux# yavta -n 3 -c10 -f BGR24 -s 3840x2160 --skip 9 -F /dev/video4
    Device /dev/video4 opened.
    Device `vcap_csi output 0' on `platform:vcap_csi:0' is a video output (without mplanes) device.
    Video format set: BGR24 (33524742) 3840x2160 field none, 1 planes:
     * Stride 11520, buffer size 24883200
    Video format: BGR24 (33524742) 3840x2160 field none, 1 planes:
     * Stride 11520, buffer size 24883200
    3 buffers requested.
    length: 1 offset: 3632309920 timestamp type/source: mono/EoF
    Buffer 0/0 mapped at address 0xffff9d5b7000.
    length: 1 offset: 3632309920 timestamp type/source: mono/EoF
    Buffer 1/0 mapped at address 0xffff9bdfc000.
    length: 1 offset: 3632309920 timestamp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xffff9a641000.
    0 (0) [-] none 0 0 B 2113.613175 2113.613185 25.015 fps ts mono/EoF
    1 (1) [-] none 1 0 B 2113.629839 2113.629849 60.010 fps ts mono/EoF
    2 (2) [-] none 2 0 B 2113.646503 2113.646512 60.010 fps ts mono/EoF
    3 (0) [-] none 3 0 B 2113.663167 2113.663175 60.010 fps ts mono/EoF
    4 (1) [-] none 4 0 B 2113.679831 2113.679839 60.010 fps ts mono/EoF
    5 (2) [-] none 5 0 B 2113.696495 2113.696503 60.010 fps ts mono/EoF
    6 (0) [-] none 6 0 B 2113.713159 2113.713167 60.010 fps ts mono/EoF
    7 (1) [-] none 7 0 B 2113.729822 2113.729831 60.013 fps ts mono/EoF
    8 (2) [-] none 8 0 B 2113.746484 2113.746492 60.017 fps ts mono/EoF
    9 (0) [-] none 9 0 B 2113.763147 2113.763155 60.013 fps ts mono/EoF
    Captured 10 frames in 0.189956 seconds (52.643625 fps, 0.000000 B/s).
    3 buffers released.
    xilinx-vck190-20221:/home/petalinux# mv frame-000009.bin mipi-video4-3840x2160-bgr24.bin.img 
    

    上述抓取的图片,可以使用yuvplayer.exe查看。yuvplayer.exe的图标,是地球带手指。

    运行XVDPU

    使用vck190_base_trd_single_xvdpu_2022_1_prebuilt,运行四路XVDPU的记录如下:

    xilinx-vck190-20221:/home/petalinux# smart-mipi-app -s -v -n 4
    gst-launch-1.0 mediasrcbin media-device=/dev/media1 name=channel  channel. ! video/x-raw, width=3840, height=2160, format=BGR, framerate=60/1  ! tee name=t4 ! vvas_xabrscaler xclbin-location=/boot/binary_container_1.xclbin kernel-name="v_multi_scaler:{v_multi_scaler_1}" alpha-r="0" alpha-g="0" alpha-b="0" beta-r="0.25" beta-g="0.25" beta-b="0.25" ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/aiinference.json         ! ima4.sink_master vvas_xmetaaffixer name=ima4 ima4.src_master ! fakesink t4. ! queue ! ima4.sink_slave_0 ima4.src_slave_0         ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/drawresult.json  ! perf !  kmssink driver-name=xlnx plane-id=34 render-rectangle="<0,0,3840,2160>" sync=false
    XAIEFAL: INFO: Resource group Avail is created.
    XAIEFAL: INFO: Resource group Static is created.
    XAIEFAL: INFO: Resource group Generic is created.
    XAIEFAL: INFO: Resource group Avail is created.
    XAIEFAL: INFO: Resource group Static is created.
    XAIEFAL: INFO: Resource group Generic is created.
    ^C
    
    xilinx-vck190-20221:/home/petalinux# smart-mipi-app -s -v -n 4 -p
    gst-launch-1.0 mediasrcbin media-device=/dev/media1 name=channel  channel. ! video/x-raw, width=3840, height=2160, format=BGR, framerate=60/1  ! tee name=t4 ! vvas_xabrscaler xclbin-location=/boot/binary_container_1.xclbin kernel-name="v_multi_scaler:{v_multi_scaler_1}" alpha-r="0" alpha-g="0" alpha-b="0" beta-r="0.25" beta-g="0.25" beta-b="0.25" ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/aiinference.json         ! ima4.sink_master vvas_xmetaaffixer name=ima4 ima4.src_master ! fakesink t4. ! queue ! ima4.sink_slave_0 ima4.src_slave_0         ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/drawresult.json  ! perf !  kmssink driver-name=xlnx plane-id=34 render-rectangle="<0,0,3840,2160>" sync=false
    gst-launch-1.0 mediasrcbin media-device=/dev/media1 name=channel  channel. ! video/x-raw, width=3840, height=2160, format=BGR, framerate=60/1  ! tee name=t4 ! vvas_xabrscaler xclbin-location=/boot/binary_container_1.xclbin kernel-name="v_multi_scaler:{v_multi_scaler_1}" alpha-r="0" alpha-g="0" alpha-b="0" beta-r="0.25" beta-g="0.25" beta-b="0.25" ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/aiinference.json         ! ima4.sink_master vvas_xmetaaffixer name=ima4 ima4.src_master ! fakesink t4. ! queue ! ima4.sink_slave_0 ima4.src_slave_0         ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/drawresult.json  ! perf !  kmssink driver-name=xlnx plane-id=34 render-rectangle="<0,0,3840,2160>" sync=false
    gst-launch-1.0 mediasrcbin media-device=/dev/media1 name=channel  channel. ! video/x-raw, width=3840, height=2160, format=BGR, framerate=60/1  ! tee name=t4 ! vvas_xabrscaler xclbin-location=/boot/binary_container_1.xclbin kernel-name="v_multi_scaler:{v_multi_scaler_1}" alpha-r="0" alpha-g="0" alpha-b="0" beta-r="0.25" beta-g="0.25" beta-b="0.25" ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/aiinference.json         ! ima4.sink_master vvas_xmetaaffixer name=ima4 ima4.src_master ! fakesink t4. ! queue ! ima4.sink_slave_0 ima4.src_slave_0         ! queue ! vvas_xfilter kernels-config=/usr/share/vvas/smart-mipi-app/yolov3/drawresult.json  ! perf !  kmssink driver-name=xlnx plane-id=34 render-rectangle="<0,0,3840,2160>" sync=false
    Setting pipeline to PAUSED ...
    XAIEFAL: INFO: Resource group Avail is created.
    XAIEFAL: INFO: Resource group Static is created.
    XAIEFAL: INFO: Resource group Generic is created.
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    XAIEFAL: INFO: Resource group Avail is created.
    XAIEFAL: INFO: Resource group Static is created.
    XAIEFAL: INFO: Resource group Generic is created.
    INFO:00.0 / 99:99:99.
    perf: perf0; timestamp: 0:58:17.232986432; bps: 0.000; mean_bps: 0.000; fps: 0.000; mean_fps: 0.000
    INFO:01.4 / 99:99:99.
    perf: perf0; timestamp: 0:58:18.252793937; bps: 8979162788.177; mean_bps: 8979162788.177; fps: 45.107; mean_fps: 45.107
    INFO:02.4 / 99:99:99.
    perf: perf0; timestamp: 0:58:19.255023238; bps: 10924254548.411; mean_bps: 9951708668.294; fps: 54.878; mean_fps: 49.992
    INFO:03.5 / 99:99:99.
    perf: perf0; timestamp: 0:58:20.269647703; bps: 11771780015.180; mean_bps: 10558399117.256; fps: 59.135; mean_fps: 53.040
    INFO:04.5 / 99:99:99.
    perf: perf0; timestamp: 0:58:21.269771760; bps: 11942454454.928; mean_bps: 10904412951.674; fps: 59.993; mean_fps: 54.778
    INFO:05.5 / 99:99:99.
    perf: perf0; timestamp: 0:58:22.283548184; bps: 11977987761.925; mean_bps: 11119127913.724; fps: 60.171; mean_fps: 55.857
    0:00:06.2 / 99:99:99.
    

    运行2D Filter

    2D Filter的demo使用了Jupyter Notebooks。打开Jupyter Notebooks后,每个cell前面有“[]”,标识cell还没有运行。每个cell前面有“[]”,标识cell还没有运行。点击 ‘Kernel’ → ‘Restart Kernel and Run All Cells’ 后,cell前面变成“[*]”,表示正在运行。运行完成后,“[]”会多一个数字,如“[1]”、“[2]”,其中的数字表示运行顺序。cell下也可能有运行时的输出信息。

    其它

    如果运行异常,建议检查dmesg,看其中是否有错误。也建议先验证V4L2设备,看其能否采集视频。

  • 相关阅读:
    自动配置原理5
    JSR303数据校验4
    mysql 安装(压缩包安装和exe安装)
    jQuery关于复制(复制隐藏文字+显示文字)跳转,Clipboard
    html页面设置一个跟随鼠标移动的DIV(jQuery实现)
    js中将时间(如:2017-10-8 22:44:55)转化为时间搓,时间戳转为标准格式时间
    异常:java.lang.IllegalArgumentException: Control character in cookie value or attribute.
    从数据库导出数据到excel之List<List<Object>>导出
    从数据库导出数据到excel之List<map>导出
    从数据库导出数据到excel之POI操作
  • 原文地址:https://www.cnblogs.com/hankfu/p/16663061.html
Copyright © 2020-2023  润新知