STRUCT DRM_I915_GEM_USERPTR(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct drm_i915_gem_userptr

okay so bestie, welcome to the Kernel API Manual ✨ this is the page for struct drm_i915_gem_userptr, and it's literally the whole vibe of "hey kernel, please make me a GEM object out of memory I already allocated" 🫢


🌈 NAME

struct drm_i915_gem_userptr β€” Create GEM object from user allocated memory. that's it, that's the whole thing, and it's iconic πŸ’–


✨ SYNOPSIS

struct drm_i915_gem_userptr {
    __u64 user_ptr;
    __u64 user_size;
    __u32 flags;
  #define I915_USERPTR_READ_ONLY 0x1;
  #define I915_USERPTR_PROBE 0x2;
  #define I915_USERPTR_UNSYNCHRONIZED 0x80000000;
    __u32 handle;
 };

πŸŽ€ Members

  • user_ptr β€” the pointer to the allocated memory. so like, your memory, the one you brought to the party πŸŽ‰

Needs to be aligned to PAGE_SIZE. no cap, this one's non-negotiable.

  • user_size β€” the size in bytes for the allocated memory. this also becomes the object size, so it's giving "two for one" energy πŸ’…

Needs to be aligned to PAGE_SIZE, and should be at least PAGE_SIZE, or larger. (yes, both. it's an and situation, not an or situation 😭)

  • flags β€” supported flags are, like, right here ⬇️

πŸ¦‹ I915_USERPTR_READ_ONLY

mark the object as readonly β€” and this also means GPU access can only be readonly. this is only supported on HW which supports readonly access through the GTT. if the HW can't support readonly access, an error is returned. so like, vibe check first, bestie πŸ™ˆ

πŸ“ I915_USERPTR_PROBE

probe the provided user_ptr range and validate that the user_ptr is indeed pointing to normal memory and that the range is also valid. for example if some garbage address is given to the kernel, then this should complain. honestly? fair. πŸ’€

Returns -EFAULT if the probe failed.

note that this doesn't populate the backing pages, and also doesn't guarantee that the object will remain valid when the object is eventually used. so it's a vibe check, not a promise πŸ’”

The kernel supports this feature if I915_PARAM_HAS_USERPTR_PROBE returns a non-zero value.

🌸 I915_USERPTR_UNSYNCHRONIZED

NOT USED. setting this flag will result in an error. it's giving "left on read" 🫠

⭐ handle

returned handle for the object. 🎁

Object handles are nonzero.


πŸ‘‘ Description

userptr objects have several restrictions on what ioctls can be used with the object handle. that's the whole description, bestie β€” short, mysterious, main character energy 🌈


πŸ”₯ SEE ALSO

like, go read all of these too, iykyk πŸ’œ

  • Kernel file ./tools/perf/trace/beauty/include/uapi/drm/i915_drm.h
  • uevents generated by i915 on its device node(9)
  • struct i915_user_extension(9)
  • enum drm_i915_gem_engine_class(9)
  • struct i915_engine_class_instance(9)
  • perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915(9)
  • struct drm_i915_getparam(9)
  • drm_i915_getparam_t(9)
  • struct drm_i915_gem_mmap_offset(9)
  • struct drm_i915_gem_set_domain(9)
  • struct drm_i915_gem_exec_fence(9)
  • struct drm_i915_gem_execbuffer_ext_timeline_fences(9)
  • struct drm_i915_gem_execbuffer2(9)
  • struct drm_i915_gem_caching(9)
  • struct drm_i915_gem_context_create_ext(9)
  • struct drm_i915_gem_context_param(9)
  • Virtual Engine uAPI(9)
  • struct i915_context_engines_parallel_submit(9)
  • Context Engine Map uAPI(9)
  • struct drm_i915_gem_context_create_ext_setparam(9)
  • struct drm_i915_gem_vm_control(9)
  • struct drm_i915_perf_oa_config(9)
  • struct drm_i915_query_item(9)
  • struct drm_i915_query(9)
  • struct drm_i915_query_topology_info(9)
  • Engine Discovery uAPI(9)
  • struct drm_i915_engine_info(9)
  • struct drm_i915_query_engine_info(9)
  • struct drm_i915_query_perf_config(9)
  • enum drm_i915_gem_memory_class(9)
  • struct drm_i915_gem_memory_class_instance(9)
  • struct drm_i915_memory_region_info(9)
  • struct drm_i915_query_memory_regions(9)
  • struct drm_i915_query_guc_submission_version(9)
  • GuC HWCONFIG blob uAPI(9)
  • struct drm_i915_gem_create_ext(9)
  • struct drm_i915_gem_create_ext_memory_regions(9)
  • struct drm_i915_gem_create_ext_protected_content(9)
  • struct drm_i915_gem_create_ext_set_pat(9)

and that's the page, bestie 🧚 source/version was ./tools/perf/trace/beauty/incl... and the date on it is October 2026 β€” so go forth and align your pointers to PAGE_SIZE πŸ’–πŸ’…βœ¨

πŸ“¦ where this page comes from