drm_gem_dma_...g_table_vmap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drm_gem_dma_...g_table_vmap πŸ’…

okay bestie, so this is a page straight out of the Kernel API Manual (section 9, kernel space, we're fancy like that) β€” the function is literally called drm_gem_dma_...g_table_vmap and yes the name got cut off mid-vibe, that's just how the title renders, don't come for me. 🫢


✨ NAME ✨

drm_gem_dma_prime_import_sg_table_vmap β€” PRIME import another driver's scatter/gather table and get the virtual address of the buffer. two things at once, main character multitasking energy. πŸ’…


🌸 SYNOPSIS 🌸

struct drm_gem_object * drm_gem_dma_prime_import_sg_table_vmap (struct
drm_device *dev , struct dma_buf_attachment *attach , struct sg_table
*sgt );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the DRM device. the whole ecosystem, basically. πŸ‘‘
  • attach β€” the DMA-BUF attachment. the situationship between the buffer and the device, iykyk. πŸ¦‹
  • sgt β€” scatter/gather table of pinned pages. little bits of memory, all gathered up, slay. ✨

πŸ’– DESCRIPTION πŸ’–

so the way this works: it imports a scatter/gather table using drm_gem_dma_prime_import_sg_table, and then it hits dma_buf_vmap to get the kernel virtual address. basically it makes absolutely sure a DMA GEM object always has its virtual address set β€” no object left behind, no cap. πŸ”₯ and that address? released automatically when the object is freed. built-in cleanup, we love to see it. 🧚

it can be used as the drm_driver.gem_prime_import_sg_table callback. and if you're feeling efficient (you are, you're iconic), the DRM_GEM_DMA_DRIVER_OPS_VMAP macro is the shortcut that sets up all the necessary DRM driver operations for you. one macro, zero stress. ⭐


🌈 RETURN 🌈

a pointer to a newly created GEM object β€” adorable, fresh out the box πŸ“ β€” or an ERR_PTR-encoded negative error code if it fails 😭. so like, always check. always. fr fr.


πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./drivers/gpu/drm/drm_gem_dma_helper.c β€” the home base πŸ’œ β€” plus the whole friend group:


ok that's the whole page, go read the source if you want more lore πŸ’€

sign-off time, besties 🫢 this one lives in ./drivers/gpu/drm, and it's stamped October 2026 β€” the version vibes are immaculate, drm_gem_dma_...g_table_vmap(9) forever πŸ‘‘βœ¨ no cap, periodt.

πŸ“¦ where this page comes from