mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
anv/xe: detect the newer xe.ko memory reporting model and act accordingly
Kernel commit d2d5f6d57884 ("drm/xe: Increase the XE_PL_TT watermark")
changed how xe.ko reportes memory: its ioctls now report 100% of the
system RAM as available. Since our policy is to report 50% of the SRAM
as available for the heaps, add some code to check the amount reported
by xe.ko against the amount reported by the system, then act
accordingly.
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28513>
This commit is contained in:
parent
3db8931d4a
commit
02e896bc49
1 changed files with 21 additions and 2 deletions
|
|
@ -1971,8 +1971,27 @@ static uint64_t
|
|||
anv_restrict_sys_heap_size(struct anv_physical_device *device,
|
||||
uint64_t kmd_reported_sram)
|
||||
{
|
||||
if (device->info.kmd_type == INTEL_KMD_TYPE_XE)
|
||||
return kmd_reported_sram;
|
||||
if (device->info.kmd_type == INTEL_KMD_TYPE_XE) {
|
||||
uint64_t sys_reported_sram;
|
||||
if (!os_get_total_physical_memory(&sys_reported_sram))
|
||||
return kmd_reported_sram;
|
||||
|
||||
/* From what I could gather, kmd_reported_sram always seems to be
|
||||
* exactly half of sys_reported_sram in older Kernels, but let's leave
|
||||
* some room for imprecision here in case the interfaces chosen to
|
||||
* report memory end up changing, accounting things differently somehow.
|
||||
*
|
||||
* If we detect an older Kernel (i.e., kmd_reported_sram == ~50% of
|
||||
* sys_reported_sram) we just return the values reported by the KMD
|
||||
* since they are already restricted. If we detect a newer Kernel, we
|
||||
* deal with the value below, along with i915.ko (which is expected to
|
||||
* always report 100% of SRAM).
|
||||
*/
|
||||
uint64_t ratio = kmd_reported_sram * 10 / sys_reported_sram;
|
||||
assert(ratio <= 11);
|
||||
if (ratio <= 6)
|
||||
return kmd_reported_sram;
|
||||
}
|
||||
|
||||
return kmd_reported_sram / 2;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue