DMA FENCES OVERVIEW(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… DMA fences overview(9) πŸ’…

okay so this is a page from the Kernel API Manual, and honestly? it's a whole vibe. bestie, we're talking about fences β€” not the wooden kind, the sync kind. let's get into it 🫢


✨ NAME ✨

DMA fences overview β€” the whole entire rundown on how DMA fences work, no gatekeeping πŸ’–


🌸 DESCRIPTION 🌸

So. DMA fences, represented by struct dma_fence, are the kernel's internal synchronization primitive for DMA operations β€” think GPU rendering, video encoding/decoding, or displaying buffers on a screen. yes literally all of that. it's giving "traffic controller but make it silicon" πŸ‘‘

A fence gets initialized using dma_fence_init and completed using dma_fence_signal. fences are associated with a context, allocated through dma_fence_context_alloc, and β€” important β€” all fences on the same context are fully ordered. no cap. same context = strict order, always πŸ”₯

Since the whole point of fences is to facilitate cross-device and cross-application synchronization, there's multiple ways to use one:

  • Individual fences can be exposed as a sync_file, accessed as a file descriptor from userspace, created by calling sync_file_create. this one's called explicit fencing, since userspace passes around explicit synchronization points. very demure, very mindful, very "here is my sync point, hand-delivered" πŸŽ€
  • Some subsystems also have their own explicit fencing primitives, like drm_syncobj. compared to sync_file, a drm_syncobj allows the underlying fence to be updated. glow-up behavior fr fr ✨
  • Then there's also implicit fencing, where the synchronization points are implicitly passed around as part of shared dma_buf instances. such implicit fences are stored in struct dma_resv through the dma_buf.resv pointer. it's the "it just comes with the bag" of fencing πŸ‘œ

πŸ¦‹ SEE ALSO πŸ¦‹

the whole friend group, assembly-style 😭 β€”


and that's the tea β˜• this page lives in ./drivers/dma-buf, it's dated October 2026, and honestly? iconic. go read it again if you need to, i'll wait πŸ’œπŸ§š

πŸ“¦ where this page comes from