UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer koolscooby
Observer
7,085 Views
Registered: ‎10-15-2016

V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Hello All!

 

I built a custom bitfile based on an upgraded ZCU102 2016.2 TRD project. I've also got petalinux 2016.3 building and booting FSBL, U-boot, and linux. I'm using ubuntu 14.04 for ARM64 as my rootfs. I've customized the device tree source to match my block diagram project. 

 

I have two video nodes in /dev. And it seems that v4l2 is somewhat informed:

 

root@zcu102:~/v4l2grab# v4l2-ctl --all -d /dev/video0
Driver Info (not using libv4l2):
        Driver name   : xilinx-vipp
        Card type     : vcap output 0
        Bus info      : platform:vcap:0
        Driver version: 4.6.0
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
Priority: 2
Format Video Capture:
        Width/Height  : 640/480
        Pixel Format  : 'YUYV'
        Field         : None
        Bytes per Line: 1280
        Size Image    : 614400
        Colorspace    : Unknown (00000000)
        Custom Info   : feedcafe
root@zcu102:~/v4l2grab# v4l2-ctl --all -d /dev/video1
Driver Info (not using libv4l2):
        Driver name   : xilinx-vipp
        Card type     : vcap output 1
        Bus info      : platform:vcap:1
        Driver version: 4.6.0
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
Priority: 2
Format Video Capture:
        Width/Height  : 640/480
        Pixel Format  : 'YUYV'
        Field         : None
        Bytes per Line: 1280
        Size Image    : 614400
        Colorspace    : Unknown (00000000)
        Custom Info   : feedcafe

The relevant part of my device tree is as follows: 

