From: Nanley Chery Date: Thu, 15 Aug 2019 17:17:11 +0000 (-0700) Subject: intel/blorp: Disable depth testing for slow depth clears X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5fb9cccdce2d44427582ca6d9201d5ec42fedb2;p=mesa.git intel/blorp: Disable depth testing for slow depth clears We'll start doing slow depth clears more often on HIZ_CCS buffers in a future commit. Reduce the performance impact by making them use less bandwidth. From the Depth Test section of the BSpec: This function is enabled by the Depth Test Enable state variable. If enabled, the pixel's ("source") depth value is first computed. After computation the pixel's depth value is clamped to the range defined by Minimum Depth and Maximum Depth in the selected CC_VIEWPORT state. Then the current ("destination") depth buffer value for this pixel is read. and from the Depth Buffer Updates section of the BSpec: If depth testing is disabled or the depth test passed, the incoming pixel's depth value is written to the Depth Buffer. Taken together, it's clear that depth testing isn't necessary to perform a depth buffer clear. Mark Janes and I analyzed this patch with frameretrace and a depthrange piglit test. I disabled HiZ to ensure we'd get slow depth clears. We've observed the bandwidth consumption by the depth buffer access to be cut ~50% on BDW and SKL during depth clears. On a more graphically intensive workload, the Shadowmapping Sascha benchmark, I took the average of 3 runs on a BDW with a display resolution of about 1920x1200 (minus some desktop environment decorations). I measured a 22.61% FPS improvement when HiZ is disabled. v2. The BSpec doesn't mandate this behavior, update comment accordingly. (Ken) Fixes: bc4bb5a7e30 ("intel/blorp: Emit more complete DEPTH_STENCIL state") Reviewed-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index 61db3841801..f47372f9f06 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -1111,11 +1111,6 @@ blorp_emit_depth_stencil_state(struct blorp_batch *batch, ds.DepthBufferWriteEnable = true; switch (params->hiz_op) { - case ISL_AUX_OP_NONE: - ds.DepthTestEnable = true; - ds.DepthTestFunction = COMPAREFUNCTION_ALWAYS; - break; - /* See the following sections of the Sandy Bridge PRM, Volume 2, Part1: * - 7.5.3.1 Depth Buffer Clear * - 7.5.3.2 Depth Buffer Resolve @@ -1126,6 +1121,7 @@ blorp_emit_depth_stencil_state(struct blorp_batch *batch, ds.DepthTestFunction = COMPAREFUNCTION_NEVER; break; + case ISL_AUX_OP_NONE: case ISL_AUX_OP_FAST_CLEAR: case ISL_AUX_OP_AMBIGUATE: ds.DepthTestEnable = false;