Wednesday, November 4, 2015

DMA Buffer Sharing

The need to share DMA buffers between drivers and applications is common in multimedia platforms.  Android's gralloc and Ion driver provide this and some other goodies, but Linaro's dmabuf buffer sharing driver provides a ligher-weight alternative which is plenty good for many situations. Here's a good comparison of Ion and dmabuf.

I'm a visual person and relate to diagrams more than I do to textual descriptions.  I use diagrams to quickly create a mental model of a subject-matter I'm learning, and use text to understand the fine details if I decide to dive in.  Towards this end I created the sequence diagrams below, to complement the dmabuf documentation and help me follow to interactions between the importer, exporter and application.  The kernel documentation is clear and concise, so I'm not adding further explanations, lest I detract more than I add.  Hopefully these diagram will help you, too.

I've used MSC Generator to generate the diagrams and I'm providing the source for that as well. Enjoy ;-)

dma-buf operations for device dma only
Kernel cpu access to a dma-buf buffer object


git clone
git clone