mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
intel/i915: restrict the RAM size restrictions to Anv
Before commitb571ae6e7a("intel: Make memory heaps consistent between KMDs"), we had the following policy for reporting Sytem RAM memory sizes: - For OpenGL, we reported the total available RAM. - For Vulkan, we reported the total available RAM as: - 50% of the total RAM if the total RAM was <= 4GB, - 75% otherwise - In addition, the Memory Budget (for VK_EXT_memory_budget) is 90% of the "free" memory, which can be an extra 10% off of the 50% or 75%. When xe.ko was added, one key difference was noted: while i915.ko reported the "real" RAM memory sizes in its ioctls, xe.ko reported only 50% of the system RAM as available. Because of that (and other reasons, see this discussion on MR 28513), commitb571ae6e7adecided to unify the behavior by changing the Anv i915.ko rule to "always 50%" instead of "50% or 75%". This also changed the Iris rule to 50% instead of 100%. In my research, I couldn't find any reason why this restriction should also apply to Iris, so here we revert back to handling these size restrictions on Anv only. 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
cb69d019cf
commit
3db8931d4a
2 changed files with 27 additions and 9 deletions
|
|
@ -336,9 +336,7 @@ intel_device_info_i915_query_regions(struct intel_device_info *devinfo, int fd,
|
|||
/* If the memory region uAPI query is not available, try to generate some
|
||||
* numbers out of os_* utils for sram only.
|
||||
*/
|
||||
bool ret = intel_device_info_compute_system_memory(devinfo, false);
|
||||
devinfo->mem.sram.mappable.size /= 2;
|
||||
return ret;
|
||||
return intel_device_info_compute_system_memory(devinfo, false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < meminfo->num_regions; i++) {
|
||||
|
|
@ -348,14 +346,11 @@ intel_device_info_i915_query_regions(struct intel_device_info *devinfo, int fd,
|
|||
if (!update) {
|
||||
devinfo->mem.sram.mem.klass = mem->region.memory_class;
|
||||
devinfo->mem.sram.mem.instance = mem->region.memory_instance;
|
||||
/* i915 reports the whole RAM as SRAM size but Xe KMD only reports
|
||||
* half, so adjusting i915 to follow Xe KMD.
|
||||
*/
|
||||
devinfo->mem.sram.mappable.size = mem->probed_size / 2;
|
||||
devinfo->mem.sram.mappable.size = mem->probed_size;
|
||||
} else {
|
||||
assert(devinfo->mem.sram.mem.klass == mem->region.memory_class);
|
||||
assert(devinfo->mem.sram.mem.instance == mem->region.memory_instance);
|
||||
assert(devinfo->mem.sram.mappable.size == mem->probed_size / 2);
|
||||
assert(devinfo->mem.sram.mappable.size == mem->probed_size);
|
||||
}
|
||||
/* if running without elevated privileges i915 reports
|
||||
* unallocated_size == probed_size
|
||||
|
|
|
|||
|
|
@ -1955,13 +1955,36 @@ get_properties(const struct anv_physical_device *pdevice,
|
|||
}
|
||||
}
|
||||
|
||||
/* This function restricts the maximum size of system memory heap. The
|
||||
* reasoning is that if we allow all the RAM to be used by graphics, nothing
|
||||
* will remain for the rest of the system.
|
||||
*
|
||||
* In practice, applications should really be using VK_EXT_memory_budget
|
||||
* instead of relying on our heuristics.
|
||||
*
|
||||
* The i915.ko driver has always reported 100% of the total available RAM.
|
||||
* The xe.ko driver changed its behavior after commit d2d5f6d57884 ("drm/xe:
|
||||
* Increase the XE_PL_TT watermark"), so we need to detect that and make a
|
||||
* choice based on it.
|
||||
*/
|
||||
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;
|
||||
|
||||
return kmd_reported_sram / 2;
|
||||
}
|
||||
|
||||
static VkResult MUST_CHECK
|
||||
anv_init_meminfo(struct anv_physical_device *device, int fd)
|
||||
{
|
||||
const struct intel_device_info *devinfo = &device->info;
|
||||
|
||||
device->sys.region = &devinfo->mem.sram.mem;
|
||||
device->sys.size = devinfo->mem.sram.mappable.size;
|
||||
device->sys.size =
|
||||
anv_restrict_sys_heap_size(device, devinfo->mem.sram.mappable.size);
|
||||
device->sys.available = devinfo->mem.sram.mappable.free;
|
||||
|
||||
device->vram_mappable.region = &devinfo->mem.vram.mem;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue