#linux #dma #heap #dma-buf

dma-heap

Linux DMA-Buf Heap Abstraction Library

3 unstable releases

0.2.1 Dec 13, 2022
0.2.0 Dec 13, 2022
0.1.0 Jun 2, 2021

#350 in Unix APIs

Download history 16/week @ 2023-05-31 15/week @ 2023-06-07 14/week @ 2023-06-14 26/week @ 2023-06-21 17/week @ 2023-06-28 26/week @ 2023-07-05 36/week @ 2023-07-12 30/week @ 2023-07-19 18/week @ 2023-07-26 16/week @ 2023-08-02 6/week @ 2023-08-09 30/week @ 2023-08-16 24/week @ 2023-08-23 16/week @ 2023-08-30 18/week @ 2023-09-06 26/week @ 2023-09-13

87 downloads per month

Custom license

7KB
98 lines

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();

Dependencies

~3MB
~66K SLoC