DMA FENCES OVERVIEW(9)
π 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 callingsync_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 tosync_file, adrm_syncobjallows 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_bufinstances. such implicit fences are stored instruct dma_resvthrough thedma_buf.resvpointer. it's the "it just comes with the bag" of fencing π
π¦ SEE ALSO π¦
the whole friend group, assembly-style π β
- Kernel file
./drivers/dma-buf/dma-fence.c fence cross-driver contract(9)dma_fence_get_stub(9)dma_fence_allocate_private_stub(9)dma_fence_context_alloc(9)fence signalling annotation(9)dma_fence_begin_signalling(9)dma_fence_end_signalling(9)dma_fence_signal_timestamp_locked(9)dma_fence_signal_timestamp(9)dma_fence_signal_locked(9)dma_fence_check_and_signal_locked(9)dma_fence_check_and_signal(9)dma_fence_signal(9)dma_fence_wait_timeout(9)dma_fence_release(9)dma_fence_free(9)dma_fence_enable_signaling(9)dma_fence_add_callback(9)dma_fence_get_status(9)dma_fence_remove_callback(9)dma_fence_default_wait(9)dma_fence_wait_any_timeout(9)deadline hints(9)dma_fence_set_deadline(9)dma_fence_describe(9)dma_fence_init(9)dma_fence_init64(9)dma_fence_driver_name(9)dma_fence_timeline_name(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms