anv: mark images compressed for untracked layout/access

Most of the compressed writes are tracked by the driver, for
instances :
   - blorp writes
   - render target writes

But we don't have any tracking for storage images (which have gained
compression support on DG2+). So inspect the layout transition and
when we see a layout/access that can do writes outside of our driver
tracking, update the image state tracking.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8946
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22988>
This commit is contained in:
Lionel Landwerlin
2023-05-12 16:20:57 +03:00
committed by Marge Bot
parent e7ec410141
commit 1a89b1a301
3 changed files with 68 additions and 0 deletions

View File

@@ -2365,6 +2365,48 @@ anv_layout_to_fast_clear_type(const struct intel_device_info * const devinfo,
}
/**
* This function determines if the layout & usage of an image can have
* untracked aux writes. When we see a transition that matches this criteria,
* we need to mark the image as compressed written so that our predicated
* resolves work properly.
*
* @param devinfo The device information of the Intel GPU.
* @param image The image that may contain a collection of buffers.
* @param aspect The aspect of the image to be accessed.
* @param layout The current layout of the image aspect(s).
*/
bool
anv_layout_has_untracked_aux_writes(const struct intel_device_info * const devinfo,
const struct anv_image * const image,
const VkImageAspectFlagBits aspect,
const VkImageLayout layout)
{
const VkImageUsageFlags image_aspect_usage =
vk_image_usage(&image->vk, aspect);
const VkImageUsageFlags usage =
vk_image_layout_to_usage_flags(layout, aspect) & image_aspect_usage;
/* Storage is the only usage where we do not write the image through a
* render target but through a descriptor. Since VK_EXT_descriptor_indexing
* and the update-after-bind feature, it has become impossible to track
* writes to images in descriptor at the command buffer build time. So it's
* not possible to mark an image as compressed like we do in
* genX_cmd_buffer.c(EndRendering) or anv_blorp.c for all transfer
* operations.
*/
if (!(usage & VK_IMAGE_USAGE_STORAGE_BIT))
return false;
/* No AUX, no writes to the AUX surface :) */
const uint32_t plane = anv_image_aspect_to_plane(image, aspect);
const enum isl_aux_usage aux_usage = image->planes[plane].aux_usage;
if (aux_usage == ISL_AUX_USAGE_NONE)
return false;
return true;
}
static struct anv_state
alloc_bindless_surface_state(struct anv_device *device)
{