drm_gem_prime_fd_to_handle(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the drm_device you'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 πŸ‘‹


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