diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index e3ac6033296..fcca0dd8d14 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -2062,8 +2062,11 @@ can_hiz_clear_att(struct anv_cmd_buffer *cmd_buffer, const VkClearAttachment *attachment, uint32_t rectCount, const VkClearRect *pRects) { - if (INTEL_DEBUG(DEBUG_NO_FAST_CLEAR)) + if (INTEL_DEBUG(DEBUG_NO_FAST_CLEAR)) { + anv_perf_warn(VK_LOG_OBJS(&cmd_buffer->device->vk.base), + "Fast depth/stencil clear rejected: DEBUG_NO_FAST_CLEAR"); return false; + } /* From Bspec's section MI_PREDICATE: * @@ -2081,12 +2084,16 @@ can_hiz_clear_att(struct anv_cmd_buffer *cmd_buffer, * back to the slow depth clear path when the BLORP_BATCH_PREDICATE_ENABLE * flag is set. */ - if (batch->flags & BLORP_BATCH_PREDICATE_ENABLE) + if (batch->flags & BLORP_BATCH_PREDICATE_ENABLE) { + anv_perf_warn(VK_LOG_OBJS(&cmd_buffer->device->vk.base), + "Fast depth/stencil clear rejected: predication enabled"); return false; + } if (rectCount > 1) { anv_perf_warn(VK_LOG_OBJS(&cmd_buffer->device->vk.base), - "Fast clears for vkCmdClearAttachments supported only for rectCount == 1"); + "Fast clears for vkCmdClearAttachments supported only " + "for rectCount == 1"); return false; } @@ -2095,8 +2102,11 @@ can_hiz_clear_att(struct anv_cmd_buffer *cmd_buffer, */ assert(batch->flags & BLORP_BATCH_NO_EMIT_DEPTH_STENCIL); if (cmd_buffer->state.gfx.view_mask > 1 || - pRects[0].layerCount > 1 || pRects[0].baseArrayLayer > 0) + pRects[0].layerCount > 1 || pRects[0].baseArrayLayer > 0) { + anv_perf_warn(VK_LOG_OBJS(&cmd_buffer->device->vk.base), + "Fast depth/stencil clear rejected: view/layer range unsupported"); return false; + } return anv_can_hiz_clear_image(cmd_buffer, ds_att->iview->image, ds_att->layout, @@ -2121,15 +2131,24 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer, return; const struct anv_attachment *ds_att = d_att->iview ? d_att : s_att; - if (ds_att->iview && - can_hiz_clear_att(cmd_buffer, batch, ds_att, attachment, rectCount, pRects)) { + if (!ds_att->iview) { + anv_perf_warn(VK_LOG_OBJS(&cmd_buffer->device->vk.base), + "Fast depth/stencil clear rejected: missing image view"); + } else if (can_hiz_clear_att(cmd_buffer, batch, ds_att, attachment, + rectCount, pRects)) { anv_fast_clear_depth_stencil(cmd_buffer, batch, ds_att->iview->image, - attachment->aspectMask, d_att->layout, s_att->layout, + attachment->aspectMask, + d_att->layout, s_att->layout, ds_att->iview->planes[0].isl.base_level, - ds_att->iview->planes[0].isl.base_array_layer, + ds_att->iview->planes[0]. + isl.base_array_layer, pRects[0].layerCount, pRects->rect, &attachment->clearValue.depthStencil); return; + } else { + anv_perf_warn(VK_LOG_OBJS(&cmd_buffer->device->vk.base), + "Falling back to slow depth clear path in " + "vkCmdClearAttachments"); } bool clear_depth = attachment->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT; @@ -2157,7 +2176,8 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer, for (uint32_t r = 0; r < rectCount; ++r) { const VkOffset2D offset = pRects[r].rect.offset; const VkExtent2D extent = pRects[r].rect.extent; - VkClearDepthStencilValue value = attachment->clearValue.depthStencil; + VkClearDepthStencilValue value = + attachment->clearValue.depthStencil; blorp_clear_attachments(batch, binding_table, depth_format, gfx->samples, @@ -2184,7 +2204,8 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer, pRects[r].baseArrayLayer, pRects[r].layerCount, offset.x, offset.y, - offset.x + extent.width, offset.y + extent.height, + offset.x + extent.width, + offset.y + extent.height, false, color_value, clear_depth, value.depth, clear_stencil ? 0xff : 0, value.stencil); diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 8979a9d1981..8b58bc9af48 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -4078,8 +4078,11 @@ anv_can_hiz_clear_image(struct anv_cmd_buffer *cmd_buffer, const struct anv_device *device = cmd_buffer->device; const VkQueueFlagBits queue_flags = cmd_buffer->queue_family->queueFlags; - if (INTEL_DEBUG(DEBUG_NO_FAST_CLEAR)) + if (INTEL_DEBUG(DEBUG_NO_FAST_CLEAR)) { + anv_perf_warn(VK_LOG_OBJS(&image->vk.base), + "DEBUG_NO_FAST_CLEAR. Slow depth clearing."); return false; + } const enum isl_aux_usage clear_aux_usage = anv_layout_to_aux_usage(device->info, image, @@ -4102,8 +4105,12 @@ anv_can_hiz_clear_image(struct anv_cmd_buffer *cmd_buffer, * is set on DG2 and MTL. */ if (clear_aux_usage == ISL_AUX_USAGE_HIZ_CCS_WT && - image->vk.samples > 1 && device->info->ver < 20) + image->vk.samples > 1 && device->info->ver < 20) { + anv_perf_warn(VK_LOG_OBJS(&image->vk.base), + "HiZ CCS WT + MSAA unsupported before Xe2. " + "Slow depth clearing."); return false; + } /* If we're just clearing stencil, we can always HiZ clear */ if (!(clear_aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) @@ -4113,8 +4120,12 @@ anv_can_hiz_clear_image(struct anv_cmd_buffer *cmd_buffer, anv_image_aspect_to_plane(image, VK_IMAGE_ASPECT_DEPTH_BIT); const struct isl_surf *surf = &image->planes[plane].primary_surface.isl; - if (!isl_aux_usage_has_fast_clears(clear_aux_usage)) + if (!isl_aux_usage_has_fast_clears(clear_aux_usage)) { + anv_perf_warn(VK_LOG_OBJS(&image->vk.base), + "aux usage does not support fast depth clear. " + "Slow clearing."); return false; + } if (isl_aux_usage_has_ccs(clear_aux_usage)) { /* From the TGL PRM, Vol 9, "Compressed Depth Buffers" (under the @@ -4133,6 +4144,9 @@ anv_can_hiz_clear_image(struct anv_cmd_buffer *cmd_buffer, u_minify(image->vk.extent.width, level) || render_area.extent.height != u_minify(image->vk.extent.height, level)) { + anv_perf_warn(VK_LOG_OBJS(&image->vk.base), + "partial depth clear rect unsupported for " + "fast clear. Slow clearing."); return false; } @@ -4148,13 +4162,19 @@ anv_can_hiz_clear_image(struct anv_cmd_buffer *cmd_buffer, level >= 1 && (image->vk.extent.width % 32 != 0 || surf->image_alignment_el.h % 8 != 0)) { + anv_perf_warn(VK_LOG_OBJS(&image->vk.base), + "upper-LOD HiZ CCS WT alignment unsupported. " + "Slow depth clearing."); return false; } } if (device->info->ver <= 12 && - depth_clear_value != anv_image_hiz_clear_value(image).f32[0]) - return false; + depth_clear_value != anv_image_hiz_clear_value(image).f32[0]) { + anv_perf_warn(VK_LOG_OBJS(&image->vk.base), + "depth clear value mismatch. Slow depth clearing."); + return false; + } /* If we got here, then we can fast clear */ return true;