Mesa (master): iris: Explain how conditional aux accesses work

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 8 23:28:11 UTC 2021


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

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Fri Jan  8 10:18:28 2021 -0800

iris: Explain how conditional aux accesses work

Apart from an issue with fast clears that will be addressed soon,
aux-state tracking with conditional rendering works because the
aux-state info needed for performing required resolves is never lost.

Add comments explaining how this works. Assertions are omitted to avoid
having to pass render_condition variables into
iris_resource_prepare_access and iris_resource_finish_write.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7762>

---

 src/gallium/drivers/iris/iris_resolve.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c
index 7c2f3ea51a0..010163ad7f8 100644
--- a/src/gallium/drivers/iris/iris_resolve.c
+++ b/src/gallium/drivers/iris/iris_resolve.c
@@ -709,6 +709,12 @@ iris_resource_prepare_access(struct iris_context *ice,
          const enum isl_aux_op aux_op =
             isl_aux_prepare_access(aux_state, aux_usage, fast_clear_supported);
 
+         /* Prepare the aux buffer for a conditional or unconditional access.
+          * A conditional access is handled by assuming that the access will
+          * not evaluate to a no-op. If the access does in fact occur, the aux
+          * will be in the required state. If it does not, no data is lost
+          * because the aux_op performed is lossless.
+          */
          if (aux_op == ISL_AUX_OP_NONE) {
             /* Nothing to do here. */
          } else if (isl_aux_usage_has_mcs(res->aux.usage)) {
@@ -746,8 +752,18 @@ iris_resource_finish_write(struct iris_context *ice,
       const uint32_t layer = start_layer + a;
       const enum isl_aux_state aux_state =
          iris_resource_get_aux_state(res, level, layer);
+
+      /* Transition the aux state for a conditional or unconditional write. A
+       * conditional write is handled by assuming that the write applies to
+       * only part of the render target. This prevents the new state from
+       * losing the types of compression that might exist in the current state
+       * (e.g. CLEAR). If the write evaluates to a no-op, the state will still
+       * be able to communicate when resolves are necessary (but it may
+       * falsely communicate this as well).
+       */
       const enum isl_aux_state new_aux_state =
          isl_aux_state_transition_write(aux_state, aux_usage, false);
+
       iris_resource_set_aux_state(ice, res, level, layer, 1, new_aux_state);
    }
 }



More information about the mesa-commit mailing list