mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 10:10:23 +01:00
radv: Change memory type order for GPUs without dedicated VRAM
Put the uncached GTT type at a higher index than the visible VRAM type, rather than having GTT first. When we don't have dedicated VRAM, we don't have a non-visible VRAM type, and the property flags for GTT and visible VRAM are identical. According to the spec, for types with identical flags, we should give the one with better performance a lower index. Previously, apps which follow the spec guidance for choosing a memory type would have picked the GTT type in preference to visible VRAM (all Feral games will do this), and end up with lower performance. On a Ryzen 5 2500U laptop (Raven Ridge), this improves average FPS in the Rise of the Tomb Raider benchmark by up to ~30%. Tested a couple of other (Feral) games and saw similar improvement on those as well. Signed-off-by: Alex Smith <asmith@feralinteractive.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Cc: 19.2 <mesa-stable@lists.freedesktop.org> (Bas: CCing this to 19.2-rc due to high impact and limited complexity)
This commit is contained in:
parent
681e99d11c
commit
fe0ec41c4d
1 changed files with 15 additions and 3 deletions
|
|
@ -173,12 +173,11 @@ radv_physical_device_init_mem_types(struct radv_physical_device *device)
|
|||
.heapIndex = vram_index,
|
||||
};
|
||||
}
|
||||
if (gart_index >= 0) {
|
||||
if (gart_index >= 0 && device->rad_info.has_dedicated_vram) {
|
||||
device->mem_type_indices[type_count] = RADV_MEM_TYPE_GTT_WRITE_COMBINE;
|
||||
device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) {
|
||||
.propertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
|
||||
(device->rad_info.has_dedicated_vram ? 0 : VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT),
|
||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||
.heapIndex = gart_index,
|
||||
};
|
||||
}
|
||||
|
|
@ -191,6 +190,19 @@ radv_physical_device_init_mem_types(struct radv_physical_device *device)
|
|||
.heapIndex = visible_vram_index,
|
||||
};
|
||||
}
|
||||
if (gart_index >= 0 && !device->rad_info.has_dedicated_vram) {
|
||||
/* Put GTT after visible VRAM for GPUs without dedicated VRAM
|
||||
* as they have identical property flags, and according to the
|
||||
* spec, for types with identical flags, the one with greater
|
||||
* performance must be given a lower index. */
|
||||
device->mem_type_indices[type_count] = RADV_MEM_TYPE_GTT_WRITE_COMBINE;
|
||||
device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) {
|
||||
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||
.heapIndex = gart_index,
|
||||
};
|
||||
}
|
||||
if (gart_index >= 0) {
|
||||
device->mem_type_indices[type_count] = RADV_MEM_TYPE_GTT_CACHED;
|
||||
device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue