summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanley Chery <nanley.g.chery@intel.com>2020-10-09 10:07:51 -0700
committerMarge Bot <eric+marge@anholt.net>2020-10-14 18:44:08 +0000
commitf94ba6b6f56afdc443e22b1cafcd9d3f6f3f007e (patch)
tree8a0b523be6b768c205a618b22c208be301504423
parent1affcea37a6529d99626cd7daa8d7e8d9144dfb4 (diff)
iris: Add fast-clear restriction for 8bpp surfaces
For 8bpp surfaces on TGL, prevent LOD1+ from being fast-cleared. This will be relevant once ISL starts allowing CCS for 8bpp surfaces with more than 2 miplevels. I verified the problem behind this restriction with a modified version of the fbo-clearmipmap piglit test. Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7085>
-rw-r--r--src/gallium/drivers/iris/iris_clear.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 43af59cffa5..a4d45a4a02c 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -114,6 +114,23 @@ can_fast_clear_color(struct iris_context *ice,
if (!iris_is_color_fast_clear_compatible(ice, res->surf.format, color))
return false;
+ /* The RENDER_SURFACE_STATE page for TGL says:
+ *
+ * For an 8 bpp surface with NUM_MULTISAMPLES = 1, Surface Width not
+ * multiple of 64 pixels and more than 1 mip level in the view, Fast Clear
+ * is not supported when AUX_CCS_E is set in this field.
+ *
+ * The granularity of a fast-clear is one CCS element. For an 8 bpp primary
+ * surface, this maps to 32px x 4rows. Due to the surface layout parameters,
+ * if LOD0's width isn't a multiple of 64px, LOD1 and LOD2+ will share CCS
+ * elements. Assuming LOD2 exists, don't fast-clear any level above LOD0
+ * to avoid stomping on other LODs.
+ */
+ if (level > 0 && util_format_get_blocksizebits(p_res->format) == 8 &&
+ res->aux.usage == ISL_AUX_USAGE_GEN12_CCS_E && p_res->width0 % 64) {
+ return false;
+ }
+
return true;
}