anv: Add an anv_image_get_memory_requirements helper

This is similar to a patch from Lionel except works in terms of aspects
rather than bindings.  This makes it easy to use from the Android code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>
This commit is contained in:
Jason Ekstrand
2021-10-05 10:44:42 -05:00
committed by Marge Bot
parent 76b1d04e72
commit 8c2a1ed3da
3 changed files with 56 additions and 48 deletions

View File

@@ -537,16 +537,12 @@ anv_image_from_gralloc(VkDevice device_h,
if (result != VK_SUCCESS)
goto fail_create;
VkImageMemoryRequirementsInfo2 mem_reqs_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2,
.image = image_h,
};
VkMemoryRequirements2 mem_reqs = {
.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
};
anv_GetImageMemoryRequirements2(device_h, &mem_reqs_info, &mem_reqs);
anv_image_get_memory_requirements(device, image, image->vk.aspects,
&mem_reqs);
VkDeviceSize aligned_image_size =
align_u64(mem_reqs.memoryRequirements.size,