dma_alloc_coherent error for mipi csi2 camera

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

dma_alloc_coherent error for mipi csi2 camera

1,601 Views
srinivasaporam
Contributor II

Hi,

We have got imx6Q customized board designed based on reference board (Wandboard).

Custom board is having 512 MB RAM (LPDDR2) where as reference board has got 2GB DDR3 RAM.

We have connected MIPI CSI2 interface and when we are running the following command:

$ sudo avconv -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 /tmp/out.jpg

we are getting the following error:

ERROR: v4l2 capture: VIDIOC_REQBUFS: not enough buffers                   
ERROR: v4l2 capture: mxc_allocate_frame_buf failed. 

When i searched for the same in my kernel source got the place where this error will be coming

/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c

static int mxc_allocate_frame_buf(cam_data *cam, int count)

{

    int i;

    pr_debug("In MVC:mxc_allocate_frame_buf - size=%d\n",

        cam->v2f.fmt.pix.sizeimage);

    for (i = 0; i < count; i++) {

        cam->frame[i].vaddress =

            dma_alloc_coherent(0,

                       PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage),

                       &cam->frame[i].paddress,

                       GFP_DMA | GFP_KERNEL);

        if (cam->frame[i].vaddress == 0) {

            pr_err("ERROR: v4l2 capture: "

                "mxc_allocate_frame_buf failed.\n");

            mxc_free_frame_buf(cam);

            return -ENOBUFS;

        }

        cam->frame[i].buffer.index = i;

        cam->frame[i].buffer.flags = V4L2_BUF_FLAG_MAPPED;

        cam->frame[i].buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

        cam->frame[i].buffer.length =

            PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage);

        cam->frame[i].buffer.memory = V4L2_MEMORY_MMAP;

        cam->frame[i].buffer.m.offset = cam->frame[i].paddress;

        cam->frame[i].index = i;

    }

    return 0;

}

so, why dma_alloc_coherent is returning 0 which is being assigned to  cam->frame[i].vaddress.

How to resolve this issue???

Labels (4)
0 Kudos
4 Replies

748 Views
srinivasaporam
Contributor II

And also,

We think this is not the issue because of memory. Because there are the boards , with 512 MB RAM (like imx6sl evk, Wandboard solo etc)

are there any other mistakes that we are doing... outr board is imx6D, with LPDDR2 (512MB).

0 Kudos

748 Views
Yuri
NXP Employee
NXP Employee

Hello,

strictly speaking i.MX6SL EVK has 1 GB LPDDR2.

Regards,

Yuri.

0 Kudos

748 Views
srinivasaporam
Contributor II

Hi,

I tried the instructions (echo 1 > /proc/sys/vm/lowmem_reserve_ratio) but , still the problem is there. may be iam not using instruction correctly.

0 Kudos

748 Views
Yuri
NXP Employee
NXP Employee

Hello,

  Perhaps the system has no enough memory for operations.

The following may be helpful

imx53 video DMA memory fragmentation 


Have a great day,
Yuri

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

0 Kudos