iris: Drop iris_resource::aux::has_hiz
authorNanley Chery <nanley.g.chery@intel.com>
Mon, 14 Dec 2020 19:36:29 +0000 (11:36 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 10 Feb 2021 20:48:01 +0000 (20:48 +0000)
Instead of storing a bitfield of which resource levels will be accessed
with HiZ, compute this information on-demand. Makes the iris_resource
struct more generic.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8853>

src/gallium/drivers/iris/iris_clear.c
src/gallium/drivers/iris/iris_resolve.c
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_resource.h

index a821643..0c26747 100644 (file)
@@ -435,7 +435,7 @@ can_fast_clear_depth(struct iris_context *ice,
       return false;
    }
 
-   if (!(res->aux.has_hiz & (1 << level)))
+   if (!iris_resource_level_has_hiz(res, level))
       return false;
 
    if (!blorp_can_hiz_clear_depth(devinfo, &res->surf, res->aux.usage,
index 7a20f60..12251e6 100644 (file)
@@ -590,7 +590,22 @@ bool
 iris_resource_level_has_hiz(const struct iris_resource *res, uint32_t level)
 {
    iris_resource_check_level_layer(res, level, 0);
-   return res->aux.has_hiz & 1 << level;
+
+   if (!isl_aux_usage_has_hiz(res->aux.usage))
+      return false;
+
+   /* Disable HiZ for LOD > 0 unless the width/height are 8x4 aligned.
+    * For LOD == 0, we can grow the dimensions to make it work.
+    */
+   if (level > 0) {
+      if (u_minify(res->base.width0, level) & 7)
+         return false;
+
+      if (u_minify(res->base.height0, level) & 3)
+         return false;
+   }
+
+   return true;
 }
 
 /** \brief Assert that the level and layer are valid for the resource. */
index 8ce3c8a..3f24201 100644 (file)
@@ -385,7 +385,6 @@ iris_resource_disable_aux(struct iris_resource *res)
    res->aux.usage = ISL_AUX_USAGE_NONE;
    res->aux.possible_usages = 1 << ISL_AUX_USAGE_NONE;
    res->aux.sampler_usages = 1 << ISL_AUX_USAGE_NONE;
-   res->aux.has_hiz = 0;
    res->aux.surf.size_B = 0;
    res->aux.bo = NULL;
    res->aux.extra_aux.surf.size_B = 0;
@@ -760,19 +759,6 @@ iris_resource_configure_aux(struct iris_screen *screen,
    if (!res->aux.state)
       return false;
 
-   if (isl_aux_usage_has_hiz(res->aux.usage)) {
-      for (unsigned level = 0; level < res->surf.levels; ++level) {
-         uint32_t width = u_minify(res->surf.phys_level0_sa.width, level);
-         uint32_t height = u_minify(res->surf.phys_level0_sa.height, level);
-
-         /* Disable HiZ for LOD > 0 unless the width/height are 8x4 aligned.
-          * For LOD == 0, we can grow the dimensions to make it work.
-          */
-         if (level == 0 || ((width & 7) == 0 && (height & 3) == 0))
-            res->aux.has_hiz |= 1 << level;
-      }
-   }
-
    return true;
 }
 
index 0bbf90f..0f58a53 100644 (file)
@@ -152,11 +152,6 @@ struct iris_resource {
        * aux state for each slice.
        */
       enum isl_aux_state **state;
-
-      /**
-       * If (1 << level) is set, HiZ is enabled for that miplevel.
-       */
-      uint16_t has_hiz;
    } aux;
 
    /**