iris: Enable HiZ for multisampled depth surfaces.
authorRafael Antognolli <rafael.antognolli@intel.com>
Wed, 13 Mar 2019 23:56:55 +0000 (16:56 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 19 Mar 2019 05:21:30 +0000 (22:21 -0700)
Fix this check so that we can get a HiZ aux buffer for multisampled
surfaces as well. Also make sure we don't try to emit a sampler view
surface state for multisampled depth sufaces with HiZ enabled, as
the sampler can't HiZ for multisampled buffers and isl would assert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_state.c

index e08247236761aa90d4a13a0dbf5b1bc3e0a6127e..8bb0b3faa719f7d06aea047ed89fe1d060d00a27 100644 (file)
@@ -567,21 +567,18 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
 
    if (res->mod_info) {
       res->aux.possible_usages |= 1 << res->mod_info->aux_usage;
-   } else if (res->surf.samples > 1) {
-      if (supports_mcs(&res->surf))
-         res->aux.possible_usages |= 1 << ISL_AUX_USAGE_MCS;
-   } else {
-      if (has_depth) {
-         if (likely(!(INTEL_DEBUG & DEBUG_NO_HIZ)))
-            res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ;
-      } else if (likely(!(INTEL_DEBUG & DEBUG_NO_RBC)) &&
-                 supports_ccs(devinfo, &res->surf)) {
-         if (isl_format_supports_ccs_e(devinfo, res->surf.format))
-            res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_E;
-
-         if (isl_format_supports_ccs_d(devinfo, res->surf.format))
-            res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_D;
-      }
+   } else if (supports_mcs(&res->surf)) {
+      res->aux.possible_usages |= 1 << ISL_AUX_USAGE_MCS;
+   } else if (has_depth) {
+      if (likely(!(INTEL_DEBUG & DEBUG_NO_HIZ)))
+         res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ;
+   } else if (likely(!(INTEL_DEBUG & DEBUG_NO_RBC)) &&
+              supports_ccs(devinfo, &res->surf)) {
+      if (isl_format_supports_ccs_e(devinfo, res->surf.format))
+         res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_E;
+
+      if (isl_format_supports_ccs_d(devinfo, res->surf.format))
+         res->aux.possible_usages |= 1 << ISL_AUX_USAGE_CCS_D;
    }
 
    res->aux.usage = util_last_bit(res->aux.possible_usages) - 1;
index eaa40d33fdfb9323a375aca18542458daadab020..bd5ee14a5f0c9a7238db766d98ec7fcc6fedcbb3 100644 (file)
@@ -1731,8 +1731,13 @@ iris_create_sampler_view(struct pipe_context *ctx,
       while (aux_modes) {
          enum isl_aux_usage aux_usage = u_bit_scan(&aux_modes);
 
-         fill_surface_state(&screen->isl_dev, map, isv->res, &isv->view,
-                            aux_usage);
+         /* If we have a multisampled depth buffer, do not create a sampler
+          * surface state with HiZ.
+          */
+         if (!(aux_usage == ISL_AUX_USAGE_HIZ && isv->res->surf.samples > 1)) {
+            fill_surface_state(&screen->isl_dev, map, isv->res, &isv->view,
+                               aux_usage);
+         }
 
          map += SURFACE_STATE_ALIGNMENT;
       }