drm_gem_dma_..._with_handle(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drm_gem_dma_create_with_handle β€” Kernel API Manual ✨

okay bestie, welcome to the drm_gem_dma_..._with_handle(9) page (yes the title got shortened with ... and no we will not be discussing it, it's giving mysterious). this is the Kernel API Manual and today we're learning how GEM objects get born and handed a little name tag πŸŽ€


🌸 NAME 🌸

drm_gem_dma_create_with_handle β€” allocate an object with the given size and return a GEM handle to it. that's it, that's the whole vibe. allocate, register, hand back a handle. iconic behavior honestly πŸ‘‘


✨ SYNOPSIS ✨

struct drm_gem_dma_object * drm_gem_dma_create_with_handle (struct
drm_file *file_priv , struct drm_device *drm , size_t size , uint32_t
*handle );

like, structure-wise: it hands you back a struct drm_gem_dma_object *, and it takes four things. we'll go through them one by one, don't worry 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • file_priv β€” the DRM file-private structure you're registering the handle for. it's the "whose name tag is this" of it all πŸ’–
  • drm β€” the DRM device. the main character, the whole device, the icon πŸŽ€
  • size β€” size of the object to allocate. how much memory we're claiming, fr fr πŸ“
  • handle β€” return location for the GEM handle. this is where the shiny new handle gets dropped off for you 🌈

πŸ’œ DESCRIPTION πŸ’œ

so what does this thing actually do? it creates a DMA GEM object, allocating a chunk of memory as backing store. literally building the whole thing from scratch, no cap ✨

then β€” and this is the slay part β€” the GEM object gets added to the list of objects associated with the given file, and a handle to it is returned. it's registered, it's official, it's in the group chat now πŸ’…

and listen: the allocated memory will occupy a contiguous chunk of bus address space. contiguous. one chunk. no gaps. that's the whole point bestie πŸ”₯

for more details, go see drm_gem_dma_create. it's got the lore iykyk πŸ“–

⭐ RETURN ⭐

on success you get a struct drm_gem_dma_object * β€” yay πŸŽ‰

on failure you get a ERR_PTR-encoded negative error code. so like, it's still a pointer, but it's a pointer that's screaming an error at you through encoding. check it, bestie, always check it 😭


🌈 SEE ALSO 🌈

Kernel file ./drivers/gpu/drm/drm_gem_dma_helper.c β€” that's the home base 🏠

and the whole friend group:


and that's the page!! 🫢 this whole thing lives under ./drivers/gpu/drm, dated October 2026, and the page itself is drm_gem_dma_..._with_handle(9) β€” go off, kernel docs, you ate πŸ’…πŸ’–βœ¨
πŸ“¦ where this page comes from