diff options
author | Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> | 2022-01-06 11:00:41 +0100 |
---|---|---|
committer | Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> | 2022-01-10 08:11:19 +0100 |
commit | 77c00fad4e661ee88e495b33913aab3712e41449 (patch) | |
tree | d7c94e816c2f27c587c9342c502be11f95198d9a /lib/i915/intel_memory_region.h | |
parent | ac29e097d4ff0f2e269a955ca86c5eb23908467a (diff) |
lib/intel_memory_region: Add start offset and alignment detection
With era of new gens we're enforced to use no-reloc (softpin). This
brings few problems like vm range limitations which were well solved
by the kernel. This can be handled also in userspace code by adding
gen related conditionals or by trying to detect the constraints.
Lets try to do this dynamically and detect safe start offset and
alignment for each memory region we got. This should be universal solution
regardless hw limitations and bugs. As such detection is not lightweight
technique add also some caching structures to handle consequtive calls
about same data.
v2: unify cache
v3: move allocation of cache entry out of mutex
v4: remove assert on allocation newentry, just skip adding to cache
v5: fix function documentation (Ashutosh)
v6: remove unnecessary buffers count initialization (Ashutosh)
add 48b flag for pinning object
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Diffstat (limited to 'lib/i915/intel_memory_region.h')
-rw-r--r-- | lib/i915/intel_memory_region.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/i915/intel_memory_region.h b/lib/i915/intel_memory_region.h index 8b427b7e..936e7d1c 100644 --- a/lib/i915/intel_memory_region.h +++ b/lib/i915/intel_memory_region.h @@ -129,4 +129,9 @@ uint64_t gpu_meminfo_region_available(const struct drm_i915_query_memory_regions uint16_t memory_class, uint16_t memory_instance); +uint64_t gem_detect_min_start_offset_for_region(int i915, uint32_t region); +uint64_t gem_detect_safe_start_offset(int i915); +uint64_t gem_detect_min_alignment_for_regions(int i915, uint32_t region1, uint32_t region2); +uint64_t gem_detect_safe_alignment(int i915); + #endif /* INTEL_MEMORY_REGION_H */ |