STRUCT __DRM_I915_MEMORY_REGION_INFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct __drm_i915_memory_region_info(9) β€” Kernel API Manual πŸ’–

okay so this is a page from the Kernel API Manual, and it's literally all about one little struct that tells you everything the driver knows about a memory region. bestie, it's giving "backstage pass to your GPU's brain" energy 🧠✨


🌸 NAME 🌸

struct __drm_i915_memory_region_info β€” describes one region as known to the driver 🫢

✨ SYNOPSIS ✨

struct __drm_i915_memory_region_info {
    struct drm_i915_gem_memory_class_instance region;
    __u32 rsvd0;
    __u64 probed_size;
    __u64 unallocated_size;
    union {
      __u64 rsvd1[8];
      struct {
        __u64 probed_cpu_visible_size;
        __u64 unallocated_cpu_visible_size;
      };
    };
 };

no cap, that's the whole vibe of it πŸ‘‘

πŸŽ€ Members πŸŽ€

  • region β€” the class:instance pair encoding πŸ’… that's the ID card for the region, basically.
  • rsvd0 β€” MBZ. (that's "must be zero" β€” don't be the main character who fills it in πŸ™ˆ)
  • probed_size β€” memory probed by the driver ⭐
lowkey important: it should not be possible to ever encounter a zero value here, and also note that no current region type will ever return -1 here. for future region types though, that might be a possibility. and the same applies to the other size fields, iykyk.
  • unallocated_size β€” estimate of memory remaining πŸ“
fr fr, this one requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable accounting. without that (or if this is an older kernel) the value here will always equal the probed_size. also note this is only currently tracked for I915_MEMORY_CLASS_DEVICE regions β€” for other types the value here will always equal the probed_size.
  • {unnamed_union} β€” anonymous πŸ«₯ (yes literally anonymous, it's a mystery girlie)
  • rsvd1 β€” MBZ πŸ’€ again: must be zero. hands off.
  • {unnamed_struct} β€” anonymous 🌈 (another anonymous one, we love a private queen)
  • probed_cpu_visible_size β€” memory probed by the driver that is CPU accessible πŸ’œ

this will always be <= probed_size, and the remainder (if there is any) will not be CPU accessible.

on systems without small BAR, the probed_size will always equal the probed_cpu_visible_size, since all of it will be CPU accessible ✨

note this is only tracked for I915_MEMORY_CLASS_DEVICE regions (for other types the value here will always equal the probed_size).
and bestie listen: if the value returned here is zero, then this must be an old kernel which lacks the relevant small-bar uAPI support (including I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS), but on such systems we should never actually end up with a small BAR configuration, assuming we are able to load the kernel module. hence it should be safe to treat this the same as when probed_cpu_visible_size == probed_size. 🧚
  • unallocated_cpu_visible_size β€” estimate of CPU visible memory remaining πŸ’–
note this is only tracked for I915_MEMORY_CLASS_DEVICE regions (for other types the value here will always equal the probed_cpu_visible_size).
requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable accounting. without this the value here will always equal the probed_cpu_visible_size. and note this is only currently tracked for I915_MEMORY_CLASS_DEVICE regions (for other types the value here will also always equal the probed_cpu_visible_size).
if this is an older kernel the value here will be zero, see also probed_cpu_visible_size. 😭

πŸ¦‹ Description πŸ¦‹

okay so heads up: this is using both struct drm_i915_query_item and struct drm_i915_query 🫢. for this new query we're adding the new query id DRM_I915_QUERY_MEMORY_REGIONS at drm_i915_query_item.query_id. slay, that's the whole plot πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./Documentation/gpu/rfc/i915_small_bar.h struct __drm_i915_gem_create_ext(9) πŸ“š


and that's the tea, bestie πŸ΅πŸ’… this page came from ./Documentation/gpu/rfc, dated October 2026, and it's filed under struct __drm..._region_info(9) β€” go off, you icon πŸŒŸπŸŽ€

πŸ“¦ where this page comes from