cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
242 Views
Registered: ‎06-25-2019

vidioc_streamon Inappropriate ioctl for device.

vidioc_streamon Inappropriate ioctl for device.

During vidioc_streamon, getting->[Errno 25] Inappropriate ioctl for device.

Every second time,code is running without this error, and also able to get the expected out.But alternate run is always giving the above error.

i.e.1st,3rd,5th time it gives error but when we run code 2nd,4th or 6th times it runs fine.

-We are using xilinx vdma with v4l2 capture.

-In this we are capturing the image using the xilinx vdma. All the vdma configurations are happening using v4l2 ioctls calls.

-Since data is coming from dummy source, we have a dummy video source node in the dts and also driver for the node,these node is getting configure using the v4l2-subdevice node(/dev/media).Since there is no support in the v4l2-python,we are using the C library to configure the sub-device node

we have used this code as a reference(https://www.kernel.org/doc/html/v4.10/media/uapi/v4l/capture.c.html )

Details of the code.

-v4l2 memory is userptr.type is V4L2_BUF_TYPE_VIDEO_CAPTURE.

-the sequence of the ioctls are as follows.

1)open video node

2)open sub device node

3)VIDIOC_QUERYCAP

4)VIDIOC_S_FMT

5)VIDIOC_SUBDEV_S_FMT

6)VIDIOC_REQBUFS

7)VIDIOC_QBUF

8)VIDIOC_STREAMON

9)VIDIOC_DQBUF

10)VIDIOC_QBUF

We get to know from the dma drivers dmesages that when we get a stream on error, It is going in the pipeline start part of the dma driver code.When code runs fine at that time it is going in the pipeline stop part of the dma driver code. 

snippet of ioctl call of stream on and qbuf

for ind in range(req.count):

    # setup a buffer

    buf = v4l2_buffer()

    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE

    buf.memory = V4L2_MEMORY_USERPTR

    buf.index = ind

    buf.length = fmt.fmt.pix.sizeimage

    buf.m.userptr = buffers[ind]

    fcntl.ioctl(vd, VIDIOC_QBUF, buf)

buf_type = v4l2_buf_type(V4L2_BUF_TYPE_VIDEO_CAPTURE)

fcntl.ioctl(vd, VIDIOC_STREAMON, buf_type)

device tree details

video_cap {

compatible = "xlnx,video";

dmas = <&axi_vdma_0 0>;

dma-names = "port0";

xlnx,video-format = <0xc>;

xlnx,video-width = <0x8>;

xlnx,cfa-pattern = "mono";

ports {

              #address-cells = <1>;

                      #size-cells = <0>;

        port@0 {

             reg = <0>;

                direction = "input";

                     vsrc0_out0: endpoint {

                                         remote-endpoint = <&vcap0_in0>;        

         };

         };

};

};

video_src {

compatible = "cameralink,v-0.1";

ports {

         #address-cells = <0x1>; 

         #size-cells = <0x0>; 

         port@0 { 

                      reg = <0x0>;

                      direction = "output";

                           vcap0_in0: endpoint {

                                        remote-endpoint = <&vsrc0_out0>;

                           };

                 };

          };

};

};

&amba_pl{

         dma@43000000 {

                dma-cells = <0x1>;

                clock-names = "s_axi_lite_aclk", "m_axi_s2mm_aclk", "s_axis_s2mm_aclk";

                 clocks = <0x1 0xf 0x1 0xf 0x1 0xf>;

                 compatible = "xlnx,axi-vdma-6.3", "xlnx,axi-vdma-1.00.a";

                 interrupt-names = "s2mm_introut";

                 interrupt-parent = <0x4>;

                 interrupts = <0x0 0x1d 0x4>;

                 reg = <0x43000000 0x10000>;

                 xlnx,addrwidth = <0x20>;

                 xlnx,flush-fsync = <0x1>;

                 xlnx,num-fstores = <0x3>;

                 linux,phandle= <0x11>;

                 phandle = <0x11>;

                 dma-channel@43000030 {

                           compatible = "xlnx,axi-vdma-s2mm-channel";

                           interrupts = <0x0 0x1d 0x4>;

                           xlnx,datawidth = <0x20>;

                           xlnx,device-id = <0x0>;

                            xlnx,genlock-mode;

                   };

            };

}

0 Kudos
1 Reply
Highlighted
Observer
Observer
185 Views
Registered: ‎06-25-2019

 

we made some change in the dma(xilinx-dma.c) and v4l2(xilinx-vipp.c) and we able resolve the error.

in the v4l2 in this xvip_subdev_set_streaming API we change the sequence of the checking of the entity.

First we enable the entity and then we are checking status.which was other way around and giving stream on error.

bool xvip_subdev_set_streaming(struct xvip_composite_device *xdev,
struct v4l2_subdev *subdev, bool enable)
{
struct xvip_graph_entity *entity;

list_for_each_entry(entity, &xdev->entities, list)
if (entity->node == subdev->dev->of_node) {
bool status;

entity->streaming = enable;

status = entity->streaming;

return status;
}

WARN(1, "Should never get here\n");
return false;
}

can anyone explain how was that happening?

0 Kudos