diff options
author | Bas Nieuwenhuizen <[email protected]> | 2019-01-28 02:09:07 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2019-01-29 15:56:56 +0100 |
commit | 69edc972fc6ece71cfc9ca2f1e673c44d616bfcc (patch) | |
tree | 3d18afd42714b5a7a7d0440c9ab456b3b9a9bc45 | |
parent | 50fd253bd6ebb5ae4f48973cf74744bf6008426a (diff) |
radv: Enable VK_EXT_memory_priority.
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r-- | src/amd/vulkan/radv_device.c | 22 | ||||
-rw-r--r-- | src/amd/vulkan/radv_extensions.py | 1 | ||||
-rw-r--r-- | src/amd/vulkan/radv_radeon_winsys.h | 2 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index fdf051bcce9..34d93b262f8 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -863,6 +863,12 @@ void radv_GetPhysicalDeviceFeatures2( features->scalarBlockLayout = pdevice->rad_info.chip_class >= CIK; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT: { + VkPhysicalDeviceMemoryPriorityFeaturesEXT *features = + (VkPhysicalDeviceMemoryPriorityFeaturesEXT *)ext; + features->memoryPriority = VK_TRUE; + break; + } default: break; } @@ -3086,6 +3092,16 @@ static VkResult radv_alloc_memory(struct radv_device *device, mem->buffer = NULL; } + float priority_float = 0.5; + const struct VkMemoryPriorityAllocateInfoEXT *priority_ext = + vk_find_struct_const(pAllocateInfo->pNext, + MEMORY_PRIORITY_ALLOCATE_INFO_EXT); + if (priority_ext) + priority_float = priority_ext->priority; + + unsigned priority = MIN2(RADV_BO_PRIORITY_APPLICATION_MAX - 1, + (int)(priority_float * RADV_BO_PRIORITY_APPLICATION_MAX)); + mem->user_ptr = NULL; if (import_info) { @@ -3094,7 +3110,7 @@ static VkResult radv_alloc_memory(struct radv_device *device, import_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT); mem->bo = device->ws->buffer_from_fd(device->ws, import_info->fd, - RADV_BO_PRIORITY_DEFAULT, NULL, NULL); + priority, NULL, NULL); if (!mem->bo) { result = VK_ERROR_INVALID_EXTERNAL_HANDLE; goto fail; @@ -3106,7 +3122,7 @@ static VkResult radv_alloc_memory(struct radv_device *device, assert(mem_type_index == RADV_MEM_TYPE_GTT_CACHED); mem->bo = device->ws->buffer_from_ptr(device->ws, host_ptr_info->pHostPointer, pAllocateInfo->allocationSize, - RADV_BO_PRIORITY_DEFAULT); + priority); if (!mem->bo) { result = VK_ERROR_INVALID_EXTERNAL_HANDLE; goto fail; @@ -3133,7 +3149,7 @@ static VkResult radv_alloc_memory(struct radv_device *device, flags |= RADEON_FLAG_NO_INTERPROCESS_SHARING; mem->bo = device->ws->buffer_create(device->ws, alloc_size, device->physical_device->rad_info.max_alignment, - domain, flags, RADV_BO_PRIORITY_DEFAULT); + domain, flags, priority); if (!mem->bo) { result = VK_ERROR_OUT_OF_DEVICE_MEMORY; diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index eb3743e9602..1bf56943f25 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -106,6 +106,7 @@ EXTENSIONS = [ Extension('VK_EXT_external_memory_host', 1, 'device->rad_info.has_userptr'), Extension('VK_EXT_global_priority', 1, 'device->rad_info.has_ctx_priority'), Extension('VK_EXT_memory_budget', 1, True), + Extension('VK_EXT_memory_priority', 1, True), Extension('VK_EXT_pci_bus_info', 2, True), Extension('VK_EXT_sampler_filter_minmax', 1, 'device->rad_info.chip_class >= CIK'), Extension('VK_EXT_scalar_block_layout', 1, 'device->rad_info.chip_class >= CIK'), diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h index 2684aadc81f..73410efc252 100644 --- a/src/amd/vulkan/radv_radeon_winsys.h +++ b/src/amd/vulkan/radv_radeon_winsys.h @@ -191,8 +191,6 @@ struct radv_winsys_bo_list { /* Kernel effectively allows 0-31. This sets some priorities for fixed * functionality buffers */ enum { - RADV_BO_PRIORITY_DEFAULT = 14, - RADV_BO_PRIORITY_APPLICATION_MAX = 28, /* virtual buffers have 0 priority since the priority is not used. */ |