venus: use dedicated allocation for ANB image memory import

On most platforms, deidcated allocation is preferred for the dma-buf
import done by Venus. In special cases, this is required but missed so
far.

Cc: mesa-stable

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33434>
This commit is contained in:
Yiwei Zhang 2025-02-06 20:55:30 +00:00 committed by Marge Bot
parent 1d668233ba
commit d92f9c3d51

View file

@ -581,8 +581,15 @@ vn_android_image_from_anb_internal(struct vn_device *dev,
goto fail;
}
const bool prefer_dedicated =
img->requirements[0].dedicated.prefersDedicatedAllocation == VK_TRUE;
const VkMemoryDedicatedAllocateInfo dedicated_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
.image = vn_image_to_handle(img),
};
const VkImportMemoryFdInfoKHR import_fd_info = {
.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR,
.pNext = prefer_dedicated ? &dedicated_info : NULL,
.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
.fd = dup_fd,
};