radv: allocate image metadata to implement a workaround for HiZ on GFX12

This will be used to determine if HiZ can enabled per level.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36739>
This commit is contained in:
Samuel Pitoiset
2025-07-14 14:31:56 +02:00
committed by Marge Bot
parent a2d996b70c
commit d89922a6a8
2 changed files with 19 additions and 0 deletions
+14
View File
@@ -889,6 +889,20 @@ radv_image_alloc_values(const struct radv_device *device, struct radv_image *ima
image->tc_compat_zrange_offset = image->size;
image->size += image->vk.mip_levels * 4;
}
if (pdev->info.gfx_level == GFX12) {
const struct radeon_surf *surf = &image->planes[0].surface;
/* All production chips don't support HiS. */
assert(!surf->u.gfx9.zs.his.offset);
/* Allocate HiZ metadata when the image has depth/stencil aspects to implement a workaround. */
if (!pdev->use_gfx12_hiz_his_event_wa && surf->u.gfx9.zs.hiz.offset &&
(image->vk.aspects == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT))) {
image->hiz_valid_offset = image->size;
image->size += image->vk.mip_levels * 4;
}
}
}
/* Determine if the image is affected by the pipe misaligned metadata issue
+5
View File
@@ -64,6 +64,11 @@ struct radv_image {
*/
uint64_t tc_compat_zrange_offset;
/* Metadata for the HiZ workaround on GFX12 with both depth and stencil planes. It's used to
* track whether HiZ metadata are in-sync with main image data, per-level.
*/
uint64_t hiz_valid_offset;
/* For VK_ANDROID_native_buffer, the WSI image owns the memory, */
VkDeviceMemory owned_memory;