intel/dev: Determine the amount of free vram using small BAR uapi

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16739>
This commit is contained in:
Jordan Justen
2022-06-10 18:20:30 -07:00
committed by Marge Bot
parent acc6457ff4
commit 2863e720f0
+16 -2
View File
@@ -1643,8 +1643,22 @@ query_regions(struct intel_device_info *devinfo, int fd, bool update)
assert((devinfo->mem.vram.mappable.size +
devinfo->mem.vram.unmappable.size) == mem->probed_size);
}
if (mem->unallocated_size != -1)
devinfo->mem.vram.mappable.free = mem->unallocated_size;
if (mem->unallocated_cpu_visible_size > 0) {
if (mem->unallocated_size != -1) {
devinfo->mem.vram.mappable.free = mem->unallocated_cpu_visible_size;
devinfo->mem.vram.unmappable.free =
mem->unallocated_size - mem->unallocated_cpu_visible_size;
}
} else {
/* We are running on an older kernel without support for the
* small-bar uapi. These kernels only support systems where the
* entire vram is mappable.
*/
if (mem->unallocated_size != -1) {
devinfo->mem.vram.mappable.free = mem->unallocated_size;
devinfo->mem.vram.unmappable.free = 0;
}
}
break;
default:
break;