intel: Adjust partial depth fast clear checks

None of our tracked games use partial depth clears, so only allow it in
simple cases for testing purposes. This change also fixes an issue on
gfx8, where we had been accidentally disabling full surface clears if
the LOD was not 8x4 aligned.

Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30250>
This commit is contained in:
Nanley Chery
2024-07-17 11:41:15 -04:00
committed by Marge Bot
parent dd384104b7
commit a28bd0abdf
3 changed files with 48 additions and 19 deletions

View File

@@ -926,23 +926,7 @@ blorp_can_hiz_clear_depth(const struct intel_device_info *devinfo,
/* This function currently doesn't support any gen prior to gfx8 */
assert(devinfo->ver >= 8);
if (devinfo->ver == 8 && surf->format == ISL_FORMAT_R16_UNORM) {
/* From the BDW PRM, Vol 7, "Depth Buffer Clear":
*
* The following restrictions apply only if the depth buffer surface
* type is D16_UNORM and software does not use the “full surf clear”:
*
* If Number of Multisamples is NUMSAMPLES_1, the rectangle must be
* aligned to an 8x4 pixel block relative to the upper left corner of
* the depth buffer, and contain an integer number of these pixel
* blocks, and all 8x4 pixels must be lit.
*
* Alignment requirements for other sample counts are listed, but they
* can all be satisfied by the one mentioned above.
*/
if (x0 % 8 || y0 % 4 || x1 % 8 || y1 % 4)
return false;
} else if (isl_aux_usage_has_ccs(aux_usage)) {
if (aux_usage == ISL_AUX_USAGE_HIZ_CCS_WT && level > 0) {
/* We have to set the WM_HZ_OP::FullSurfaceDepthandStencilClear bit
* whenever we clear an uninitialized HIZ buffer (as some drivers
* currently do). However, this bit seems liable to clear 16x8 pixels in
@@ -980,9 +964,8 @@ blorp_can_hiz_clear_depth(const struct intel_device_info *devinfo,
const bool unaligned = (slice_x0 + x0) % 16 || (slice_y0 + y0) % 8 ||
(max_x1_y1 ? haligned_x1 % 16 || valigned_y1 % 8 :
x1 % 16 || y1 % 8);
const bool partial_clear = x0 > 0 || y0 > 0 || !max_x1_y1;
if (unaligned && (partial_clear || level > 0))
if (unaligned)
return false;
}

View File

@@ -205,6 +205,27 @@ anv_can_hiz_clear_ds_view(struct anv_device *device,
render_area.extent.height))
return false;
if (isl_aux_usage_has_ccs(clear_aux_usage)) {
/* From the TGL PRM, Vol 9, "Compressed Depth Buffers" (under the
* "Texture performant" and "ZCS" columns):
*
* Update with clear at either 16x8 or 8x4 granularity, based on
* fs_clr or otherwise.
*
* Although alignment requirements are only listed for the texture
* performant mode, test results indicate that requirements exist for
* the non-texture performant mode as well. Disable partial clears.
*/
if (render_area.offset.x > 0 ||
render_area.offset.y > 0 ||
render_area.extent.width !=
u_minify(iview->vk.extent.width, iview->vk.base_mip_level) ||
render_area.extent.height !=
u_minify(iview->vk.extent.height, iview->vk.base_mip_level)) {
return false;
}
}
if (depth_clear_value != ANV_HZ_FC_VAL)
return false;

View File

@@ -427,6 +427,31 @@ anv_can_hiz_clear_ds_view(struct anv_device *device,
render_area.extent.height))
return false;
assert(GFX_VER == 8);
assert(iview->vk.format != VK_FORMAT_D16_UNORM_S8_UINT);
if (iview->vk.format == VK_FORMAT_D16_UNORM) {
/* From the BDW PRM, Vol 7, "Depth Buffer Clear":
*
* The following restrictions apply only if the depth buffer surface
* type is D16_UNORM and software does not use the “full surf clear”:
*
* If Number of Multisamples is NUMSAMPLES_1, the rectangle must be
* aligned to an 8x4 pixel block relative to the upper left corner of
* the depth buffer, and contain an integer number of these pixel
* blocks, and all 8x4 pixels must be lit.
*
* Simply disable partial clears for D16 on BDW.
*/
if (render_area.offset.x > 0 ||
render_area.offset.y > 0 ||
render_area.extent.width !=
u_minify(iview->vk.extent.width, iview->vk.base_mip_level) ||
render_area.extent.height !=
u_minify(iview->vk.extent.height, iview->vk.base_mip_level)) {
return false;
}
}
if (depth_clear_value != ANV_HZ_FC_VAL)
return false;