drm/i915: Introduce private PAT management
Subsystems (2)
RFC v2 2/3 drm/i915: Introduce private PAT management
The private PAT management is to support both static and dynamic PPAT entry manipulation. During the initialization, the PPAT indexes with specific PPAT values could be reserved and set by intel_ppat_reserve. The unused PPAT entries can be allocated/freed later at runtime. Two APIs are introduced for dynamically managing PPAT entries: intel_ppat_get and intel_ppat_set.
intel_ppat_get will search for an existing PPAT entry which perfectly matches the required PPAT value. If not, it will try to allocate or return a partially matched PPAT entry if there is any available PPAT indexes or not.
intel_ppat_put will put back the PPAT entry which comes from intel_ppat_get. If it's dynamically allocated, the reference count will be decreased. If the reference count turns into zero, the PPAT index is freed again.
Besides, another two callbacks are introduced to support the private PAT management framework. One is ppat->update(), which writes the PPAT configurations in ppat->entries into HW. Another one is ppat->match, which will return a score to show how two PPAT values match with each other.
--- drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_gem_gtt.c | 129 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 36 ++++++++++ 3 files changed, 167 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -2307,6 +2307,8 @@ struct drm_i915_private {DECLARE_HASHTABLE (mm_structs,7 );struct mutex mm_lock; +struct intel_ppat ppat; +/* Kernel Modesetting */ struct intel_crtc *plane_to_crtc_mapping[I915_MAX_PIPES ];
drivers/gpu/drm/i915/i915_gem_gtt.c +129 -0
147 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem_gtt.h +36 -0
@@ -536,6 +536,42 @@ i915_vm_to_ggtt(struct i915_address_space *vm) return container_of(vm, struct i915_ggtt, base); } +#define INTEL_MAX_PPAT_ENTRIES 8 + +struct intel_ppat ; + +struct intel_ppat_entry { +struct intel_ppat *ppat; +struct kref ref_count; +u8 value; +}; + +struct intel_ppat { +struct intel_ppat_entry entries[INTEL_MAX_PPAT_ENTRIES ]; + DECLARE_BITMAP(reserved, INTEL_MAX_PPAT_ENTRIES); + DECLARE_BITMAP(used, INTEL_MAX_PPAT_ENTRIES); + +unsigned int max_entries; + +u8 dummy_value; +/* +* Return a score to show how two PPAT values match, +* a ~0 indicates a perfect match +*/ +unsigned int (*match)(u8 src,u8 dst); +/* +* Write the PPAT configuration into HW. +*/ +void (*update)(struct drm_i915_private *dev_priv); + +struct drm_i915_private *dev_priv; +}; + +void intel_ppat_reserve (struct intel_ppat *ppat,unsigned int index,u8 value); +struct intel_ppat_entry *intel_ppat_get (struct drm_i915_private *i915, +u8 value); +void intel_ppat_put (struct intel_ppat_entry *entry); +int i915_gem_init_aliasing_ppgtt (struct drm_i915_private *i915);void i915_gem_fini_aliasing_ppgtt (struct drm_i915_private *i915);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx