drm_gem_prime_fd_to_handle(9)
π drm_gem_prime_fd_to_handle(9) β the Kernel API Manual page bestie edition π
okay so before we even start: this is drm_gem_prime_fd_to_handle, and it lives in the Kernel API Manual. yes, the whole manual. she's kind of a big deal β¨
πΈ NAME πΈ
drm_gem_prime_fd_to_handle β the PRIME import function for GEM drivers. that's the vibe. that's the whole job π
π¦ SYNOPSIS π¦
int drm_gem_prime_fd_to_handle (struct drm_device *dev , struct drm_file
*file_priv , int prime_fd , uint32_t *handle );
like, that's the signature. she takes four things and gives you back a int. no cap π«Ά
β ARGUMENTS β
devβ thedrm_deviceyou're importing into. this is the destination, the main character, the place things land πfile_privβ the drm file-private structure. you know her, you love her πprime_fdβ the fd id of the dma-buf that should be imported. yes, the fd. that one πhandleβ a pointer to storage for the handle of the imported buffer object. you're handing her an empty spot on the shelf and she fills it in π
π₯ DESCRIPTION π₯
okay so this is the PRIME import function, and listen β GEM drivers must use it. mandatorily. no vibes-based workarounds, no "but mine is special". she's the one that makes sure the underlying GEM object's lifetime management is handled correctly, and honestly? she ate π
the actual importing of the GEM object from the dma-buf is done through the drm_driver.gem_prime_import driver callback β so that's where the real lifting happens, this function is the whole correct-lifetime wrapper around it π§
Returns 0 on success, or a negative error code on failure. that's it, that's the contract π
π SEE ALSO π
literally the entire friend group, go say hi π
- 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_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_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)
aaaand that's the page!! source lives at ./drivers/gpu/drm, dated October 2026, and it's the drm_gem_prime_fd_to_handle(9) manual page π stay hydrated, read your lifetime rules, and don't leak your GEM objects bestie πβ¨π¦
π¦ 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