drm_gem_prime_import_dev(9)
π
drm_gem_prime_import_dev β core implementation of the import callback π
okay so real talk, we're in the Kernel API Manual, bestie. This is the DRM/graphics part of the kernel and honestly? it's giving main character energy β¨
π NAME π
drm_gem_prime_import_dev β literally the core implementation of the import callback. that's it, that's the vibe π
β¨ SYNOPSIS β¨
struct drm_gem_object * drm_gem_prime_import_dev (struct drm_device *dev
, struct dma_buf *dma_buf , struct device *attach_dev );
like, three args, one struct drm_gem_object * coming back at you. no cap π«Ά
πΈ ARGUMENTS πΈ
devβ thedrm_deviceyou're importing into πdma_bufβ the dma-buf object being imported, the whole reason we're here π¦attach_devβ thestruct devicethat gets dma_buf attach duty π
π DESCRIPTION π
So. This is the actual core of drm_gem_prime_import, highkey the moment everyone's been waiting for. It's designed to be called by drivers who want to use a different device structure than drm_device.dev for attaching via dma_buf. iykyk β you want a custom attach device, this is your girl π
Under the hood it calls drm_driver.gem_prime_import_sg_table internally. Like, that's not optional, that's just what happens β
π¨ listen up bestie, this is the important part π¨ Drivers must arrange to calldrm_prime_gem_destroyfrom theirdrm_gem_object_funcs.freehook when using this function. Not "should", not "maybe", must. don't fumble this one fr fr π
π¦ SEE ALSO π¦
the whole friend group, ok:
- 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_detach(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(9)drm_prime_sg_to_page_array(9)drm_prime_sg_to_dma_addr_array(9)drm_prime_gem_destroy(9)
k bye ily, go call drm_prime_gem_destroy from your drm_gem_object_funcs.free hook π
this page came straight outta ./drivers/gpu/drm, dated October 2026, and yes it's still called drm_gem_prime_import_dev(9) β slay πβ¨
π¦ 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