Imx7 ov5640 request buffer problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Imx7 ov5640 request buffer problem

Jump to solution
1,393 Views
Ananth
Contributor III

Hi All,

 

I am using imx7 saber board ov5640_mipi.c driver.

I have a problem in using the camera driver available at drivers/media/platform/mxc/subdev/ in linux-4.1.15 kernel.

 

On 1st time, i was able to get buffer from mxc_v4l2_capture.c (available in imx-test-5.7). But when i looped the following code in mxc_v4l2_capture application, i end up in REQ_BUF Failure from the driver.

    while (1) {
        fd_v4l = v4l_capture_setup();
        v4l_capture_test(fd_v4l, argv[argc-1]);
    }
On debugging found that VIDIOC_REQBUFS ioctl  __buffers_in_use(q) more than 1 (2 active users).

 

On commenting drivers/media/v4l2-core/videobuf2-core.c __reqbufs function, i was able to run mxc_v4l2_capture.out multiple times with out error

#if 0
        if (q->memory == V4L2_MEMORY_MMAP && __buffers_in_use(q)) {
            mutex_unlock(&q->mmap_lock);
            dprintk(1, "memory in use, cannot free\n");
            printk("%s %s %d\n", __FILE__, __func__, __LINE__);
            return -EBUSY;
        }
#endif

 

My Queries

1. buf->refcount is 2, when the buffers are trying to free at drivers/media/v4l2-core/videobuf2-dma-contig.c vb2_dc_put function and the complete freeing only done at vb2_queue_release drivers/media/v4l2-core/videobuf2-core.c called at the end of application execution. How come refcount becomes 2 (Please refer patch and logs) ?

 

2. Is there any other stable branch for imx7 saber board camera driver ?

 

Thanks and regards,

Ananth.

Original Attachment has been moved to: Modification_debug.patch.zip

Original Attachment has been moved to: default_working_log.txt.zip

0 Kudos
Reply
1 Solution
1,181 Views
Ananth
Contributor III

The problem is the buffers are not freed property from driver. 

After stream off is performed the buffers should be freed.

1. With reqbuf ioctl send count =0.

2. mmaped buffers should be freed using munmap API.

Regards,

Ananth

View solution in original post

0 Kudos
Reply
3 Replies
1,181 Views
art
NXP Employee
NXP Employee

Seems that you have to clearly release the buffer after executing v4l_capture_test. Please try it.


Have a great day,
Artur

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,181 Views
Ananth
Contributor III

Hi Artur,

  Do we have any sample application which runs on imx7 with repeatedly doing Streamoff and streamon for camera driver ?

Thanks and regards,

Ananth.

0 Kudos
Reply
1,182 Views
Ananth
Contributor III

The problem is the buffers are not freed property from driver. 

After stream off is performed the buffers should be freed.

1. With reqbuf ioctl send count =0.

2. mmaped buffers should be freed using munmap API.

Regards,

Ananth

0 Kudos
Reply