panvk: implement VkBindMemoryStatus
Needed for VK_KHR_maintenance6. Signed-off-by: Olivia Lee <olivia.lee@collabora.com> Reviewed-by: John Anthony <john.anthony@arm.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35528>
This commit is contained in:
@@ -58,10 +58,16 @@ panvk_BindBufferMemory2(VkDevice _device, uint32_t bindInfoCount,
|
||||
const struct panvk_physical_device *phys_dev =
|
||||
to_panvk_physical_device(device->vk.physical);
|
||||
const unsigned arch = pan_arch(phys_dev->kmod.props.gpu_prod_id);
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
for (uint32_t i = 0; i < bindInfoCount; i++) {
|
||||
VK_FROM_HANDLE(panvk_device_memory, mem, pBindInfos[i].memory);
|
||||
VK_FROM_HANDLE(panvk_buffer, buffer, pBindInfos[i].buffer);
|
||||
const VkBindMemoryStatus *bind_status =
|
||||
vk_find_struct_const(&pBindInfos[i], BIND_MEMORY_STATUS);
|
||||
|
||||
if (bind_status)
|
||||
*bind_status->pResult = VK_SUCCESS;
|
||||
|
||||
assert(mem != NULL);
|
||||
assert(buffer->vk.device_address == 0);
|
||||
@@ -84,13 +90,18 @@ panvk_BindBufferMemory2(VkDevice _device, uint32_t bindInfoCount,
|
||||
pan_kmod_bo_mmap(mem->bo, map_start, map_end - map_start,
|
||||
PROT_WRITE, MAP_SHARED, NULL);
|
||||
|
||||
if (map_addr == MAP_FAILED)
|
||||
return panvk_errorf(device, VK_ERROR_OUT_OF_HOST_MEMORY,
|
||||
"Failed to CPU map index buffer");
|
||||
if (map_addr == MAP_FAILED) {
|
||||
result = panvk_errorf(device, VK_ERROR_OUT_OF_HOST_MEMORY,
|
||||
"Failed to CPU map index buffer");
|
||||
if (bind_status)
|
||||
*bind_status->pResult = result;
|
||||
continue;
|
||||
}
|
||||
|
||||
buffer->host_ptr = map_addr + (offset & pgsize);
|
||||
}
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
|
||||
@@ -627,12 +627,17 @@ panvk_BindImageMemory2(VkDevice device, uint32_t bindInfoCount,
|
||||
const VkBindImageMemoryInfo *pBindInfos)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_device, dev, device);
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
for (uint32_t i = 0; i < bindInfoCount; i++) {
|
||||
VkResult result = panvk_image_bind(dev, &pBindInfos[i]);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
const VkBindMemoryStatus *bind_status =
|
||||
vk_find_struct_const(&pBindInfos[i], BIND_MEMORY_STATUS);
|
||||
VkResult bind_result = panvk_image_bind(dev, &pBindInfos[i]);
|
||||
if (bind_status)
|
||||
*bind_status->pResult = bind_result;
|
||||
if (bind_result != VK_SUCCESS)
|
||||
result = bind_result;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user