zoukankan      html  css  js  c++  java
  • 【分享】修改V4L2的Video Pipeline的devicetree

    介绍

    PetaLinux 能够根据Vivado的设计,自动生成V4L2的Video Pipeline的devicetree。但是它主要为Xilinx的VCU TRD服务,测试的组合比较少。很多时候,需要根据自己的工程,修改V4L2的Video Pipeline的devicetree。

    硬件设计

    有项目需要对输入的视频,既需要对原始视频做编解码,也需要缩放后再做编解码。于是创建了下面的硬件设计。
    V4L2硬件设计

    axis_data_fifo主要用于暂时缓存数据。axis_broadcaster和vpss之间的axis_data_fifo、axis_register_slice,可以删除,完全不影响共。

    两个framebuffer_write的tready通过逻辑门的“或”操作,连接到了一起,再连接到前级axis_register_slice的输入,保证只要有一个framebuffer_write在工作,前面的模块就能向后输出数据。

    devicetree

    对于上述的硬件设计,对应的V4L2的devicetree如下:

    &amba_pl {
    
        /delete-node/ axis_broadcasterhdmi_input_axis_broadcaster_0@0;
        
        /* media-ctl prints out each node name of the video pipeline.
           hdmi_brdcst_0@0: media-ctl prints it out. */
        hdmi_brdcst_0_lb: hdmi_brdcst_0@0 {
            compatible = "xlnx,axis-broadcaster-1.1";
            
            hdmi_brdcst_0_ports: ports {
                #address-cells = <1>;
                #size-cells = <0>;  
            };        
        };
        
        /delete-node/ vcapaxis_broad_out1hdmi_input_axis_broadcaster_0;
        /delete-node/ vcap_hdmi_input_v_proc_ss_0;
        
        /* vcap_hdmi_brdcst_0: media-ctl prints it out. */
        vcap_hdmi_brdcst_0 {
            compatible = "xlnx,video";
            dma-names = "port0", "port1";
            dmas = <&hdmi_input_v_frmbuf_wr_1 0>, <&hdmi_input_v_frmbuf_wr_0 0>;
            
            /* vcap_hdmi_brdcst_0_ports: Linux prints it out in log. */
            vcap_hdmi_brdcst_0_ports: ports {
                #address-cells = <1>;
                #size-cells = <0>;
                
                vcap_broadcaster_0_port1: port@0 {
                    direction = "input";
                    reg = <1>;
                    /*  Video input pipeline 1: 
                            hdmi_rx_ss --> broadcaster_0 : 1 --> v_proc_ss_0 --> v_frmbuf_wr_1
                        hdmi_rx_ss : source_to_axis_broad_in0_from_v_hdmi_rx_ss_0
                        broadcaster_0 : out 1 : port2 :: src_to_vpss0_from_broad_port2_hwout1 
                        v_proc_ss_0 @a0040000 port@0 :: sink_to_vpss0_from_broad_port2_hwout1
                        v_proc_ss_0 @a0040000 port@1 :: src_to_frmbuf_wr1_from_vpss_0
                        v_frmbuf_wr_1 @a0080000 :: hdmi_input_v_frmbuf_wr_1
                    */
                    sink_to_frmbuf_wr1_from_vpss_0: endpoint {
                            remote-endpoint = <&src_to_frmbuf_wr1_from_vpss_0>;
                    };
                };
                
                vcap_broadcaster_0_port2: port@1 {
                    direction = "input";
                    reg = <0>;
                    /*  Video input pipeline 0: 
                            hdmi_rx_ss --> broadcaster_0 : 0 --> v_frmbuf_wr_0
                        hdmi_rx_ss : source_to_axis_broad_in0_from_v_hdmi_rx_ss_0
                        broadcaster_0 : out 0 : port1 ::  src_to_frmbuf_wr0_from_broad_port1_hwout0
                        v_frmbuf_wr_1 @a0010000 :: hdmi_input_v_frmbuf_wr_0
                        hdmi_input_ v_frmbuf_wr_0 hdmi_input_ axis_broadcaster_0 
                    */
                    sink_to_frmbuf_wr0_from_broad_port1_hwout0: endpoint {
                            remote-endpoint = <&src_to_frmbuf_wr0_from_broad_port1_hwout0>;
                    };                          
                };
    
            };
        };
    };
    
    /* hdmi_input_v_hdmi_rx_ss_0: v_hdmi_rx_ss@a0000000 */
    &hdmirx_porthdmi_input_v_hdmi_rx_ss_0 {
        source_to_axis_broad_in0_from_v_hdmi_rx_ss_0: endpoint {
                remote-endpoint = <&sink_to_broad_in0__from_v_hdmi_rx_ss_0>;
        };
    };
    
    &hdmi_brdcst_0_ports{
    
       /delete-node/ axis_broad_port1hdmi_input_axis_broadcaster_0;
       /delete-node/ axis_broad_port2hdmi_input_axis_broadcaster_0;
       /delete-node/ axis_broad_port0hdmi_input_axis_broadcaster_0;
    
        axis_broad_port1_hw_output0: port@1 {
            reg = <1>;
            src_to_frmbuf_wr0_from_broad_port1_hwout0: endpoint {
                remote-endpoint = <&sink_to_frmbuf_wr0_from_broad_port1_hwout0>;
            };
        };
        axis_broad_port2_hw_output1: port@2 {
            reg = <2>;
            src_to_vpss0_from_broad_port2_hwout1: endpoint {
                remote-endpoint = <&sink_to_vpss0_from_broad_port2_hwout1>;
            };
        };
        axis_broad_port0_hw_input: port@0 {
            reg = <0>;
            sink_to_broad_in0__from_v_hdmi_rx_ss_0: endpoint {
                remote-endpoint = <&source_to_axis_broad_in0_from_v_hdmi_rx_ss_0>;
            };
        };
    };
    
    &scaler_portshdmi_input_v_proc_ss_0{
    
        /delete-node/ port@0;
        /delete-node/ port@1;
        
        scaler_port1_v_proc_ss_0: port@1 {
            /* For xlnx,video-format user needs to fill as per their requirement */
            reg = <1>;
            xlnx,video-format = <3>;
            xlnx,video-width = <8>;
            src_to_frmbuf_wr1_from_vpss_0: endpoint {
                remote-endpoint = <&sink_to_frmbuf_wr1_from_vpss_0>;
            };
        };
        scaler_port0_v_proc_ss_0: port@0 {
            /* For xlnx,video-format user needs to fill as per their requirement */
            reg = <0>;
            xlnx,video-format = <3>;
            xlnx,video-width = <8>;
            sink_to_vpss0_from_broad_port2_hwout1: endpoint {
                remote-endpoint = <&src_to_vpss0_from_broad_port2_hwout1>;
            };
        };
    };    
    

    上述的devicetree,使用了更短更好理解的标签名称。

    v_proc_ss的devicetree里,port@0是输入;port@1是输出。
    broadcaster的devicetree里,port@0是输入;port@1和port@2是输出。

    另外,V4L2的设备号,根据"xlnx,video"设备里的port顺序分配。 如果port@0在port@1后面,那么port@0也会被分配video1; 而port@1也会被分配video0.

    测试环境

    PetaLinux 2020.2
    Linux 5.4.0
    ZCU106

  • 相关阅读:
    DataFrame遍历所有元素
    linux 安装redis 和系统学习redis
    接口
    安装idea教程
    Hello World!
    通过特征交互检测生成文本分类的层次解释《Generating Hierarchical Explanations on Text Classification via Feature Interaction Detection》(LIME算法、神经网络预测的分层解释CD和ACD、Shapley Value夏普利值、Leave-One-Out留一法、HEDGE)
    数字图像处理 乱记
    高傲的审稿人
    两项技能
    人其实会变的
  • 原文地址:https://www.cnblogs.com/hankfu/p/15066359.html
Copyright © 2011-2022 走看看