Module: Mesa Branch: main Commit: ad6b6673bed4837e611a3ad9be53313ecb314e7a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad6b6673bed4837e611a3ad9be53313ecb314e7a
Author: Chia-I Wu <[email protected]> Date: Mon Oct 30 14:31:17 2023 -0700 radv: convert a check in radv_get_memory_fd to assert VUID-VkBindImageMemoryInfo-memory-02628 and VUID-VkBindImageMemoryInfo-memory-02629 make sure the memory offset is 0 for dedicated allocations. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25964> --- src/amd/vulkan/radv_device.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index ad347e309f9..e13c6fd38d6 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1332,9 +1332,13 @@ radv_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator) bool radv_get_memory_fd(struct radv_device *device, struct radv_device_memory *memory, int *pFD) { - /* Only set BO metadata for the first plane */ - if (memory->image && memory->image->bindings[0].offset == 0) { + /* Set BO metadata for dedicated image allocations. We don't need it for import when the image + * tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, but we set it anyway for foreign consumers. + */ + if (memory->image) { struct radeon_bo_metadata metadata; + + assert(memory->image->bindings[0].offset == 0); radv_init_metadata(device, memory->image, &metadata); device->ws->buffer_set_metadata(device->ws, memory->bo, &metadata); }
