drm_gem_dma...ort_sg_table(9)
β¨ drm_gem_dma_prime_import_sg_table β a whole little manual page from the Kernel API Manual β¨
okay bestie, gather round, because this one is genuinely such a neat little function and i need you to understand it π
πΈ NAME πΈ
drm_gem_dma_prime_import_sg_table β the function that produces a DMA GEM object out of another driver's scatter/gather table of pinned pages. it's giving "borrowed your notes but made them my whole personality" energy π«Ά
β¨ SYNOPSIS β¨
struct drm_gem_object * drm_gem_dma_prime_import_sg_table (struct drm_device *dev , struct dma_buf_attachment *attach , struct sg_table *sgt );
like, that's the whole vibe right there. three args in, one pointer out π
π ARGUMENTS π
devβ the device you're importing into. your home base πattachβ the DMA-BUF attachment. yes, that one π¦sgtβ the scatter/gather table of pinned pages. the whole reason we're here β
π DESCRIPTION π
okay so real talk: this function imports a scatter/gather table that some other driver exported via DMA-BUF. very "collab era" of it π€
but here's the caveat bestie, and it's a big one β imported buffers must be physically contiguous in memory. and no, that's not a soft suggestion, it's literally spelled out: the scatter/gather table must contain a single entry. one. uno. that's it. π
and if you're a driver that uses the DMA helpers? you should set this function as your drm_driver.gem_prime_import_sg_table callback. that's the assignment. periodt π
π₯ RETURN π₯
on success you get a pointer to a newly created GEM object β¨ β and on failure you get an ERR_PTR-encoded negative error code. so like, check it properly, don't just vibe-check the pointer and move on, i'm begging π
π SEE ALSO π
- the kernel file:
./drivers/gpu/drm/drm_gem_dma_helper.c dma helpers(9)__drm_gem_dma_create(9)drm_gem_dma_create(9)drm_gem_dma_create_with_handle(9)drm_gem_dma_free(9)drm_gem_dma_dumb_create_internal(9)drm_gem_dma_dumb_create(9)drm_gem_dma_get_unmapped_area(9)drm_gem_dma_print_info(9)drm_gem_dma_get_sg_table(9)drm_gem_dma_vmap(9)drm_gem_dma_mmap(9)drm_gem_dma_prime_import_sg_table_vmap(9)
heads up babe: that single-entry requirement is not decorative. physically contiguous or bust π
and that's the page!! sourced from ./drivers/gpu/drm, dated October 2026 β so go forth, import those sg tables responsibly, and remember: single entry only, no cap ππ¦πβ¨
π¦ 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