问题描述:
当点击录像后,终端打印如下的log信息:
[ 69.354381] rockchip_ion_cma: Fail to allocate(b6f000) buffer 04-01 15:20:40 video mpp_ion: ion_ioctl c0144900 failed with code -1: Operation not permitted 04-01 15:20:40 video mpp_ion: allocator_ion_alloc ion_alloc failed ret -1 04-01 15:20:40 video mpp_buffer: mpp_buffer_create failed to create buffer with size 11985408 04-01 15:20:40 video hal_h264e_rkv: h264e_rkv_allocate_buffers hw_rec_buf[1] get failed 04-01 15:20:40 video hal_h264e_rkv: hal_h264e_rkv_control allocate buffers failed 04-01 15:20:40 video mpp: command 320011 param 0xa4f1e618 ret -4 04-01 15:20:40 video mpi control pre alloc buff failedmpp_thread: MPP_THREAD_STOPPING status set mThread 0x4e3d58 04-01 15:20:40 video mpp_buffer: mpp_buffer_ref_dec found non-positive ref_count 0 caller h264e_rkv_allocate_buffers 04-01 15:20:40 video hal_h264e_rkv: h264e_rkv_free_buffers hw_dsp_buf[0] put failed
通过log信息发现是因为ion的内存不足所导致的。所以需要在linux内核中的dts文件中加大ion cam内存相关的大小。如下所示:修改到最大380M。问题即可得到解决。
ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
compatible = "rockchip,ion-heap";
rockchip,ion_heap = <4>;
// reg = <0x00000000 0x04400000>; /* 68MB */
// reg = <0x00000000 0x08000000>; /* 128MB */
// reg = <0x00000000 0x09000000>; /* 144MB */
// reg = <0x00000000 0x0C000000>; /* 192MB */
// reg = <0x00000000 0x11800000>; /* 280MB */
reg = <0x00000000 0x17C00000>; /* 380MB */
};