|
XenevaOS
|
#include <i915_drm.h>

Public Attributes | |
| struct i915_user_extension | base |
| __u32 | pad |
| __u32 | num_regions |
| __u64 | regions |
struct drm_i915_gem_create_ext_memory_regions - The I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
Set the object with the desired set of placements/regions in priority order. Each entry must be unique and supported by the device.
This is provided as an array of struct drm_i915_gem_memory_class_instance, or an equivalent layout of class:instance pair encodings. See struct drm_i915_query_memory_regions and DRM_I915_QUERY_MEMORY_REGIONS for how to query the supported regions for a device.
As an example, on discrete devices, if we wish to set the placement as device local-memory we can do something like:
.. code-block:: C
struct drm_i915_gem_memory_class_instance region_lmem = { .memory_class = I915_MEMORY_CLASS_DEVICE, .memory_instance = 0, }; struct drm_i915_gem_create_ext_memory_regions regions = { .base = { .name = I915_GEM_CREATE_EXT_MEMORY_REGIONS }, .regions = (uintptr_t)®ion_lmem, .num_regions = 1, }; struct drm_i915_gem_create_ext create_ext = { .size = 16 * PAGE_SIZE, .extensions = (uintptr_t)®ions, };
int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext); if (err) ...
At which point we get the object handle in &drm_i915_gem_create_ext.handle, along with the final object size in &drm_i915_gem_create_ext.size, which should account for any rounding up, if required.
Note that userspace has no means of knowing the current backing region for objects where @num_regions is larger than one. The kernel will only ensure that the priority order of the @regions array is honoured, either when initially placing the object, or when moving memory around due to memory pressure
On Flat-CCS capable HW, compression is supported for the objects residing in I915_MEMORY_CLASS_DEVICE. When such objects (compressed) have other memory class in @regions and migrated (by i915, due to memory constraints) to the non I915_MEMORY_CLASS_DEVICE region, then i915 needs to decompress the content. But i915 doesn't have the required information to decompress the userspace compressed objects.
So i915 supports Flat-CCS, on the objects which can reside only on I915_MEMORY_CLASS_DEVICE regions.
| struct i915_user_extension drm_i915_gem_create_ext_memory_regions::base |
@base: Extension link. See struct i915_user_extension.
| __u32 drm_i915_gem_create_ext_memory_regions::num_regions |
@num_regions: Number of elements in the @regions array.
| __u32 drm_i915_gem_create_ext_memory_regions::pad |
@pad: MBZ
| __u64 drm_i915_gem_create_ext_memory_regions::regions |
@regions: The regions/placements array.
An array of struct drm_i915_gem_memory_class_instance.