diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c index ae5a1486b0a..4444e184660 100644 --- a/src/intel/blorp/blorp_clear.c +++ b/src/intel/blorp/blorp_clear.c @@ -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; } diff --git a/src/intel/vulkan/anv_image_view.c b/src/intel/vulkan/anv_image_view.c index 16709cf8a00..9ae6ec49622 100644 --- a/src/intel/vulkan/anv_image_view.c +++ b/src/intel/vulkan/anv_image_view.c @@ -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; diff --git a/src/intel/vulkan_hasvk/genX_cmd_buffer.c b/src/intel/vulkan_hasvk/genX_cmd_buffer.c index c37f83b2126..581d11e8f35 100644 --- a/src/intel/vulkan_hasvk/genX_cmd_buffer.c +++ b/src/intel/vulkan_hasvk/genX_cmd_buffer.c @@ -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;