From 39ec3c180e37ca910bbd32da08ea4dd9be48da18 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Wed, 24 May 2023 10:05:45 -0700 Subject: [PATCH] iris: Avoid extra CCS_E flushes for aux mode changes We're going to start toggling between FCV_CCS_E and CCS_E. When switching aux modes, flush_previous_aux_mode would typically perform cache flushes for good reason. In the case of switching between CCS_E with FCV on vs off, we haven't found aux mode flushing to matter. Treat both CCS_E variants as equivalent to avoid extra cache flushing. Reviewed-by: Rohan Garg Part-of: --- src/gallium/drivers/iris/iris_resolve.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index c4cb48c..35a86a5 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -406,8 +406,18 @@ flush_previous_aux_mode(struct iris_batch *batch, * isn't 100% resilient to format changes. However, to date, we have never * observed GPU hangs or even corruption to be associated with switching the * format, only the aux usage. So we let that slide for now. + * + * We haven't seen issues on gfx12 hardware when switching between + * FCV_CCS_E and plain CCS_E. A switch could indicate a transition in + * accessing data through a different cache domain. The flushes and + * invalidates that come from the cache tracker and memory barrier + * functions seem to be enough to handle this. Treat the two as equivalent + * to avoid extra cache flushing. */ - void *v_aux_usage = (void *) (uintptr_t) aux_usage; + void *v_aux_usage = (void *) (uintptr_t) + (aux_usage == ISL_AUX_USAGE_FCV_CCS_E ? + ISL_AUX_USAGE_CCS_E : aux_usage); + struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(batch->bo_aux_modes, bo->hash, bo); if (!entry) { -- 2.7.4