Hello! I'm working with pico mini B (64MB) and currently my goal is to build video pipeline using v4l2 api (due to problems with ffmpeg). The problem is that i can not allocate memory buffers for resolution more than 640x480, when camera officially supports 2304x1296. I've reduced RK_BOOTARGS_CMA_SIZE to 1MB and with official buildroot image i have about 40MB free RAM:
Assuming that we use NV12 pixel format, which should take 2304 * 1296 * 1.5 = 4,478,976 bytes for one raw image buffer, which quite big amount of memory, but i have 40,000,000 bytes. The only problem, i suppose, may be that pico's memory is fragmented and kernel can't find continious memory buffer. According to v4l2-ctl output with default streaming command, we allocating 2 memory buffers, which doubles this size up to almost 10MB, but still sounds fairly possible:
I tried to allocate my own memory buffer in my own application:
Code: Select all
uint8_t *pMemory = static_cast<uint8_t*>(malloc(2304 * 1296 * 3 * sizeof(uint8_t)));
memset(pMemory, 0, 2304*1296*3);
And this actually works!
But trying to set up stream with 2304*1296 resolution causes allocation error:
Maybe kernel-space driver memory buffer allocation is not that simple as just calling malloc from user-space app, but i still do not understand why this is not working. Maybe someone else had this problem? Any information would be helpful!