iris: Avoid extra CCS_E flushes for aux mode changes
authorNanley Chery <nanley.g.chery@intel.com>
Wed, 24 May 2023 17:05:45 +0000 (10:05 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 7 Jun 2023 23:39:39 +0000 (23:39 +0000)
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 <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23220>

src/gallium/drivers/iris/iris_resolve.c

index c4cb48c..35a86a5 100644 (file)
@@ -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) {