The RAM memory layout of the ConnectCore 8X is designed to allow all system features to work out of the box. However, some limitations occur when the amount of RAM memory is small.

There are different variants of the ConnectCore 8X with different RAM memory populations.

Reserved RAM memory

The i.MX8 device tree defines reserved memory regions in the reserved-memory node. Reserving these regions reduces the total amount of free memory in the system. Most have a small, fixed size and are meant for specific system features:

  • decoder_boot, to store the VPU decoder firmware: 32 MiB

  • encoder_boot, to store the VPU encoder firmware: 2 MiB

  • rpmsg_reserved, for the PCIe interface’s remote processor messaging virtio device: 4 MiB

  • rpmsg_dma_reserved, for the general purpose remote processor messaging virtio device: 28 MiB

  • decoder_rpc, to communicate with the VPU decoder: 2 MiB

  • encoder_rpc, to communicate with the VPU encoder: 2 MiB

  • dsp_reserved, for the audio digital signal processor driver: 32 MiB

  • encoder_reserved, for the VPU encoder driver: 8 MiB

These make up a total of 110 MB by default.

To change the sizes of these sections, you can use the digi,size-table device tree property. Said property contains rows of tuples that consist of the total RAM size and the size of the reserved region corresponding to that RAM size. Both values are specified in bytes in hexadecimal format. For example, if you want to use 16 MB for the rpmsg_dma_reserved region on variants with 1 GB of RAM or less, add the following code to your device tree:

ConnectCore 8X device tree example with a reduced region
/ {
...
	reserved-memory {
		rpmsg_dma@0x90400000 {
			digi,size-table = <
				/* RAM         Region*/
				0 0x40000000 0 0x1000000	/* 1 GB variants   -> 16 MB of rpmsg_dma */
				0 0x80000000 0 0x1C00000	/* 2 GB variants   -> 28 MB of rpmsg_dma */
			>;
		};
	};
...
};

Reducing the size of a feature’s reserved region might cause unexpected behavior. Make sure any custom sizes are sufficient for their respective feature to work properly, and make sure not to exceed their original value.

If you modify a region, you must use the node’s original name (including its address) as listed in the root .dtsi file.

The digi,size-table property can co-exist with the default size property to set the region size, and takes precedence if both properties are present. The leading zeroes before each value are necessary for the reserved memory driver to parse the property correctly.

Contiguous memory allocator (CMA)

Processes that require long, contiguous zones of memory, such as GPU and video playback, use the CMA region. CMA size is determined dynamically via a lookup table in the digi,size-table device tree property:

ConnectCore 8X device tree
/ {
...
	reserved-memory {
		linux,cma {
			digi,size-table = <
				/* RAM         CMA*/
				0 0x20000000 0 0x6000000	/* 512 MB variants -> 96 MB of CMA */
				0 0x40000000 0 0x14000000	/* 1 GB variants   -> 320 MB of CMA */
				0 0x80000000 0 0x28000000	/* 2 GB variants   -> 640 MB of CMA */
			>;
		};
	};
...
};

There is a section inside the CMA region reserved specifically for the GPU driver (Galcore). Although this section is not strictly necessary for the GPU to work, it streamlines graphics processing significantly. The size of this section is determined dynamically via a lookup table in the digi,contiguous-size-table device tree property of the GPU node.

ConnectCore 8X device tree
&imx8_gpu_ss {
	/*
	 * Use a table to set a fixed amount of contiguous memory used by the GPU
	 * per memory configuration. This way we leave plenty of room for the
	 * other system features when the memory is limited. The table's rows must
	 * be in increasing RAM order. The GPU CMA should always be smaller than the
	 * total CMA (see the table in the "reserved-memory" node to see the total CMA
	 * values per memory configuration).
	 */
	digi,contiguous-size-table = <
		/* RAM     CMA*/
		0x20000000 0x2000000	/* 512 MB variants -> 32 MB of GPU CMA */
		0x40000000 0x8000000	/* 1 GB variants   -> 128 MB of GPU CMA */
		0x80000000 0x10000000	/* 2 GB variants   -> 256 MB of GPU CMA */
	>;
};

The chosen values in these tables ensure that all components have sufficient memory when total memory is limited. In a production scenario, it is likely that not all features will be used, so you may need to customize these values for your specific use case.

Examples

The following examples describe scenarios that may require you to reallocate or adjust memory.

If your specific use case is a mix of two or more examples (for example, video playback plus an application requiring a large memory footprint), adjust the memory levels until you find an acceptable balance.

High-definition video playback

High-definition video playback requires a large amount of CMA memory. You must either increase the total CMA region size, reduce the GPU section, or use some combination of both.

Graphical application

To make graphical applications run as smoothly as possible, increase the size of the CMA memory section reserved for the GPU. If this is still not enough, increase the total CMA to make the GPU section larger.

Application with large memory footprint

Applications that require a large amount of memory may be limited by other running processes and reserved memory regions. To make sure an application with a large memory footprint runs optimally, reduce the size of the CMA region (or any other reserved region). Digi recommends you also reduce the CMA memory section reserved for the GPU to avoid possible errors. Another option is to remove unnecessary packages from the filesystem. For example, the XWayland desktop backend consumes a lot of memory, so if a desktop environment is not essential you can use non-graphical images instead.

Possible effects when memory is low

  • Having large reserved regions and not a lot of space for normal userspace processes can cause services like NetworkManager to crash. This reduces application performance, and the oom_reaper may terminate applications suddenly.

  • Insufficient free CMA space will result in video playback issues. 64 MB of free space is enough to play videos up to 720p. For higher-definition videos, use the following recommended values:

    • To play 1080p videos, allocate at least 192 MB.

    • To play 4K videos, allocate at least 384 MB.

  • Having a small CMA memory section reserved for the GPU will result in slightly decreased performance of graphical applications.

Disable non-used features that reserve RAM memory

If you don’t plan to use a feature that has an associated reserved region, you can remove it entirely. For example, if you don’t plan on using the VPU for video decoding or encoding, add the following code at the end of your device tree:

ConnectCore 8X device tree example with removed VPU support
...
/delete-node/ &vpu_decoder;
/delete-node/ &vpu_encoder;
/delete-node/ &{/reserved-memory/decoder_boot@0x84000000};
/delete-node/ &{/reserved-memory/encoder_boot@0x86000000};
/delete-node/ &{/reserved-memory/decoder_rpc@0x92000000};
/delete-node/ &{/reserved-memory/encoder_rpc@0x92200000};
/delete-node/ &{/reserved-memory/encoder_reserved@0x94400000};
To avoid device tree compilation errors, make sure to also remove the node that refers to the erased regions (in this case, vpu_decoder and vpu_encoder). Digi also recommends removing the associated configuration(s) from the kernel defconfig (in this case, CONFIG_MXC_VPU_MALONE and CONFIG_MXC_VPU_WINDSOR, respectively) to optimize the kernel’s size.