turnip: fill VkMemoryDedicatedRequirements

We support VK_KHR_dedicated_allocation so we must fill
VkMemoryDedicatedRequirements.

Vulkan spec states:

 "[...] requiresDedicatedAllocation may be VK_TRUE under one of the
 following conditions:

 The pNext chain of VkImageCreateInfo for the call to vkCreateImage used
 to create the image being queried included a VkExternalMemoryImageCreateInfo
 structure, and any of the handle types specified in
 VkExternalMemoryImageCreateInfo::handleTypes requires dedicated allocation,
 as reported by vkGetPhysicalDeviceImageFormatProperties2 in
 VkExternalImageFormatProperties::externalMemoryProperties.externalMemoryFeatures,
 the requiresDedicatedAllocation field will be set to VK_TRUE."

All handle types require dedicated allocation at the moment.

Fixes:
 dEQP-VK.api.external.memory.opaque_fd.dedicated.image.info
 dEQP-VK.memory.requirements.dedicated_allocation.buffer.regular
 dEQP-VK.memory.requirements.dedicated_allocation.image.transient_tiling_optimal

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9086>
This commit is contained in:
Danylo Piliaiev 2021-02-16 17:04:35 +02:00
parent d7b3454af3
commit 1a2f1e3f47
4 changed files with 34 additions and 2 deletions

View File

@ -82,8 +82,6 @@ dEQP-VK.image.subresource_layout.3d.all_levels.r16g16_snorm,Fail
dEQP-VK.image.subresource_layout.3d.all_levels.r16g16b16a16_snorm,Fail
dEQP-VK.image.subresource_layout.3d.all_levels.r8_snorm,Fail
dEQP-VK.image.subresource_layout.3d.all_levels.r8g8b8a8_snorm,Fail
dEQP-VK.memory.requirements.dedicated_allocation.buffer.regular,Fail
dEQP-VK.memory.requirements.dedicated_allocation.image.transient_tiling_optimal,Fail
dEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.device.payload_local.image.guard_nonlocal.workgroup.comp,Fail
dEQP-VK.memory_model.message_passing.core11.u32.coherent.fence_fence.atomicwrite.device.payload_nonlocal.workgroup.guard_local.image.comp,Fail
dEQP-VK.pipeline.extended_dynamic_state.after_pipelines.depth_compare_always_greater,Fail

View File

@ -1605,6 +1605,20 @@ tu_GetBufferMemoryRequirements2(
.alignment = 64,
.size = MAX2(align64(buffer->size, 64), buffer->size),
};
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 = req->requiresDedicatedAllocation;
break;
}
default:
break;
}
}
}
void
@ -1619,6 +1633,20 @@ tu_GetImageMemoryRequirements2(VkDevice device,
.alignment = image->layout[0].base_align,
.size = image->total_size
};
vk_foreach_struct(ext, pMemoryRequirements->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: {
VkMemoryDedicatedRequirements *req =
(VkMemoryDedicatedRequirements *) ext;
req->requiresDedicatedAllocation = image->shareable;
req->prefersDedicatedAllocation = req->requiresDedicatedAllocation;
break;
}
default:
break;
}
}
}
void

View File

@ -553,6 +553,10 @@ tu_CreateImage(VkDevice _device,
if (!image)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
const VkExternalMemoryImageCreateInfo *external_info =
vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_MEMORY_IMAGE_CREATE_INFO);
image->shareable = external_info != NULL;
image->vk_format = pCreateInfo->format;
image->level_count = pCreateInfo->mipLevels;
image->layer_count = pCreateInfo->arrayLayers;

View File

@ -1281,6 +1281,8 @@ struct tu_image
uint32_t lrz_height;
uint32_t lrz_pitch;
uint32_t lrz_offset;
bool shareable;
};
static inline uint32_t