This document describes i.MX android memory usage, layout and configuration for the entire system.
Total DDR memory usage
When i.MX Android is running, the DDR memory will be used by the following components:
Linux Kernel reserved space, including:
kernel text, data section and initrd
kernel page tables
Normal zone space managed by kernel’s MM (high memory zone is also included)
Used by application by brk() or malloc() in libc
Used by kernel by mm api, like: kmalloc, dma_alloc, vmalloc
Reserved memory for GPU drivers, used by
GPU libs, drivers
Android surface view, normal surface buffers
VPUs working buffer and bitstream (we allocate the VPU buffer from GPU driver to make a unify method of allocation)
Reserved space for framebuffer BG triple buffers
Framebuffer display are always required to have triple and large buffers
The following diagram shows the default memory usage and layout on i.MX6Q/DL platform.
According to different type of product and different hardware configurations (ddr size, screen resolution, camera), customer may do some configurations to the memory layout and usage to optimize their system. Some memory reservation can be configured by command line or modifying the code.
The kernel reserved space cannot be adjusted. It is controlled by the kernel and the Normal zone size and it depends on the total DDR size and the reserved spaces.
Reserved GPU memory size can be adjusted by adding "gpumem=" parameters in kernel commandline. It's size is highly depends on the screen resolution, the video stream decoding requirement and the camera resolution, fps.
Reserved memory size for BG (background) framebuffer can be configured by command line
fbmem=<fb0 size>,<fb2 size>,<fb4 size>,<fb5 size>
If you have two display devices, one is XGA LVDS, the other is HDMI 1080p device (default 32bpp), you have to specify the BG buffer size for them: