Mesa (main): anv: compute available memory in anv_init_meminfo
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 18 17:27:24 UTC 2021
Module: Mesa
Branch: main
Commit: 758662759dcf31c64fd62d5b3d280e2c7791ce63
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=758662759dcf31c64fd62d5b3d280e2c7791ce63
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Wed Aug 18 08:38:13 2021 -0500
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 at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12433>
---
src/intel/vulkan/anv_device.c | 8 ++++----
src/intel/vulkan/anv_private.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 30e368e0e6c..69a143cd345 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -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");
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 8eafbbfdb3f..6186356500c 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -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;
More information about the mesa-commit
mailing list