From 16a7e15d4fcfe205808bc19c133342de6645cf20 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 6 Oct 2022 10:19:20 -0700 Subject: [PATCH] iris: Enable compression for image load/store in more cases We were calling iris_resource_texture_aux_usage here, which disables auxiliary support if color happens to already be resolved. This makes sense for read only images, where if we know ahead of time that aux doesn't contain any useful information, we can just tell the hardware to not bother looking at it. However, it makes no sense for mutable images, as even if the aux currently has no useful data, we want to produce that data when doing our image writes. Import the bits of logic we need from there and shed the rest. We don't need to consider HiZ, MCS, or MC, nor do we need to do format-based CCS compatibility checks on Gfx12+, so it's actually very little code. Reviewed-by: Nanley Chery Part-of: --- src/gallium/drivers/iris/iris_resolve.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index b299b5b9339..082cd08931e 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -1021,19 +1021,24 @@ iris_image_view_aux_usage(struct iris_context *ice, const unsigned level = res->base.b.target != PIPE_BUFFER ? pview->u.tex.level : 0; - enum isl_format view_format = iris_image_view_get_format(ice, pview); - enum isl_aux_usage aux_usage = - iris_resource_texture_aux_usage(ice, res, view_format, level, 1); - bool uses_atomic_load_store = ice->shaders.uncompiled[info->stage]->uses_atomic_load_store; /* On GFX12, compressed surfaces supports non-atomic operations. GFX12HP and * further, add support for all the operations. */ - if (aux_usage == ISL_AUX_USAGE_GFX12_CCS_E && - (devinfo->verx10 >= 125 || !uses_atomic_load_store)) - return ISL_AUX_USAGE_GFX12_CCS_E; + if (devinfo->verx10 < 125 && uses_atomic_load_store) + return ISL_AUX_USAGE_NONE; + + /* If the image is read-only, and doesn't have any unresolved color, + * report ISL_AUX_USAGE_NONE. Bypassing useless aux can save bandwidth. + */ + if (!(pview->access & PIPE_IMAGE_ACCESS_WRITE) && + !iris_has_invalid_primary(res, level, 1, 0, INTEL_REMAINING_LAYERS)) + return ISL_AUX_USAGE_NONE; + + if (res->aux.usage == ISL_AUX_USAGE_GFX12_CCS_E) + return res->aux.usage; return ISL_AUX_USAGE_NONE; }