drm_gem_map_detach(9)
π drm_gem_map_detach(9) β like, the Kernel API Manual page, but make it make sense π«Ά
okay so bestie, you're in the Kernel API Manual and today's main character is drm_gem_map_detach(9). yes it's a function page. yes it's about dma_buf detach for GEM. no you may not skip it. sit down, hydrate, let's go π
β¨ NAME β¨
drm_gem_map_detach β the dma_buf detach implementation for GEM, and honestly? she's the cleanup queen we all need πΈ
π SYNOPSIS π
void drm_gem_map_detach (struct dma_buf *dma_buf , struct
dma_buf_attachment *attach );
that's it. that's the whole signature. void return, no drama, no return value to obsess over π
π¦ ARGUMENTS π¦
dma_bufβ the buffer you're detaching from. like, the thing being left behind πattachβ the attachment that's getting detached. she's the one packing her bags π
β DESCRIPTION β
so here's the tea πΈ: this calls drm_gem_object_funcs.pin for the device-specific handling β that's the little hook where your driver gets to do its own thing, iykyk.
then it cleans up the dma_buf_attachment that came from drm_gem_map_attach. like, the messy post-hangout cleanup energy. leaving no crumbs π§
and the slay part: you can literally use this as the dma_buf_ops.detach callback. drop it in, it just works. iconic π
π₯ SEE ALSO π₯
okay this list is long and I respect it so much. every single one, no skips, periodt:
- Kernel file
./drivers/gpu/drm/drm_prime.coverview and lifetime rules(9) drm_gem_dmabuf_export(9)drm_gem_dmabuf_release(9)drm_gem_prime_fd_to_handle(9)drm_gem_prime_handle_to_dmabuf(9)drm_gem_prime_handle_to_fd(9)- PRIME Helpers(9)
drm_gem_map_attach(9)drm_gem_map_dma_buf(9)drm_gem_unmap_dma_buf(9)drm_gem_dmabuf_vmap(9)drm_gem_dmabuf_vunmap(9)drm_gem_prime_mmap(9)drm_gem_dmabuf_mmap(9)drm_prime_pages_to_sg(9)drm_prime_get_contiguous_size(9)drm_gem_prime_export(9)drm_gem_is_prime_exported_dma_buf(9)drm_gem_prime_import_dev(9)drm_gem_prime_import(9)drm_prime_sg_to_page_array(9)drm_prime_sg_to_dma_addr_array(9)drm_prime_gem_destroy(9)
fr fr, go read the drm_prime.c overview if you want the whole lifetime-rules lore. that's where the backstory lives π
and that's the page, bestie β¨ this one's brought to you straight out of ./drivers/gpu/drm, dated October 2026 β so go forth, detach those dma_buf_attachments responsibly, and remember: cleanup is a love language πππ¦
π¦ 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