radv: fix HTILE metadata initialization in presence of subpass clears
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 25 Jun 2018 11:34:10 +0000 (13:34 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 25 Jun 2018 15:38:59 +0000 (17:38 +0200)
If the driver ends up by performing a slow depthstencil clear,
the HTILE metadata won't be initialized correctly.

This fixes random VM faults on Polaris while running CTS
with Bas's runner. This doesn't seem to regress performance.

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index 8bd41bc41acf17c063bf69bd54f6ffea3cdb3aa6..0388e4b6e0e9751218e524d3cd0636c6df04bf44 100644 (file)
@@ -3987,14 +3987,7 @@ static void radv_handle_depth_image_transition(struct radv_cmd_buffer *cmd_buffe
        if (!radv_image_has_htile(image))
                return;
 
-       if (dst_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL &&
-           (pending_clears & vk_format_aspects(image->vk_format)) == vk_format_aspects(image->vk_format) &&
-           cmd_buffer->state.render_area.offset.x == 0 && cmd_buffer->state.render_area.offset.y == 0 &&
-           cmd_buffer->state.render_area.extent.width == image->info.width &&
-           cmd_buffer->state.render_area.extent.height == image->info.height) {
-               /* The clear will initialize htile. */
-               return;
-       } else if (src_layout == VK_IMAGE_LAYOUT_UNDEFINED &&
+       if (src_layout == VK_IMAGE_LAYOUT_UNDEFINED &&
                   radv_layout_has_htile(image, dst_layout, dst_queue_mask)) {
                /* TODO: merge with the clear if applicable */
                radv_initialize_htile(cmd_buffer, image, range, 0);