DRM_IOCTL_PR...HANDLE_TO_FD(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… DRM_IOCTL_PRIME_HANDLE_TO_FD πŸ’…

okay bestie, welcome to the Kernel API Manual β€” yes, the whole manual, and yes this page is short but it's iconic. sit down, sip ur matcha, we're learning how to turn a GEM handle into a DMA-BUF file descriptor πŸ¦‹


✨ NAME ✨

DRM_IOCTL_PRIME_HANDLE_TO_FD β€” Convert a GEM handle to a DMA-BUF FD.

like, the whole personality of this ioctl is right there in the name ngl πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

DRM_IOCTL_PRIME_HANDLE_TO_FD

that's it. that's the synopsis. she's lowkey minimal and we respect it ✨


🌸 DESCRIPTION 🌸

so here's the vibe: user-space fills in drm_prime_handle.handle with the GEM handle it wants to export, plus drm_prime_handle.flags, and the kernel hands back a DMA-BUF file descriptor in drm_prime_handle.fd. literally that's the trade, handle in, fd out, no cap πŸ”₯

the export can fail for any driver-specific reason β€” for example because export is not supported for this specific GEM handle (but it might be for others πŸ‘€). so like, don't assume one failure means all failures, bestie, it's per-handle energy.

support for exporting DMA-BUFs is advertised via DRM_PRIME_CAP_EXPORT. that's ur vibe check before u even try 🫢


🧚 SEE ALSO 🧚

go off, cross-references, we love a thorough girlie:


and that's the page, bestie, u ate that πŸ’… this lil gem came from ./tools/perf/trace/beauty/incl... and it's dated October 2026 β€” go forth and export ur handles responsibly, mwah πŸŽ€πŸ’–πŸŒŸ

πŸ“¦ where this page comes from