iris: Enable HIZ_CCS sampling
authorNanley Chery <nanley.g.chery@intel.com>
Wed, 21 Aug 2019 22:23:24 +0000 (15:23 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Mon, 28 Oct 2019 17:47:06 +0000 (10:47 -0700)
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_blit.c
src/gallium/drivers/iris/iris_resolve.c
src/gallium/drivers/iris/iris_resource.c

index e8a5b8b1eb408aef588dc461bf39ba1d7b34f4c5..ab3438fb6efe48c1d06ef0cc643cdde48bf2e20b 100644 (file)
@@ -355,7 +355,7 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
    enum isl_aux_usage src_aux_usage =
       iris_resource_texture_aux_usage(ice, src_res, src_fmt.fmt, 0);
 
-   if (src_aux_usage == ISL_AUX_USAGE_HIZ)
+   if (iris_resource_level_has_hiz(src_res, info->src.level))
       src_aux_usage = ISL_AUX_USAGE_NONE;
 
    bool src_clear_supported = src_aux_usage != ISL_AUX_USAGE_NONE &&
index 973aeb1152d170792b6410f4be52f793626f2621..f4b5002bd5bffb803b48eb8b1bc35d056202d089 100644 (file)
@@ -558,14 +558,22 @@ format_ccs_e_compat_with_resource(const struct gen_device_info *devinfo,
 }
 
 static bool
-sample_with_hiz(const struct gen_device_info *devinfo,
-                const struct iris_resource *res)
+sample_with_depth_aux(const struct gen_device_info *devinfo,
+                      const struct iris_resource *res)
 {
-   if (!devinfo->has_sample_with_hiz)
+   switch (res->aux.usage) {
+   case ISL_AUX_USAGE_HIZ:
+      if (devinfo->has_sample_with_hiz)
+         break;
       return false;
-
-   if (res->aux.usage != ISL_AUX_USAGE_HIZ)
+   case ISL_AUX_USAGE_HIZ_CCS:
+      /* Write through mode must have been enabled for prior writes. */
+      if (isl_surf_supports_hiz_ccs_wt(devinfo, &res->surf, res->aux.usage))
+         break;
       return false;
+   default:
+      return false;
+   }
 
    /* It seems the hardware won't fallback to the depth buffer if some of the
     * mipmap levels aren't available in the HiZ buffer. So we need all levels
@@ -1342,10 +1350,15 @@ iris_resource_texture_aux_usage(struct iris_context *ice,
 
    switch (res->aux.usage) {
    case ISL_AUX_USAGE_HIZ:
-      if (sample_with_hiz(devinfo, res))
+      if (sample_with_depth_aux(devinfo, res))
          return ISL_AUX_USAGE_HIZ;
       break;
 
+   case ISL_AUX_USAGE_HIZ_CCS:
+      if (sample_with_depth_aux(devinfo, res))
+         return ISL_AUX_USAGE_CCS_E;
+      break;
+
    case ISL_AUX_USAGE_MCS:
       return ISL_AUX_USAGE_MCS;
 
index 1247ab8fd067b28068d4888ff98c476e214694ce..ecf63f49ade3e5f49366adbefa36069dae17edcd 100644 (file)
@@ -498,8 +498,11 @@ iris_resource_configure_aux(struct iris_screen *screen,
    if (!devinfo->has_sample_with_hiz || res->surf.samples > 1)
       res->aux.sampler_usages &= ~(1 << ISL_AUX_USAGE_HIZ);
 
-   /* We don't yet support sampling with HIZ_CCS. */
+   /* We don't always support sampling with HIZ_CCS. But when we do, treat it
+    * as CCS_E.*/
    res->aux.sampler_usages &= ~(1 << ISL_AUX_USAGE_HIZ_CCS);
+   if (isl_surf_supports_hiz_ccs_wt(devinfo, &res->surf, res->aux.usage))
+      res->aux.sampler_usages |= 1 << ISL_AUX_USAGE_CCS_E;
 
    enum isl_aux_state initial_state;
    *aux_size_B = 0;