dma_alloc_coherent fails on large images

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

dma_alloc_coherent fails on large images

2,895 Views
pierre-olivierh
Contributor III

Hello,

I'm currently on a Sony IMX MIPI sensor, the sensor is fully working with the iMX6: I can have a 1080p,720p video and I can grab 13MPX images from the sensor.

My issue is appearing when I try to grab multiple times a 13MPix image. It seems to appear randomly.

This is my pipeline:

gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! filesink location=test.raw

When it's working:

root@mx6:~# gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! filesink location=test.raw
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:01.949798667
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

When I have the error :

gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! filesink location=test.raw
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

[ 381.520560] ERROR: v4l2 capture : Allocate dummy frame failed.
ERROR: from element /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0: Internal data stream error.
Additional debug info:
../../../../gstreamer-1.10.4/libs/gst/base/gstbasesrc.c(2950): gst_base_src_loop (): /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.599205333
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

This is my tries to solve this issue, but with no success:

- Add __GFP_NOFAIL in the flags of the dma_alloc_coherent generation this issue

- Change CONFIG_FORCE_MAX_ZONEORDER to 16 instead of 15

- Increase CMA size to 512MB (instead of 320)

I understand that the image is huge (4192*3104) but it worked in parallel CSI with this resolution.

I'm on Yocto 2.3.1 (Pyro) and my kernel version is 4.1.15.

Did you ever face this issue?

Thank You,

Pierre-Olivier

Labels (3)
Tags (4)
0 Kudos
2 Replies

1,246 Views
ramyaravichandr
Contributor I

Hi Pierre-Olivier,

Please share the observations for the following cases:

1. The number of buffers can be increased to 2.Hope there is no limitation in buffer allocation.

gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! filesink location=test.raw

2. While capturing video, how many buffers are you allocating?

3. V4L2 framework throws the error, so it is better to check the V4L2 queue and dequeue operations for working versus non-working case.

Thanks,

Ramya

www.blackpeppertech.com

0 Kudos

1,246 Views
pierre-olivierh
Contributor III

Hi Ramya,

Thank you for the answer.

I'm capturing 1 buffer only in 13MPix mode of the camera because the camera can only do still image capture at this resolution. It's not a video.

I checked the origin of my issue and it seems to be a DMA/CMA allocation error.

I tried something:

- Change (in ipu_csi_enc.c) dma_alloc_coherent flags from GFP_DMA | GFP_KERNEL to GFP_DMA | GFP_ATOMIC

- set coherent_pool=256M in uboot kernel command line.

The error did not appear... BUT I have a vpu allocation error...

I've found a interesting patch https://community.nxp.com/thread/301711#comment-306408 

But it's for an older kernel, and I don't know how to apply it on mine (4.1.15), Can someone give me some help?

0 Kudos