diff options
author | Samuel Pitoiset <[email protected]> | 2019-01-07 17:38:08 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-01-15 11:18:35 +0100 |
commit | 9784400a6b800ae9d08aa8de4d5262c0214fb339 (patch) | |
tree | 62e6ca0e287f7eb9493645b1a482845d7ad97483 /src/amd/vulkan | |
parent | a6e5ce51302e13ab10a0d706322abe746aaa4901 (diff) |
radv: add two small helpers for getting VRAM and visible VRAM sizes
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Alex Smith <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 6d91cfc95df..6b5fd10c83b 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -122,19 +122,30 @@ radv_get_device_name(enum radeon_family family, char *name, size_t name_len) snprintf(name, name_len, "%s%s", chip_string, llvm_string); } +static uint64_t +radv_get_visible_vram_size(struct radv_physical_device *device) +{ + return MIN2(device->rad_info.vram_size, device->rad_info.vram_vis_size); +} + +static uint64_t +radv_get_vram_size(struct radv_physical_device *device) +{ + return device->rad_info.vram_size - radv_get_visible_vram_size(device); +} + static void radv_physical_device_init_mem_types(struct radv_physical_device *device) { STATIC_ASSERT(RADV_MEM_HEAP_COUNT <= VK_MAX_MEMORY_HEAPS); - uint64_t visible_vram_size = MIN2(device->rad_info.vram_size, - device->rad_info.vram_vis_size); - + uint64_t visible_vram_size = radv_get_visible_vram_size(device); + uint64_t vram_size = radv_get_vram_size(device); int vram_index = -1, visible_vram_index = -1, gart_index = -1; device->memory_properties.memoryHeapCount = 0; - if (device->rad_info.vram_size - visible_vram_size > 0) { + if (vram_size > 0) { vram_index = device->memory_properties.memoryHeapCount++; device->memory_properties.memoryHeaps[vram_index] = (VkMemoryHeap) { - .size = device->rad_info.vram_size - visible_vram_size, + .size = vram_size, .flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT, }; } |