summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2021-05-26 09:14:02 +0200
committerIago Toral Quiroga <itoral@igalia.com>2021-05-27 08:23:55 +0200
commit597b448967be0e667c1b6ad5597ce50243015a23 (patch)
treec096694ab28fd72306a088eef9db587cf5331acb
parente60b009271faa4b42ed20872d6ec08afbee058b4 (diff)
v3dv: implement VK_KHR_dedicated_allocation
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11002>
-rw-r--r--docs/features.txt2
-rw-r--r--src/broadcom/vulkan/v3dv_device.c20
2 files changed, 21 insertions, 1 deletions
diff --git a/docs/features.txt b/docs/features.txt
index 336b0b7d34b..c86c059b472 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -423,7 +423,7 @@ Vulkan 1.1 -- all DONE: anv, lvp, radv, tu, vn
VK_KHR_16bit_storage DONE (anv/gen8+, lvp, radv, tu/a650, vn)
VK_KHR_bind_memory2 DONE (anv, lvp, radv, tu, v3dv, vn)
- VK_KHR_dedicated_allocation DONE (anv, lvp, radv, tu, vn)
+ VK_KHR_dedicated_allocation DONE (anv, lvp, radv, tu, v3dv, vn)
VK_KHR_descriptor_update_template DONE (anv, lvp, radv, tu, vn)
VK_KHR_device_group DONE (lvp, tu, vn)
VK_KHR_device_group_creation DONE (lvp, tu, vn)
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index d1b29102e18..dee7c03379f 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -131,6 +131,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
{
*ext = (struct vk_device_extension_table) {
.KHR_bind_memory2 = true,
+ .KHR_dedicated_allocation = true,
.KHR_external_memory = true,
.KHR_external_memory_fd = true,
.KHR_get_memory_requirements2 = true,
@@ -1846,6 +1847,11 @@ v3dv_AllocateMemory(VkDevice _device,
case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
fd_info = (void *)ext;
break;
+ case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR:
+ /* We don't have particular optimizations associated with memory
+ * allocations that won't be suballocated to multiple resources.
+ */
+ break;
default:
v3dv_debug_ignored_stype(ext->sType);
break;
@@ -1980,6 +1986,13 @@ v3dv_GetImageMemoryRequirements2(VkDevice device,
vk_foreach_struct(ext, pMemoryRequirements->pNext) {
switch (ext->sType) {
+ case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: {
+ VkMemoryDedicatedRequirements *req =
+ (VkMemoryDedicatedRequirements *) ext;
+ req->requiresDedicatedAllocation = image->external;
+ req->prefersDedicatedAllocation = image->external;
+ break;
+ }
default:
v3dv_debug_ignored_stype(ext->sType);
break;
@@ -2032,6 +2045,13 @@ v3dv_GetBufferMemoryRequirements2(VkDevice device,
vk_foreach_struct(ext, pMemoryRequirements->pNext) {
switch (ext->sType) {
+ case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: {
+ VkMemoryDedicatedRequirements *req =
+ (VkMemoryDedicatedRequirements *) ext;
+ req->requiresDedicatedAllocation = false;
+ req->prefersDedicatedAllocation = false;
+ break;
+ }
default:
v3dv_debug_ignored_stype(ext->sType);
break;