&amba {
	vid_stream_clk: vid_stream_clk {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <300000000>;
	};

	axi_lite_clk50: axi_lite_clk50 {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <50000000>;
	};


// Dummy port for now ports { port@0 { sdirx_ep_out: endpoint { remote-endpoint = <&sdirx_in_ep>; }; }; }; // 0x00_A000_0000: AXI4-Stream switch gpio_sdirx: sdi_gpio@a0010000 { #gpio-cells = <2>; compatible = "xlnx,xps-gpio-1.00.a"; gpio-controller ; interrupt-parent = <&gic>; interrupts = < 0 90 4 >; reg = < 0x0 0xa0010000 0x0 0x10000 >; xlnx,all-inputs = <0x1>; xlnx,all-inputs-2 = <0x0>; xlnx,dout-default = <0x0>; xlnx,dout-default-2 = <0x0>; xlnx,gpio-width = <0x2>; xlnx,gpio2-width = <32>; xlnx,interrupt-present = <0x1>; xlnx,is-dual = <0x1>; xlnx,tri-default = <0xffffffff>; xlnx,tri-default-2 = <0xffffffff>; }; // SDI VDMA vdma_sdirx: vdma@a0020000 { compatible = "xlnx,axi-vdma-1.00.a"; reg = < 0x0 0xa0020000 0x0 0x10000>; dma-ranges = <0x00000000 0x00000000 0x40000000>; xlnx,num-fstores = <1>; xlnx,flush-fsync = <1>; xlnx,addrwidth = <0x24>; clock-names = "s_axi_lite_aclk", "m_axi_s2mm_aclk"; clocks = <&axi_lite_clk50>, <&vid_stream_clk>; #dma-cells = <1>; dma-channel@a0020030 { compatible = "xlnx,axi-vdma-s2mm-channel"; interrupt-parent = <&gic>; interrupts = <0 91 4>; clocks = <&vid_stream_clk>; clock-names = "axis"; xlnx,num-fstores = <1>; xlnx,flush-fsync = <1>; xlnx,datawidth = <0x10>; xlnx,device-id = <0x1>; xlnx,genlock-mode ; }; }; // TPG VDMA vdma_testrx: vdma@a0030000 { compatible = "xlnx,axi-vdma-1.00.a"; reg = < 0x0 0xa0030000 0x0 0x10000>; dma-ranges = <0x00000000 0x00000000 0x40000000>; xlnx,num-fstores = <1>; xlnx,flush-fsync = <1>; xlnx,addrwidth = <0x24>; clock-names = "s_axi_lite_aclk", "m_axi_s2mm_aclk"; clocks = <&axi_lite_clk50>, <&vid_stream_clk>; #dma-cells = <1>; dma-channel@a0030030 { compatible = "xlnx,axi-vdma-s2mm-channel"; interrupt-parent = <&gic>; interrupts = <0 89 4>; clocks = <&vid_stream_clk>; clock-names = "axis"; xlnx,num-fstores = <1>; xlnx,flush-fsync = <1>; xlnx,datawidth = <0x10>; xlnx,device-id = <0x1>; xlnx,genlock-mode ; }; }; vtc_testrx: vtc@a0040000 { compatible = "xlnx,v-tc-6.1"; reg = <0x0 0xa0040000 0x0 0x10000>; clocks = <&si570_1>; xlnx,det-achroma-en = <0x0>; xlnx,det-avideo-en = <0x1>; xlnx,det-fieldid-en = <0x0>; xlnx,det-hblank-en = <0x1>; xlnx,det-hsync-en = <0x1>; xlnx,det-vblank-en = <0x1>; xlnx,det-vsync-en = <0x1>; xlnx,detect-en = <0x0>; xlnx,fsync-hstart0 = <0x0>; xlnx,fsync-hstart1 = <0x0>; xlnx,fsync-hstart10 = <0x0>; xlnx,fsync-hstart11 = <0x0>; xlnx,fsync-hstart12 = <0x0>; xlnx,fsync-hstart13 = <0x0>; xlnx,fsync-hstart14 = <0x0>; xlnx,fsync-hstart15 = <0x0>; xlnx,fsync-hstart2 = <0x0>; xlnx,fsync-hstart3 = <0x0>; xlnx,fsync-hstart4 = <0x0>; xlnx,fsync-hstart5 = <0x0>; xlnx,fsync-hstart6 = <0x0>; xlnx,fsync-hstart7 = <0x0>; xlnx,fsync-hstart8 = <0x0>; xlnx,fsync-hstart9 = <0x0>; xlnx,fsync-vstart0 = <0x0>; xlnx,fsync-vstart1 = <0x0>; xlnx,fsync-vstart10 = <0x0>; xlnx,fsync-vstart11 = <0x0>; xlnx,fsync-vstart12 = <0x0>; xlnx,fsync-vstart13 = <0x0>; xlnx,fsync-vstart14 = <0x0>; xlnx,fsync-vstart15 = <0x0>; xlnx,fsync-vstart2 = <0x0>; xlnx,fsync-vstart3 = <0x0>; xlnx,fsync-vstart4 = <0x0>; xlnx,fsync-vstart5 = <0x0>; xlnx,fsync-vstart6 = <0x0>; xlnx,fsync-vstart7 = <0x0>; xlnx,fsync-vstart8 = <0x0>; xlnx,fsync-vstart9 = <0x0>; xlnx,gen-achroma-en = <0x0>; xlnx,gen-achroma-polarity = <0x1>; xlnx,gen-auto-switch = <0x0>; xlnx,gen-avideo-en = <0x1>; xlnx,gen-avideo-polarity = <0x1>; xlnx,gen-cparity = <0x0>; xlnx,gen-f0-vblank-hend = <0x780>; xlnx,gen-f0-vblank-hstart = <0x780>; xlnx,gen-f0-vframe-size = <0x465>; xlnx,gen-f0-vsync-hend = <0x780>; xlnx,gen-f0-vsync-hstart = <0x780>; xlnx,gen-f0-vsync-vend = <0x440>; xlnx,gen-f0-vsync-vstart = <0x43b>; xlnx,gen-f1-vblank-hend = <0x780>; xlnx,gen-f1-vblank-hstart = <0x780>; xlnx,gen-f1-vframe-size = <0x465>; xlnx,gen-f1-vsync-hend = <0x780>; xlnx,gen-f1-vsync-hstart = <0x780>; xlnx,gen-f1-vsync-vend = <0x440>; xlnx,gen-f1-vsync-vstart = <0x43b>; xlnx,gen-fieldid-en = <0x0>; xlnx,gen-fieldid-polarity = <0x1>; xlnx,gen-hactive-size = <0x780>; xlnx,gen-hblank-en = <0x1>; xlnx,gen-hblank-polarity = <0x1>; xlnx,gen-hframe-size = <0x898>; xlnx,gen-hsync-en = <0x1>; xlnx,gen-hsync-end = <0x804>; xlnx,gen-hsync-polarity = <0x1>; xlnx,gen-hsync-start = <0x7d8>; xlnx,gen-interlaced = <0x0>; xlnx,gen-vactive-size = <0x438>; xlnx,gen-vblank-en = <0x1>; xlnx,gen-vblank-polarity = <0x1>; xlnx,gen-video-format = <0x2>; xlnx,gen-vsync-en = <0x1>; xlnx,gen-vsync-polarity = <0x1>; xlnx,generate-en = <0x1>; xlnx,has-axi4-lite = <0x1>; xlnx,has-intc-if = <0x0>; xlnx,interlace-en = <0x0>; xlnx,max-lines = <0x1000>; xlnx,max-pixels = <0x1000>; xlnx,num-fsyncs = <0x1>; xlnx,sync-en = <0x0>; }; tpg_testrx: tpg@a0050000 { compatible = "xlnx,v-tpg-7.0"; reg = <0x0 0xa0050000 0x0 0x10000>; clocks = <&vid_stream_clk>; xlnx,video-format = <0>; xlnx,video-width = <8>; // xlnx,s-axi-ctrl-addr-width = <0x8>; // xlnx,s-axi-ctrl-data-width = <0x20>; xlnx,vtc = <&vtc_testrx>; reset-gpios = <&gpio 79 1>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; /* 0 = XVIP_VF_YUV_422 */ xlnx,video-format = <0>; xlnx,video-width = <8>; tpg_testrx_out_ep: endpoint { remote-endpoint = <&tpg_testrx_in_ep>; }; }; }; }; vcap { compatible = "xlnx,video"; dmas = <&vdma_testrx 0>, <&vdma_sdirx 0>; dma-names = "port0", "port1"; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; direction = "input"; tpg_testrx_in_ep: endpoint { remote-endpoint = <&tpg_testrx_out_ep>; }; }; port@1 { reg = <1>; direction = "input"; sdirx_in_ep: endpoint { remote-endpoint = <&sdirx_ep_out>; }; }; }; }; };

Trying to use either video0 or video1 via V4L2 causes error 32, Broken pipe when the VIDIOC_STREAMON ioctl is called. 

 

I've hit a brick wall debugging this - writing 1 to /sys/module/videobuf2_core/parameters/debug doesn't give me any more debug prints. I expected this level of video capture to JustWork(tm)... so I'm hoping it's something obvious.

 

Anyone have this issue before, or have any recommendations that might help me out?

 

My design isn't drastically different from the TRD, but I will say it would be nice if Xilinx would release the TRD in Vivado 2016.3, as using the 2016.2 bitfile w/ petalinux 2016.3 hasn't JustWorked either...

 

Thanks in advance for your help!

 

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
11,410 Views
Registered: ‎12-08-2011

Re: V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Hi,

 

any reason why you instantiate two DMAs in a single capture node (vcap)? I believe the V4L pipeline driver will try to start streaming from both DMAs at the same time but the vdma_sdirx seems to be connected only to a dummy node which is likely why you get the broken pipe error.

 

Can try instantiating separate capture nodes, one for TPG, the other for SDI Rx and then see if you can capture from the TPG pipeline?

 

Cheers,

Chris

 

P.S. The TRD will be updated to 2016.3 and released before the end of the year. Stay tuned!

0 Kudos
6 Replies
Xilinx Employee
Xilinx Employee
11,411 Views
Registered: ‎12-08-2011

Re: V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Hi,

 

any reason why you instantiate two DMAs in a single capture node (vcap)? I believe the V4L pipeline driver will try to start streaming from both DMAs at the same time but the vdma_sdirx seems to be connected only to a dummy node which is likely why you get the broken pipe error.

 

Can try instantiating separate capture nodes, one for TPG, the other for SDI Rx and then see if you can capture from the TPG pipeline?

 

Cheers,

Chris

 

P.S. The TRD will be updated to 2016.3 and released before the end of the year. Stay tuned!

0 Kudos
Observer koolscooby
Observer
6,995 Views
Registered: ‎10-15-2016

Re: V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Hi Chris!

 

Thanks for your support!

 

I was attempting to list both ports on the one vcap driver per xlnx,video.txt device-tree bindings documentation. The DT doc wasn't clear that this would cause both ports to start streaming. I removed the second port from the device-tree and have some small progress - now I get error 22 Invalid Argument.

 

As a note - I am not using the TRD video library source, but instead hoping to dump a frame with a utility such as v4l2grab: https://github.com/twam/v4l2grab. The eventual requirement is to use gstreamer to capture frames from the TPG, but was hoping the frame grab is an easier intermediate solution - maybe it's not.

 

Is there a generic media device / V4L2 endpoint that I could use for the second RX channel? Is there a proper way to add a dummy port? Else, it seems a custom V4L2 driver for that subsystem is in order, and I would imagine that starting with the TPG driver is a good template.

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
6,974 Views
Registered: ‎12-08-2011

Re: V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Which dma/video node did you try to stream from when you got the error? The one connected to the TPG? A simple TPG streaming pipeline is modeled in the Base TRD.

 

If you try to stream from a video node that is not connected to a subdevice, that won't work as the pipeline is not valid.

 

A few tools that you may find useful are yavta, v4l-ctl, and media-ctl which are all provided on the Base TRD rootfs. Here is a sample recipe:

 

Print the topology and configuration of the TPG capture pipeline: 

% media-ctl -d /dev/media1 -p
Media controller API version 0.1.0
Media device information
------------------------
driver xilinx-video
model Xilinx Video Composite Device
serial
bus info
hw revision 0x0
driver version 0.0.0
Device topology
- entity 1: vcap_tpg output 0 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
<- "a3c30000.tpg":0 [ENABLED]
- entity 5: a3c30000.tpg (1 pad, 1 link)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev1
pad0: Source
[fmt:UYVY/0x0]
-> "vcap_tpg output 0":0 [ENABLED]

Configure the TPG subdevice format and print the result: 

% media-ctl -d /dev/media1 -V '"a3c30000.tpg":0 [fmt:UYVY/1920x1080]'
% media-ctl -d /dev/media1 -p
Media controller API version 0.1.0

Media device information
------------------------
driver          xilinx-video
model           Xilinx Video Composite Device
serial
bus info
hw revision     0x0
driver version  0.0.0

Device topology
- entity 1: vcap_tpg output 0 (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "a3c30000.tpg":0 [ENABLED]

- entity 5: a3c30000.tpg (1 pad, 1 link)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Source
                [fmt:UYVY/1920x1080]
                -> "vcap_tpg output 0":0 [ENABLED]

List the TPG subdevice controls and print the current values: 

% yavta --no-query -l /dev/v4l-subdev1
Device /dev/v4l-subdev1 opened.
--- User Controls (class 0x00980001) ---
control 0x0098c903 `Test Pattern: Color Mask' min 0 max 7 step 0 default 0 current 0.
control 0x0098c907 `Test Pattern: Motion Speed' min 0 max 255 step 1 default 4 current 4.
control 0x0098c908 `Test Pattern: Cross Hairs Row' min 0 max 4095 step 1 default 100 current 100.
control 0x0098c909 `Test Pattern: Cross Hairs Colum' min 0 max 4095 step 1 default 100 current 100.
control 0x0098c90a `Test Pattern: Zplate Horizontal' min 0 max 65535 step 1 default 30 current 30.
control 0x0098c90b `Test Pattern: Zplate Horizontal' min 0 max 65535 step 1 default 0 current 0.
control 0x0098c90c `Test Pattern: Zplate Vertical S' min 0 max 65535 step 1 default 1 current 1.
control 0x0098c90d `Test Pattern: Zplate Vertical S' min 0 max 65535 step 1 default 0 current 0.
control 0x0098c90e `Test Pattern: Box Size' min 0 max 4095 step 1 default 50 current 50.
control 0x0098c90f `Test Pattern: Box Color(RGB/YCb' min 0 max 16777215 step 1 default 0 current 0.
control 0x0098c912 `Test Pattern: Foreground Patter' min 0 max 2 step 1 default 0 current 0.
  0: No Overlay (*)
  1: Moving Box
  2: Cross Hairs
--- Image Source Controls (class 0x009e0001) ---
control 0x009e0901 `Vertical Blanking' min 3 max 8159 step 1 default 100 current 100.
control 0x009e0902 `Horizontal Blanking' min 3 max 8159 step 1 default 100 current 100.
--- Image Processing Controls (class 0x009f0001) ---
control 0x009f0903 `Test Pattern' min 0 max 16 step 1 default 9 current 9.
  1: Horizontal Ramp
  2: Vertical Ramp
  3: Temporal Ramp
  4: Solid Red
  5: Solid Green
  6: Solid Blue
  7: Solid Black
  8: Solid White
  9: Color Bars (*)
  10: Zone Plate
  11: Tartan Color Bars
  12: Cross Hatch
  13: Color Sweep
  14: Vertical/Horizontal Ramps
  15: Black/White Checker Board
  16: PseudoRandom
14 controls found.

Configure the TPG subdevice vertical blanking, horizontal blanking for 1080p60 as well as test pattern, foreground pattern:

% yavta --no-query -w '0x009e0901 45' /dev/v4l-subdev1
% yavta --no-query -w '0x009e0902 280' /dev/v4l-subdev1
% yavta --no-query -w '0x009f0903 14' /dev/v4l-subdev1
% yavta --no-query -w '0x0098c912 1' /dev/v4l-subdev1
% yavta --no-query -l /dev/v4l-subdev1
Device /dev/v4l-subdev1 opened.
--- User Controls (class 0x00980001) ---
control 0x0098c903 `Test Pattern: Color Mask' min 0 max 7 step 0 default 0 current 0.
control 0x0098c907 `Test Pattern: Motion Speed' min 0 max 255 step 1 default 4 current 4.
control 0x0098c908 `Test Pattern: Cross Hairs Row' min 0 max 4095 step 1 default 100 current 100.
control 0x0098c909 `Test Pattern: Cross Hairs Colum' min 0 max 4095 step 1 default 100 current 100.
control 0x0098c90a `Test Pattern: Zplate Horizontal' min 0 max 65535 step 1 default 30 current 30.
control 0x0098c90b `Test Pattern: Zplate Horizontal' min 0 max 65535 step 1 default 0 current 0.
control 0x0098c90c `Test Pattern: Zplate Vertical S' min 0 max 65535 step 1 default 1 current 1.
control 0x0098c90d `Test Pattern: Zplate Vertical S' min 0 max 65535 step 1 default 0 current 0.
control 0x0098c90e `Test Pattern: Box Size' min 0 max 4095 step 1 default 50 current 50.
control 0x0098c90f `Test Pattern: Box Color(RGB/YCb' min 0 max 16777215 step 1 default 0 current 0.
control 0x0098c912 `Test Pattern: Foreground Patter' min 0 max 2 step 1 default 0 current 1.
  0: No Overlay
  1: Moving Box (*)
  2: Cross Hairs
--- Image Source Controls (class 0x009e0001) ---
control 0x009e0901 `Vertical Blanking' min 3 max 8159 step 1 default 100 current 45.
control 0x009e0902 `Horizontal Blanking' min 3 max 8159 step 1 default 100 current 280.
--- Image Processing Controls (class 0x009f0001) ---
control 0x009f0903 `Test Pattern' min 0 max 16 step 1 default 9 current 14.
  1: Horizontal Ramp
  2: Vertical Ramp
  3: Temporal Ramp
  4: Solid Red
  5: Solid Green
  6: Solid Blue
  7: Solid Black
  8: Solid White
  9: Color Bars
  10: Zone Plate
  11: Tartan Color Bars
  12: Cross Hatch
  13: Color Sweep
  14: Vertical/Horizontal Ramps (*)
  15: Black/White Checker Board
  16: PseudoRandom
14 controls found.

Set the pixel format and video dimensions on the video node:

% v4l2-ctl -d /dev/video1 --set-fmt-video=width=1920,height=1080,pixelformat='YUYV'
% v4l2-ctl -d /dev/video1 -V
Format Video Capture:
        Width/Height  : 1920/1080
        Pixel Format  : 'YUYV'
        Field         : None
        Bytes per Line: 3840
        Size Image    : 4147200
        Colorspace    : SRGB
        Flags         : 

 Capture frames to disk:

% yavta -n 3 -c10 -f YUYV -s 1920x1080 --skip 7 -F /dev/video1
 
Device /dev/video1 opened.
Device `vcap_tpg output 0' on `platform:vcap_tpg:0' is a video output (without mplanes) device.
Video format set: YUYV (56595559) 1920x1080 (stride 3840) field none buffer size 4147200
Video format: YUYV (56595559) 1920x1080 (stride 3840) field none buffer size 4147200
3 buffers requested.
length: 4147200 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0x7f8dd52000.
length: 4147200 offset: 4149248 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0x7f8d95d000.
length: 4147200 offset: 8298496 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0x7f8d568000.
0 (0) [-] none 0 4147200 B 582.214421 582.214433 59.999 fps ts mono/EoF
1 (1) [-] none 1 4147200 B 582.222751 582.222760 120.048 fps ts mono/EoF
2 (2) [-] none 2 4147200 B 582.231084 582.231092 120.005 fps ts mono/EoF
3 (0) [-] none 3 4147200 B 582.239416 582.239425 120.019 fps ts mono/EoF
4 (1) [-] none 4 4147200 B 582.247749 582.247757 120.005 fps ts mono/EoF
5 (2) [-] none 5 4147200 B 582.256081 582.256091 120.019 fps ts mono/EoF
6 (0) [-] none 6 4147200 B 582.264415 582.264424 119.990 fps ts mono/EoF
7 (1) [-] none 7 4147200 B 582.272747 582.272756 120.019 fps ts mono/EoF
8 (2) [-] none 8 4147200 B 582.281080 582.305856 120.005 fps ts mono/EoF
9 (0) [-] none 9 4147200 B 582.289405 582.338911 120.120 fps ts mono/EoF
Captured 10 frames in 0.141156 seconds (70.843415 fps, 293801810.445975 B/s).
3 buffers released.

Copy the generated "frame-*.bin" files to a host PC, convert to pnm format and view the result.
The raw2rgbpnm utility can be downloaded from here git://gitorious.org/raw2rgbpnm/raw2rgbpnm.git

% raw2rgbpnm -s1920x1080 -f YUYV frame-000007.bin frame-000007.pnm
% gimp frame-000007.pnm

Note: the media, video, and subdevice nodes might have different numbers. I just did this on some random design I have running on my board currently. Please try this on the Base TRD design first and then on your own pipeline.

 

Hope this helps!

Observer koolscooby
Observer
6,881 Views
Registered: ‎10-15-2016

Re: V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Hi Chris!

 

This was a super helpful mini-tutorial - thanks! This level of command-line utility tutorial is much easier to grasp than the entire APU application using V4L2lib, etc. I successfully grabbed TPG frames from the TRD 2016.2 SDcard image. Then onto the saga of grabbing frames from my custom system...

 

 

After re-importing the TRD 2016.2 BD into 2016.3 and fixing the broken settings on the MPSoC cell, I added a couple ILA cores to my design and spent a few more days (ugh) debugging, I learned that the video timing controller parameters were never getting written and enabled. This was odd to me as the VTC driver was being probed successfully during boot.

 

 

[    3.283768] xilinx-vtc a0040000.vtc: device found, version 6.010

 

I started sprinkling printk debug statements throughout the tpg and vtc code and found the culprit for this many-day setback. In xilinx-tpg.c, xtpg_config_vtc calls xvtc_generator_start which is defined in xilinx-vtc.c....

 

 

int xvtc_generator_start(struct xvtc_device *xvtc,
			 const struct xvtc_config *config)
{
	int ret;

	if (!xvtc->has_generator){
		return -ENXIO;
	}
...
...
...

 

The caller (xtpg_config_vtc) doesn't do anything with the return value here. It just goes on it's merry way - but no video is ever produced and no DMA interrupts are ever fired (and no frames are ever received - causing the usermode DQBUF IOCTL to block as expected.) 

 

So, why is xvtc->has_generator not true? 

 

Because my device tree was missing xlnx,generator.

 

 

vtc_testrx: vtc@a0040000 {
	compatible = "xlnx,v-tc-6.1";
	reg = <0x0 0xa0040000 0x0 0x10000>;
	clocks = <&si570_1>;
	xlnx,generator;
...
...
...

 

 

I think there are two fixes to this developer pain: 

1) Add proper error handling to xtpg_config_vtc and it's caller. If xtpg->vtc is set, then I believe that the VTC should be expected to have a generator and actually set parameters without question. The VTC driver is doing the safe thing by not writing registers that may not be there if xlnx,generator is not defined - but the TPG requires the xlnx,generator to be there... Else, error to the caller. Or during TPG probe, grab the VTC and check if generator is set and bail there...

2) Fix VTC probe to catch this developer error earlier and enforce the policy in xlnx,v-tc.txt documentation. The probe function could actually enforce the optional / required policy (below)

 

 

I can probably find a few minutes to throw together a patch, but I'm curious which approach you think is best based on kernel + Xilinx guidelines.

 

For reference, the xlnx,v-tc.txt documentation: 

 

Xilinx Video Timing Controller (VTC)
------------------------------------

The Video Timing Controller is a general purpose video timing generator and
detector.

Required properties:

  - compatible: Must be "xlnx,v-tc-6.1".

  - reg: Physical base address and length of the registers set for the device.

  - clocks: Must contain a clock specifier for the VTC core and timing
    interfaces clock.

Optional properties:

  - xlnx,detector: The VTC has a timing detector
  - xlnx,generator: The VTC has a timing generator

  At least one of the xlnx,detector and xlnx,generator properties must be
  specified.


Example:

	vtc: vtc@43c40000 {
		compatible = "xlnx,v-tc-6.1";
		reg = <0x43c40000 0x10000>;

		clocks = <&clkc 15>;
		xlnx,generator;
	};

 

 

 

0 Kudos
Newbie vijay457
Newbie
4,153 Views
Registered: ‎09-27-2017

Re: V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Hello All

 

I am working on A simple TPG streaming with VDMA  using v4l2 and i had broken pipe issue as stated in the forum. I had video nodes in the under /dev/Video0 and /dev/video1 . But there is no media node under /dev/(/dev/media0 no such file directory)   any suggestion would be very helpful for me.  

 

Here is my device tree configuration 

             axi_vdma_0: dma@43000000 {
                  #dma-cells = <1>;
                   clock-names = "s_axi_lite_aclk", "m_axi_mm2s_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk",                                              "m_axi_s2mm_aclk";
                   clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
                   compatible = "xlnx,axi-vdma-1.00.a";
                   interrupt-parent = <&intc>;
                   interrupts = <0 32 4 0 31 4>;
                   reg = <0x43000000 0x10000>;
                   xlnx,addrwidth = <0x20>;
                   xlnx,flush-fsync = <0x1>;
                    xlnx,num-fstores = <0x3>;
                    dma-channel@43000000 {
                               compatible = "xlnx,axi-vdma-mm2s-channel";
                               interrupts = <0 32 4>;
                               xlnx,datawidth = <0x20>;
                               xlnx,device-id = <0x0>;
                               xlnx,genlock-mode ;
                      };
                    dma-channel@43000030 {
                                compatible = "xlnx,axi-vdma-s2mm-channel";
                                interrupts = <0 31 4>;
                               xlnx,datawidth = <0x20>;
                               xlnx,device-id = <0x0>;
                               xlnx,genlock-mode ;
                    };
          };
         axi_vdma_1: dma@43010000 {
                      #dma-cells = <1>;
                      clock-names = "s_axi_lite_aclk", "m_axi_s2mm_aclk", "m_axi_s2mm_aclk";
                      clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>;
                      compatible = "xlnx,axi-vdma-1.00.a";
                      interrupt-parent = <&intc>;
                     interrupts = <0 35 4>;
                    reg = <0x43010000 0x10000>;                   
                    dma-channel@43010030 {
                                    compatible = "xlnx,axi-vdma-s2mm-channel";
                                    interrupts = <0 35 4>;
                                    xlnx,datawidth = <0x10>;
                                    xlnx,device-id = <0x1>;
                                    xlnx,genlock-mode ;
                    };
         };

         v_tc_0: v_tc@43c10000 {
                   compatible = "xlnx,v-tc-6.1";
                   reg = <0x43c10000 0x10000>;
                   clocks = <&clkc 15>;
                   xlnx,generator;
         };
         v_tc_1: v_tc@40070000 {
                    compatible = "xlnx,v-tc-6.1";
                    reg = <0x40070000 0x10000>;
                    clocks = <&clkc 15>;
                    xlnx,generator;
          };

         v_tpg_0: v_tpg@43c20000 {
                     compatible = "xlnx,v-tpg-6.0";
                      interrupt-parent = <&intc>;
                      interrupts = <0 34 4>;
                      reg = <0x43c20000 0x10000>;
                      xlnx,vtc = <&v_tc_0>;
         };
         v_tpg_1: v_tpg@40080000 {
                        compatible = "xlnx,v-tpg-6.0";
                        reg = <0x40080000 0x10000>;
                        clocks = <&clkc 15>;
                        xlnx,vtc = <&v_tc_1>;
                     ports {
                                #address-cells = <1>;
                                #size-cells = <0>;

                                        port@0 {
                                                    reg = <0>;

                                                    xlnx,video-format = <0>;
                                                    xlnx,video-width = <8>;

                                                    tpg_out: endpoint {
                                                                remote-endpoint = <&vcap_in>;
                                                     };
                                        };
                             };
                };
                video_cap_0 {
                          compatible = "xlnx,video";
                         dmas = <&axi_vdma_0 1>;
                          dma-names = "port0";

                          ports {
                            #address-cells = <1>;
                            #size-cells = <0>;

                            port@0 {
                            reg = <0>;
                           direction = "input";
                           vcap_in: endpoint {
                                   remote-endpoint = <&tpg_out>;
                            };
                     };
              };
      };

 

Best Regards

Vijay

0 Kudos
Explorer
Explorer
272 Views
Registered: ‎02-05-2008

Re: V4L2 VIDIOC_STREAMON error 32, Broken Pipe

Jump to solution

Hi,

when I run the command

yavta -n 3 -c10 -f YUYV -s 1920x1080 --skip 7 -F /dev/video0

I get

 

Device /dev/video0 opened.
Video format set: width: 1920 height: 1080 buffer size: 4147200
Video format: YUYV (56595559) 1920x1080
Unable to request buffers: 22.

what could be the issue? I am using petalinux 2019.1

N JOTHI

 

0 Kudos