xref: /linux/Documentation/userspace-api/dma-buf-heaps.rst (revision 260f6f4fda93c8485c8037865c941b42b9cba5d2)
1.. SPDX-License-Identifier: GPL-2.0
2
3==============================
4Allocating dma-buf using heaps
5==============================
6
7Dma-buf Heaps are a way for userspace to allocate dma-buf objects. They are
8typically used to allocate buffers from a specific allocation pool, or to share
9buffers across frameworks.
10
11Heaps
12=====
13
14A heap represents a specific allocator. The Linux kernel currently supports the
15following heaps:
16
17 - The ``system`` heap allocates virtually contiguous, cacheable, buffers.
18
19 - The ``cma`` heap allocates physically contiguous, cacheable,
20   buffers. Only present if a CMA region is present. Such a region is
21   usually created either through the kernel commandline through the
22   ``cma`` parameter, a memory region Device-Tree node with the
23   ``linux,cma-default`` property set, or through the ``CMA_SIZE_MBYTES`` or
24   ``CMA_SIZE_PERCENTAGE`` Kconfig options. The heap's name in devtmpfs is
25   ``default_cma_region``. For backwards compatibility, when the
26   ``DMABUF_HEAPS_CMA_LEGACY`` Kconfig option is set, a duplicate node is
27   created following legacy naming conventions; the legacy name might be
28   ``reserved``, ``linux,cma``, or ``default-pool``.
29