iris: Use ISL_AUX_USAGE_STC_CCS for stencil CCS
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 5 Mar 2020 17:46:51 +0000 (11:46 -0600)
committerMarge Bot <eric+marge@anholt.net>
Thu, 12 Mar 2020 17:51:28 +0000 (17:51 +0000)
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4056>

src/gallium/drivers/iris/iris_blit.c
src/gallium/drivers/iris/iris_resolve.c
src/gallium/drivers/iris/iris_resource.c

index 43382f9195485b62b71397dc974cfd7be5d1ccfc..a7aca922e80178f288ab72ed2494b5456270fd5c 100644 (file)
@@ -597,6 +597,10 @@ get_copy_region_aux_settings(struct iris_context *ice,
        */
       *out_clear_supported = devinfo->gen >= 9;
       break;
+   case ISL_AUX_USAGE_STC_CCS:
+      *out_aux_usage = res->aux.usage;
+      *out_clear_supported = false;
+      break;
    default:
       *out_aux_usage = ISL_AUX_USAGE_NONE;
       *out_clear_supported = false;
index fdb45a37c71b1fe208cd2a6732f9e1fefe0d75c0..2208226e6073cc7009f9e22bb269b7b6111204dc 100644 (file)
@@ -499,7 +499,7 @@ iris_resolve_color(struct iris_context *ice,
    /* On Gen >= 12, Stencil buffer with lossless compression needs to be
     * resolve with WM_HZ_OP packet.
     */
-   if (isl_surf_usage_is_stencil(res->surf.usage)) {
+   if (res->aux.usage == ISL_AUX_USAGE_STC_CCS) {
       blorp_hiz_stencil_op(&blorp_batch, &surf, level, layer,
                            1, resolve_op);
    } else {
@@ -962,6 +962,7 @@ iris_resource_texture_aux_usage(struct iris_context *ice,
 
    case ISL_AUX_USAGE_MCS:
    case ISL_AUX_USAGE_MCS_CCS:
+   case ISL_AUX_USAGE_STC_CCS:
       return res->aux.usage;
 
    case ISL_AUX_USAGE_CCS_D:
index 8142c42f3dcea035049033abce4a5604a8c798ba..cec772c7178b0687c34ee5b180b521c702d05c3d 100644 (file)
@@ -492,6 +492,8 @@ iris_resource_configure_aux(struct iris_screen *screen,
       } else {
          res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ_CCS;
       }
+   } else if (has_ccs && isl_surf_usage_is_stencil(res->surf.usage)) {
+      res->aux.possible_usages |= 1 << ISL_AUX_USAGE_STC_CCS;
    } else if (has_ccs) {
       if (want_ccs_e_for_format(devinfo, res->surf.format))
          res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_E;
@@ -542,6 +544,7 @@ iris_resource_configure_aux(struct iris_screen *screen,
       break;
    case ISL_AUX_USAGE_CCS_D:
    case ISL_AUX_USAGE_CCS_E:
+   case ISL_AUX_USAGE_STC_CCS:
       /* When CCS_E is used, we need to ensure that the CCS starts off in
        * a valid state.  From the Sky Lake PRM, "MCS Buffer for Render
        * Target(s)":
@@ -555,11 +558,13 @@ iris_resource_configure_aux(struct iris_screen *screen,
        * For CCS_D, do the same thing.  On Gen9+, this avoids having any
        * undefined bits in the aux buffer.
        */
-      if (imported)
+      if (imported) {
+         assert(res->aux.usage != ISL_AUX_USAGE_STC_CCS);
          initial_state =
             isl_drm_modifier_get_default_aux_state(res->mod_info->modifier);
-      else
+      } else {
          initial_state = ISL_AUX_STATE_PASS_THROUGH;
+      }
       *alloc_flags |= BO_ALLOC_ZEROED;
       break;
    case ISL_AUX_USAGE_MC:
@@ -1803,13 +1808,16 @@ iris_transfer_map(struct pipe_context *ctx,
 
    if (resource->target != PIPE_BUFFER) {
       bool need_hiz_resolve = iris_resource_level_has_hiz(res, level);
+      bool need_stencil_resolve = res->aux.usage == ISL_AUX_USAGE_STC_CCS;
 
       need_color_resolve =
          (res->aux.usage == ISL_AUX_USAGE_CCS_D ||
           res->aux.usage == ISL_AUX_USAGE_CCS_E) &&
          iris_has_color_unresolved(res, level, 1, box->z, box->depth);
 
-      need_resolve = need_color_resolve || need_hiz_resolve;
+      need_resolve = need_color_resolve ||
+                     need_hiz_resolve ||
+                     need_stencil_resolve;
    }
 
    bool map_would_stall = false;