Mesa (master): iris: Initialize CCS to fast clear while using with MCS

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 28 21:03:03 UTC 2019


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

Author: Sagar Ghuge <sagar.ghuge at intel.com>
Date:   Thu Sep 19 08:13:15 2019 -0700

iris: Initialize CCS to fast clear while using with MCS

v2: Explain Bsepc quotes properly (Nanley Chery)

v3: 1) Fix comment format (Nanley Chery)
    2) Fix typo in comment (Nanley Chery)

Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>

---

 src/gallium/drivers/iris/iris_resource.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 61b47ae73b1..5a3c271e559 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -611,13 +611,24 @@ iris_resource_init_aux_buf(struct iris_resource *res, uint32_t alloc_flags,
       }
 
       if (iris_resource_get_aux_state(res, 0, 0) != ISL_AUX_STATE_AUX_INVALID) {
-         uint8_t memset_value = res->aux.usage == ISL_AUX_USAGE_MCS ? 0xFF : 0;
+         uint8_t memset_value = isl_aux_usage_has_mcs(res->aux.usage) ? 0xFF : 0;
          memset((char*)map + res->aux.offset, memset_value,
                 res->aux.surf.size_B);
       }
 
-      /* Resolved is usually a safe state for CCS_E. */
-      memset((char*)map + res->aux.extra_aux.offset, 0,
+      /* Bspec section titled : MCS/CCS Buffers for Render Target(s) states:
+       *    - If Software wants to enable Color Compression without Fast clear,
+       *      Software needs to initialize MCS with zeros.
+       *    - Lossless compression and CCS initialized to all F (using HW Fast
+       *      Clear or SW direct Clear)
+       *
+       * We think, the first bullet point above is referring to CCS aux
+       * surface. Since we initialize the MCS in the clear state, we also
+       * initialize the CCS in the clear state (via SW direct clear) to keep
+       * the two in sync.
+       */
+      memset((char*)map + res->aux.extra_aux.offset,
+             isl_aux_usage_has_mcs(res->aux.usage) ? 0xFF : 0,
              res->aux.extra_aux.surf.size_B);
 
       /* Zero the indirect clear color to match ::fast_clear_color. */




More information about the mesa-commit mailing list