anv: Query ISL for the aux-state of undefined layouts

For CCS_E on gfx12+, this will cause us to perform full resolves when
transitioning from undefined to a layout which does not support
compression. We don't currently perform such transitions because
compression is always enabled.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36383>
This commit is contained in:
Nanley Chery 2024-09-30 20:09:25 -04:00 committed by Marge Bot
parent 7d284fe399
commit d41bff3836
2 changed files with 2 additions and 36 deletions

View file

@ -3463,7 +3463,7 @@ anv_layout_to_aux_state(const struct intel_device_info * const devinfo,
*/
case VK_IMAGE_LAYOUT_UNDEFINED:
case VK_IMAGE_LAYOUT_PREINITIALIZED:
return ISL_AUX_STATE_AUX_INVALID;
return isl_aux_get_initial_state(devinfo, aux_usage, false);
case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR: {
assert(image->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT);

View file

@ -1189,41 +1189,7 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
* clear.
*/
must_init_fast_clear_state = devinfo->ver < 20;
if (isl_aux_usage_has_mcs(image->planes[plane].aux_usage) ||
devinfo->has_illegal_ccs_values) {
must_init_aux_surface = true;
} else {
assert(isl_aux_usage_has_ccs_e(image->planes[plane].aux_usage));
/* We can start using the CCS immediately without ambiguating. The
* two conditions that enable this are:
*
* 1) The device treats all possible CCS values as legal. In other
* words, we can't confuse the hardware with random bits in the
* CCS.
*
* 2) We enable compression on all writable image layouts. The CCS
* will receive all writes and will therefore always be in sync
* with the main surface.
*
* If we were to disable compression on some writable layouts, the
* CCS could get out of sync with the main surface and the app
* could lose the data it wrote previously. For example, this
* could happen if an app: transitions from UNDEFINED w/o
* ambiguating -> renders with AUX_NONE -> samples with AUX_CCS.
*
* The second condition is asserted below, but could be moved
* elsewhere for more coverage (we're only checking transitions from
* an undefined layout).
*/
assert(vk_image_layout_is_read_only(final_layout, aspect) ||
(final_aux_usage != ISL_AUX_USAGE_NONE));
must_init_aux_surface = false;
}
must_init_aux_surface = initial_aux_usage == ISL_AUX_USAGE_NONE;
} else if (private_binding_acquire && !acquire_unmodified) {
/* The fast clear state lives in a driver-private bo, and therefore the
* external/foreign queue is unaware of it.