drm_gem_cre..._offset_size(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ drm_gem_cre..._offset_size(9) ✨

okay bestie, welcome to the Kernel API Manual πŸ’– you're about to read all about drm_gem_create_mmap_offset_size and honestly? it's a little baddie of a function. let's get into it 🫢


🌸 NAME 🌸

drm_gem_create_mmap_offset_size β€” create a fake mmap offset for an object πŸ’… like yes it's fake, that's the whole point, don't @ me


⭐ SYNOPSIS ⭐

int drm_gem_create_mmap_offset_size (struct drm_gem_object *obj , size_t
size );

that's it, that's the whole signature, she's lowkey compact ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • obj β€” the obj in question πŸ‘€ like the actual GEM object you're doing this for
  • size β€” the virtual size πŸ¦‹ (not the physical size, keep that distinction in your head bestie, it matters)

πŸ’œ DESCRIPTION πŸ’œ

so here's the vibe: GEM memory mapping works by handing back to userspace a fake mmap offset β€” and yes, "fake" is the technical term, the kernel said what it said 😭 β€” which userspace can then use in a subsequent mmap(2) call. then the DRM core code looks up the object based on that offset and sets up all the various memory mapping structures. it's giving matchmaker energy fr fr πŸ’–

this routine allocates and attaches a fake offset for obj, specifically in the cases where the virtual size differs from the physical size (ie. drm_gem_object.size). otherwise?? just use drm_gem_create_mmap_offset, it's that simple bestie ✨

and here's the iconic part: this function is idempotent πŸ‘‘ and handles an already allocated mmap offset transparently. drivers do not need to check for this case. like at all. not even a little bit. she said "I got it" and she meant it πŸ’… periodt

ngl this is the kind of function that just works and doesn't make you think about it, which is the highest compliment I can give a kernel API 🌈

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/gpu/drm/drm_gem.c β€” and the whole squad, in order, no skips, we're doing the full roster 😀:


and that's the page!! πŸŽ€ this little love letter to the DRM core came from the source tree at ./drivers/gpu/drm, dated October 2026, and it lives forever under the name drm_gem_cre..._offset_size(9) ✨ mwah, go read your kernel docs bestie πŸ’–πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from