[Mesa-dev] [PATCH 3/3] intel/blorp: Work around HiZ clear bugs on Sky Lake
Jason Ekstrand
jason at jlekstrand.net
Wed Oct 24 23:01:27 UTC 2018
---
src/intel/blorp/blorp_clear.c | 49 +++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
index 7f0d3b70993..82672dd2282 100644
--- a/src/intel/blorp/blorp_clear.c
+++ b/src/intel/blorp/blorp_clear.c
@@ -708,6 +708,55 @@ blorp_can_hiz_clear_depth(const struct gen_device_info *devinfo,
x1 % align_px_w || y1 % align_px_h)
return false;
}
+
+ if (devinfo->gen >= 9) {
+ /* We can always do full-surface clears */
+ if (is_full_surface_clear(surf, level, x0, y0, x1, y1))
+ return true;
+
+ /* The Bspec says the following about fast depth clears on Sky Lake:
+ *
+ * "The minimum granularity of clear is one pixel, but all samples of
+ * the pixel must be cleared. Clearing partial samples of a pixel is
+ * not supported. If a newly allocated depth buffer is not padded to
+ * an integer multiple of 8x4 pixels, and if the first operation on
+ * the depth buffer does not clear the entire width and height of the
+ * surface, then first a HiZ ambiguate must be done on the portions
+ * of the depth buffer that are not cleared. If the depth buffer
+ * clear operation does clear the entire width and height of the
+ * surface, then the “full surface clear” bit in 3DSTATE_WM_OP must
+ * be set to 1."
+ *
+ * This seems to imply that HiZ clears should "just work" on Sky Lake.
+ * Unfortunately, that is not true in all cases. It works for the most
+ * part but if the clear encounters a block in the pass-through state
+ * (i.e. one that has been touched by an ambiguate/hiz resolve) it falls
+ * over and just does nothing.
+ *
+ * The following table of alignments was determined experimentally using
+ * the crucible test group func.renderpass.depth-partial-clear.*
+ *
+ * TODO: Test on future hardware
+ */
+ unsigned x_align_px, y_align_px;
+ if (surf->format == ISL_FORMAT_R16_UNORM && surf->samples == 1) {
+ x_align_px = 8;
+ y_align_px = 4;
+ } else if (surf->samples <= 2) {
+ x_align_px = 4;
+ y_align_px = 4;
+ } else if (surf->format == ISL_FORMAT_R16_UNORM && surf->samples == 4) {
+ x_align_px = 4;
+ y_align_px = 2;
+ } else {
+ x_align_px = 2;
+ y_align_px = 2;
+ }
+ if (x0 % x_align_px || y0 % y_align_px ||
+ x1 % x_align_px || y1 % y_align_px)
+ return false;
+ }
+
return true;
}
--
2.19.1
More information about the mesa-dev
mailing list