Decoder memory allocation failure on imx8

Dear community,

we would like to use the hardware decoder of the imx8 to decode a h264 stream with a resolution of 1920x1080 using the v4l2h264dec gstreamer element. Until recently the decoder was working fine.

We want to switch to a new bsp with linux-toradex-4.14-2.3.x. With the new bsp the decoder only works for streams with a resolution less than 800x800 pixel, for 1920x1080 we get:

[  271.751897] [VPU Decoder] firmware version is 1.5.6 
[  271.815314] vpu-b0 2c000000.vpu_decoder: dma_alloc_coherent of size 3145728 failed 
[  271.825432] [VPU Decoder] error: alloc_dma_buffer() dma buffer alloc size(120000) fail! 
[  271.825454] [VPU Decoder] error: alloc mbi buffer[1]

Gstreamer and plugin version is 1.14.4, decoder firmware version 1.5.6 in both old and new bsp. We have noticed that the output of “cat /proc/meminfo | grep Cma” changed. It was

CmaTotal:         983040 kB
CmaFree:          712392 kB

in the old bsp with linux-toradex_4.14-2.0.x, now it is

CmaTotal:         327680 kB
CmaFree:           57420 kB

in idle state. I am not aware of any explicit changes we did to the memory.

Are we correct with the assumption that the allocation problem is related to the difference in cma memory? If yes, how can we enlarge the cma memory in yocto?

The bsp where the decoder works is Toradex System/Computer on Modules - Linux BSP Release, the new one is using Toradex System/Computer on Modules - Linux BSP Release

CMA memory allocation size was not changed from 4.14-2.0.x to 4.14-2.3.x
However you can increase it just by Device Tree modification. Please check -

Thank you very much. I was able to increase CMA memory by increasing CONFIG_CMA_SIZE_MBYTES in the .config file from 320 to 960. It now shows the same cma memory as before and the decoder is working.

Thank you for feedback. Glad you problem solved.