dma-heap

Crates.iodma-heap
lib.rsdma-heap
version0.4.0
sourcesrc
created_at2021-06-02 13:31:19.100795
updated_at2024-02-15 10:18:59.31656
descriptionLinux DMA-Buf Heap Abstraction Library
homepage
repositoryhttps://github.com/mripard/dma-heap/
max_upload_size
id405294
size18,965
Maxime Ripard (mripard)

documentation

README

DMA-Buf Heap Helper Library

The DMA-Buf Heap interface in Linux is aimed at providing a way for the user-space to allocate memory buffers that can be efficiently shared between multiple devices through the DMA-Buf mechanism. It aims at superseeding the ION Interface previously found in Android.

This library provides a safe abstraction over this interface for Rust.

Hello World

use std::os::unix::io::OwnedFd;
use dma_heap::{Heap, HeapKind};

let heap = Heap::new(HeapKind::Cma)
    .unwrap();

// Buffer will automatically be freed when `buffer` goes out of scope.
let buffer: OwnedFd = heap.allocate(1024).unwrap();
Commit count: 44

cargo fmt