anv: compute available memory in anv_init_meminfo

We can now detect EXT_memory_budget support based on whether or not we
have non-zero available system memory.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12433>
This commit is contained in:
Jason Ekstrand 2021-08-18 08:38:13 -05:00 committed by Marge Bot
parent 5c79c545e3
commit 758662759d
2 changed files with 5 additions and 5 deletions

View file

@ -263,7 +263,7 @@ get_device_extensions(const struct anv_physical_device *device,
.EXT_index_type_uint8 = true,
.EXT_inline_uniform_block = true,
.EXT_line_rasterization = true,
.EXT_memory_budget = device->has_mem_available,
.EXT_memory_budget = device->sys.available,
.EXT_pci_bus_info = true,
.EXT_physical_device_drm = true,
.EXT_pipeline_creation_cache_control = true,
@ -395,8 +395,11 @@ anv_init_meminfo(struct anv_physical_device *device, int fd)
if (info->region.memory_class == I915_MEMORY_CLASS_SYSTEM)
size = anv_compute_sys_heap_size(device, size);
uint64_t available = MIN2(size, info->unallocated_size);
region->region = info->region;
region->size = size;
region->available = available;
}
if (mem_regions != (void *)sys_mem_regions)
@ -910,9 +913,6 @@ anv_physical_device_try_create(struct anv_instance *instance,
device->has_reg_timestamp = anv_gem_reg_read(fd, TIMESTAMP | I915_REG_READ_8B_WA,
&u64_ignore) == 0;
uint64_t avail_mem;
device->has_mem_available = os_get_available_system_memory(&avail_mem);
device->always_flush_cache =
driQueryOptionb(&instance->dri_options, "always_flush_cache");

View file

@ -883,6 +883,7 @@ struct anv_memory_heap {
struct anv_memregion {
struct drm_i915_gem_memory_class_instance region;
uint64_t size;
uint64_t available;
};
struct anv_physical_device {
@ -927,7 +928,6 @@ struct anv_physical_device {
bool has_context_priority;
bool has_context_isolation;
bool has_thread_submit;
bool has_mem_available;
bool has_mmap_offset;
bool has_userptr_probe;
uint64_t gtt_size;