Mesa (master): iris: Resolve stencil resource prior to copy or used by CPU

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 29 21:50:35 UTC 2019


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

Author: Sagar Ghuge <sagar.ghuge at intel.com>
Date:   Tue Sep 17 13:20:16 2019 -0700

iris: Resolve stencil resource prior to copy or used by CPU

v2: Decide aux usage in get_copy_region_aux_settings (Nanley Chery)

v3: Use isl_surf_usage_is_stencil function (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_blit.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c
index e10e54667f4..62179edd9bb 100644
--- a/src/gallium/drivers/iris/iris_blit.c
+++ b/src/gallium/drivers/iris/iris_blit.c
@@ -566,19 +566,29 @@ static void
 get_copy_region_aux_settings(const struct gen_device_info *devinfo,
                              struct iris_resource *res,
                              enum isl_aux_usage *out_aux_usage,
-                             bool *out_clear_supported)
+                             bool *out_clear_supported,
+                             bool is_render_target)
 {
    switch (res->aux.usage) {
    case ISL_AUX_USAGE_MCS:
    case ISL_AUX_USAGE_MCS_CCS:
    case ISL_AUX_USAGE_CCS_E:
-      *out_aux_usage = res->aux.usage;
-      /* Prior to Gen9, fast-clear only supported 0/1 clear colors.  Since
-       * we're going to re-interpret the format as an integer format possibly
-       * with a different number of components, we can't handle clear colors
-       * until Gen9.
+      /* A stencil resolve operation must be performed prior to doing resource
+       * copies or used by CPU.
+       * (see HSD 1209978162)
        */
-      *out_clear_supported = devinfo->gen >= 9;
+      if (is_render_target && isl_surf_usage_is_stencil(res->surf.usage)) {
+         *out_aux_usage = ISL_AUX_USAGE_NONE;
+         *out_clear_supported = false;
+      } else {
+         *out_aux_usage = res->aux.usage;
+         /* Prior to Gen9, fast-clear only supported 0/1 clear colors.  Since
+          * we're going to re-interpret the format as an integer format possibly
+          * with a different number of components, we can't handle clear colors
+          * until Gen9.
+          */
+         *out_clear_supported = devinfo->gen >= 9;
+      }
       break;
    default:
       *out_aux_usage = ISL_AUX_USAGE_NONE;
@@ -615,9 +625,9 @@ iris_copy_region(struct blorp_context *blorp,
    enum isl_aux_usage src_aux_usage, dst_aux_usage;
    bool src_clear_supported, dst_clear_supported;
    get_copy_region_aux_settings(devinfo, src_res, &src_aux_usage,
-                                &src_clear_supported);
+                                &src_clear_supported, false);
    get_copy_region_aux_settings(devinfo, dst_res, &dst_aux_usage,
-                                &dst_clear_supported);
+                                &dst_clear_supported, true);
 
    if (iris_batch_references(batch, src_res->bo))
       tex_cache_flush_hack(batch, ISL_FORMAT_UNSUPPORTED, src_res->surf.format);




More information about the mesa-commit mailing list