DRM_IOCTL_PR...HANDLE_TO_FD(9)
π 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:
- Kernel file
./tools/perf/trace/beauty/include/uapi/drm/drm.hstruct drm_gem_close(9)struct drm_gem_flink(9)struct drm_gem_open(9)struct drm_gem_change_handle(9)DRM_CAP_DUMB_BUFFER(9)DRM_CAP_VBLANK_HIGH_CRTC(9)DRM_CAP_DUMB_PREFERRED_DEPTH(9)DRM_CAP_DUMB_PREFER_SHADOW(9)DRM_CAP_PRIME(9)DRM_PRIME_CAP_IMPORT(9)DRM_PRIME_CAP_EXPORT(9)DRM_CAP_TIMESTAMP_MONOTONIC(9)DRM_CAP_ASYNC_PAGE_FLIP(9)DRM_CAP_CURSOR_WIDTH(9)DRM_CAP_CURSOR_HEIGHT(9)DRM_CAP_ADDFB2_MODIFIERS(9)DRM_CAP_PAGE_FLIP_TARGET(9)DRM_CAP_CRTC_IN_VBLANK_EVENT(9)DRM_CAP_SYNCOBJ(9)DRM_CAP_SYNCOBJ_TIMELINE(9)DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP(9)DRM_CLIENT_CAP_STEREO_3D(9)DRM_CLIENT_CAP_UNIVERSAL_PLANES(9)DRM_CLIENT_CAP_ATOMIC(9)DRM_CLIENT_CAP_ASPECT_RATIO(9)DRM_CLIENT_CAP_WRITEBACK_CONNECTORS(9)DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT(9)DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE(9)struct drm_syncobj_eventfd(9)DRM_IOCTL_GEM_CLOSE(9)DRM_IOCTL_PRIME_FD_TO_HANDLE(9)DRM_IOCTL_MODE_RMFB(9)DRM_IOCTL_MODE_CREATE_DUMB(9)DRM_IOCTL_MODE_GETFB2(9)DRM_IOCTL_SYNCOBJ_EVENTFD(9)DRM_IOCTL_MODE_CLOSEFB(9)DRM_IOCTL_SET_CLIENT_NAME(9)DRM_IOCTL_GEM_CHANGE_HANDLE(9)struct drm_event(9)DRM_EVENT_VBLANK(9)DRM_EVENT_FLIP_COMPLETE(9)DRM_EVENT_CRTC_SEQUENCE(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms