This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDXEVM368: vpfe-capture: dma_alloc_coherent size ... failed

Part Number: TMDXEVM368

I am currently using a Mistral DM36x EVM (TMDXEVM368, in particular). I see that G-Streamer v0.1 is included in the filesystem provided by Mistral in the SD-Card contained in the package, and I am using that to run a simple video capture app.

However, I see that VPFE-Capture is unable to allocate memory for a frame since the DMA coherent size is inadequate. This problem repeats when I use a V4L2 capture app to read from /dev/video0 instead of G-Streamer.

Indeed, /dev/video0 is a valid V4L2 input device, looking at its properties:

Driver Info (not using libv4l2):
Driver name : vpfe-capture
Card type : DM365 EVM
Bus info : VPFE
Driver version: 0.0.1
Capabilities : 0x04000001
Video Capture
Streaming
Video input : 0 (Composite: ok)
Video Standard = 0x0000f900
PAL-M/60
NTSC-M/M-JP/443/M-KR
Format Video Capture:
Width/Height : 720/480
Pixel Format : 'UYVY'
Field : Interlaced
Bytes per Line : 1440
Size Image : 691200
Colorspace : SMPTE 170M
Transfer Function : Unknown (c1f4dc60)
YCbCr Encoding : Unknown (c1f4dc58)
Quantization : Unknown (c1f4dc74)
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 720, Height 480
Default : Left 0, Top 0, Width 720, Height 480
Pixel Aspect: 11/10
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 720, Height 480
Default : Left 0, Top 0, Width 720, Height 480
Pixel Aspect: 11/10
Crop: Left 0, Top 0, Width 720, Height 480
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: invalid (0/0)
Read buffers : 0
brightness (int) : min=0 max=255 step=1 default=128 value=128 flags=slider
contrast (int) : min=0 max=255 step=1 default=128 value=128 flags=slider
saturation (int) : min=0 max=255 step=1 default=128 value=128 flags=slider
hue (int) : min=-180 max=180 step=180 default=0 value=0 flags=slider
gain_automatic (bool) : default=1 value=1

The following is a verbose log of the page allocation error:

vpfe-capture vpfe-capture: width = 720, height = 576, bpp = 2
vpfe-capture vpfe-capture: adjusted width = 720, height = 480, bpp = 2, bytesperline = 1440, sizeimage = 691200
captureFrame: page allocation failure. order:8, mode:0xd0
Backtrace:
[<c00305f4>] (dump_backtrace+0x0/0x114) from [<c031b154>] (dump_stack+0x18/0x1c)
r7:00000008 r6:000000d0 r5:00000000 r4:00000000
[<c031b13c>] (dump_stack+0x0/0x1c) from [<c007afa4>] (__alloc_pages_nodemask+0x4a0/0x500)
[<c007ab04>] (__alloc_pages_nodemask+0x0/0x500) from [<c00320d8>] (__dma_alloc+0x160/0x3fc)
[<c0031f78>] (__dma_alloc+0x0/0x3fc) from [<c0032400>] (dma_alloc_coherent+0x58/0x64)
[<c00323a8>] (dma_alloc_coherent+0x0/0x64) from [<c02313fc>] (__videobuf_mmap_mapper+0x118/0x224)
r7:c203d900 r6:c1150e14 r5:c22342e4 r4:c1ef5bb0
[<c02312e4>] (__videobuf_mmap_mapper+0x0/0x224) from [<c022f450>] (videobuf_mmap_mapper+0x64/0x94)
r8:00000000 r7:c203d900 r6:40150000 r5:c1ef5bb0 r4:c1150e14
[<c022f3ec>] (videobuf_mmap_mapper+0x0/0x94) from [<c0235c60>] (vpfe_mmap+0x48/0x54)
r5:c1ef5bb0 r4:c1150c00
[<c0235c18>] (vpfe_mmap+0x0/0x54) from [<c02254b4>] (v4l2_mmap+0x40/0x4c)
r5:c1ef5bb0 r4:c203d900
[<c0225474>] (v4l2_mmap+0x0/0x4c) from [<c008fb0c>] (mmap_region+0x220/0x42c)
r5:c1ef5bb0 r4:000000ff
[<c008f8ec>] (mmap_region+0x0/0x42c) from [<c008ffdc>] (do_mmap_pgoff+0x2c4/0x324)
[<c008fd18>] (do_mmap_pgoff+0x0/0x324) from [<c0085a58>] (sys_mmap_pgoff+0xa0/0xd0)
[<c00859b8>] (sys_mmap_pgoff+0x0/0xd0) from [<c002cf40>] (ret_fast_syscall+0x0/0x28)
Mem-info:
DMA per-cpu:
CPU 0: hi: 6, btch: 1 usd: 5
active_anon:702 inactive_anon:746 isolated_anon:0
active_file:24 inactive_file:158 isolated_file:0
unevictable:0 dirty:0 writeback:0 unstable:0
free:6901 slab_reclaimable:254 slab_unreclaimable:983
mapped:45 shmem:49 pagetables:59 bounce:0
DMA free:27448kB min:880kB low:1100kB high:1320kB active_anon:2808kB inactive_anon:2984kB active_file:96kB inactive_file:800kB unevictable:0kBo
lowmem_reserve[]: 0 0 0
DMA: 236*4kB 376*8kB 244*16kB 134*32kB 58*64kB 27*128kB 22*256kB 5*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB = 27504kB
278 total pagecache pages
12288 pages of RAM
6939 free pages
2140 reserved pages
822 slab pages
118 pages shared
0 pages swap cached
vpfe-capture vpfe-capture: dma_alloc_coherent size 692224 failed
mmap: Cannot allocate memory

Should this be something to do with insufficient size of the DMA-consistent memory region (CONSISTENT_DMA_SIZE)? Currently, this has been defined as 2MB, while it can be increased till 14MB in multiples of 2MB.

Thanks,

Anirudh