From 0f0e929655e84b8fa4dc57e69621dd74b5e4cad5 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Thu, 18 May 2023 11:05:44 -0700 Subject: [PATCH] iris: Avoid FCV_CCS_E for shader image accesses The FCV feature is documented to occur on regular render writes. Images are written to with the DC data port however. By using plain CCS_E for image writes, we can avoid the COMPRESSED_CLEAR aux state in more cases. Doing this can avoid full resolves or partial resolves for future accesses. Reviewed-by: Rohan Garg Part-of: --- src/gallium/drivers/iris/iris_resolve.c | 11 +++++++++-- src/gallium/drivers/iris/iris_state.c | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index 35a86a5..b768d7e 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -1046,6 +1046,10 @@ iris_image_view_aux_usage(struct iris_context *ice, bool uses_atomic_load_store = ice->shaders.uncompiled[info->stage]->uses_atomic_load_store; + /* Prior to GFX12, render compression is not supported for images. */ + if (devinfo->ver < 12) + return ISL_AUX_USAGE_NONE; + /* On GFX12, compressed surfaces supports non-atomic operations. GFX12HP and * further, add support for all the operations. */ @@ -1059,10 +1063,13 @@ iris_image_view_aux_usage(struct iris_context *ice, !iris_has_invalid_primary(res, level, 1, 0, INTEL_REMAINING_LAYERS)) return ISL_AUX_USAGE_NONE; + /* The FCV feature is documented to occur on regular render writes. Images + * are written to with the DC data port however. + */ if (res->aux.usage == ISL_AUX_USAGE_FCV_CCS_E) - return res->aux.usage; + return ISL_AUX_USAGE_CCS_E; - return ISL_AUX_USAGE_NONE; + return res->aux.usage; } bool diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 0aaff4e..fed17a7 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3071,8 +3071,8 @@ iris_set_shader_images(struct pipe_context *ctx, unsigned aux_usages = 1 << ISL_AUX_USAGE_NONE; /* Gfx12+ supports render compression for images */ - if (GFX_VER >= 12) - aux_usages |= 1 << res->aux.usage; + if (GFX_VER >= 12 && isl_aux_usage_has_ccs_e(res->aux.usage)) + aux_usages |= 1 << ISL_AUX_USAGE_CCS_E; alloc_surface_states(&iv->surface_state, aux_usages); iv->surface_state.bo_address = res->bo->address; -- 2.7.4