DRM_IOCTL_GEM_CLOSE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

Okay so this is the DRM_IOCTL_GEM_CLOSE(9) page from the Kernel API Manual, and it is literally about closing a GEM handle. Bestie, the whole thing is a lifetime-management PSA and I'm obsessed. πŸ’…

  • DRM_IOCTL_GEM_CLOSE β€” Close a GEM handle. Periodt. ✨

✨ SYNOPSIS ✨

DRM_IOCTL_GEM_CLOSE

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay gather round, because this is the important part: GEM handles are not reference-counted by the kernel. Like, at all. User-space is responsible for managing their lifetime, so that's your job β€” not the kernel's. πŸ™ˆ

Example time πŸ’€: if user-space imports the same memory object twice on the same DRM file description, the same GEM handle is returned by both imports, and user-space needs to ensure DRM_IOCTL_GEM_CLOSE is performed once only. Once. Not twice. That's the whole assignment, bestie. 😭

The same situation can happen when a memory object is allocated, then exported and imported again on the same DRM file description. Same energy, same once-only rule. 🫢

But plot twist ✨: the DRM_IOCTL_MODE_GETFB2 IOCTL is an exception and always returns fresh new GEM handles even if an existing GEM handle already refers to the same memory object before the IOCTL is performed. Iconic exception behaviour, honestly. πŸ‘‘

⚠️ warning bestie: the kernel does not ref-count these handles, so lifetime management is 100% user-space's problem. Ensure DRM_IOCTL_GEM_CLOSE is performed once only β€” that's the vibe check. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

These are all the other pages and symbols in the source list β€” every single one, no skipping, iykyk 🫢:


k bye ily 🫢 β€” this lil page's source/version footer says ./tools/perf/trace/beauty/incl... and the date is October 2026, with the tag DRM_IOCTL_GEM_CLOSE(9) doing its main character thing. Mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from