Helper class for dma-heap allocations.
DMA heaps are kernel devices that provide an API to allocate memory from different pools called "heaps", wrap each allocated piece of memory in a dmabuf object, and return the dmabuf file descriptor to userspace. Multiple heaps can be provided by the system, with different properties for the underlying memory.
This class wraps a DMA heap selected at construction time, and exposes functions to manage memory allocation.
Construct a DmaHeap of a given type.
- Parameters
-
[in] | type | The type(s) of the dma-heap(s) to allocate from |
The DMA heap type is selected with the type parameter, which defaults to the CMA heap. If no heap of the given type can be accessed, the constructed DmaHeap instance is invalid as indicated by the isValid() function.
Multiple types can be selected by combining type flags, in which case the constructed DmaHeap will match one of the types. If the system provides multiple heaps that match the requested types, which heap is used is undefined.