dma_fence_add_callback(9)
β¨ dma_fence_add_callback(9) β¨
okay so this is a page straight out of the Kernel API Manual β like, the actual kernel docs bestie, not a vibe, real code π
πΈ NAME πΈ
dma_fence_add_callback β add a callback to be called when the fence is signaled
π SYNOPSIS π
int dma_fence_add_callback (struct dma_fence *fence , struct
dma_fence_cb *cb , dma_fence_func_t func );
π¦ ARGUMENTS π¦
fenceβ the fence you're waiting on, your main character π«Άcbβ the callback you're registering, the little assignment it getsfuncβ the actual function to call when it's go time
π DESCRIPTION π
So basically: this adds a software callback to the fence. The caller should keep a reference to the fence, no cap β that's on you, bestie.
cb gets initialized by dma_fence_add_callback itself, so no initialization by the caller is required. Iconic, honestly. You can register any number of callbacks to a single fence, but β and this is the part people mess up β a callback can only be registered to one fence at a time. One. Don't be greedy π«Ά
If fence is already signaled, this function will return -ENOENT and it will not call the callback. Like, it fully just doesn't. Not a vibe you can negotiate with.
β οΈ heads up: note that the callback can be called from an atomic context or irq context. Write your callback accordingly, fr fr.
Returns 0 in case of success, -ENOENT if the fence is already signaled, and -EINVAL in case of error. Those are the three moods π
π SEE ALSO π
Kernel file ./drivers/dma-buf/dma-fence.c, plus the whole friend group: DMA fences overview(9), 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_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) β yes that's all of them, every single one, I checked π§
and that's the page!! π it lives down in ./drivers/dma-buf, it's dated October 2026, and it answers to dma_fence_add_callback(9). mwah, go signal some fences responsibly βπ
π¦ 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