Mesa (master): iris: Fix a fast-clear skipping optimization

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 6 15:11:38 UTC 2020


Module: Mesa
Branch: master
Commit: 3f3a5f3489f5df6061ea8e74e697287bbbb4e252
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f3a5f3489f5df6061ea8e74e697287bbbb4e252

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Tue Sep 29 05:49:54 2020 -0700

iris: Fix a fast-clear skipping optimization

When support for multi-slice fast-clears was introduced for color
surfaces, an existing optimization for skipping fast-clears was not
updated (this optimization assumed single-slice fast-clears). As a
result, the driver began to skip multi-layer fast-clears if just the
first slice was in the CLEAR state (ignoring the state of the others).

A Civilization VI trace was the only workload I found to make use of
this optimization and it did so for 2D, non-array textures. Therefore,
this fix simply checks that the depth of the clear box is 1. It also
moves the single-slice aux-state query closer to the optimization to
clarify the need for the depth check.

Enables iris to pass a case of the fcc-write-after-clear piglit test,
[fast-clear tracking across layers 0 -> 1 -> (0,1)].

Fixes: 393f659ed83 ("iris: Enable fast clears on other miplevels and layers than 0.")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6973>

---

 src/gallium/drivers/iris/iris_clear.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 4171a876c76..43af59cffa5 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -198,8 +198,6 @@ fast_clear_color(struct iris_context *ice,
 {
    struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER];
    struct pipe_resource *p_res = (void *) res;
-   const enum isl_aux_state aux_state =
-      iris_resource_get_aux_state(res, level, box->z);
 
    color = convert_fast_clear_color(ice, res, color);
 
@@ -278,7 +276,9 @@ fast_clear_color(struct iris_context *ice,
    /* If the buffer is already in ISL_AUX_STATE_CLEAR, and the color hasn't
     * changed, the clear is redundant and can be skipped.
     */
-   if (!color_changed && aux_state == ISL_AUX_STATE_CLEAR)
+   const enum isl_aux_state aux_state =
+      iris_resource_get_aux_state(res, level, box->z);
+   if (!color_changed && box->depth == 1 && aux_state == ISL_AUX_STATE_CLEAR)
       return;
 
    /* Ivybrigde PRM Vol 2, Part 1, "11.7 MCS Buffer for Render Target(s)":



More information about the mesa-commit mailing list