radv: fixup DCC after color resolves using the compute path
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 5 Jan 2021 08:26:36 +0000 (09:26 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 12 Jan 2021 16:03:36 +0000 (16:03 +0000)
If the dest image has DCC it should be re-initialized to the
uncompressed state.

Note that the driver always selects the graphics path if the dest
image has DCC, so this has no effect for now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8326>

src/amd/vulkan/radv_meta_resolve_cs.c

index fa2d48a..d4278e9 100644 (file)
@@ -860,6 +860,23 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer,
        }
 
        radv_meta_restore(&saved_state, cmd_buffer);
+
+       if (radv_layout_dcc_compressed(cmd_buffer->device, dest_image,
+                                      dest_image_layout, false, queue_mask)) {
+
+               cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_CS_PARTIAL_FLUSH |
+                                               RADV_CMD_FLAG_INV_VCACHE;
+
+               VkImageSubresourceRange range = {
+                       .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+                       .baseMipLevel = region->dstSubresource.mipLevel,
+                       .levelCount = 1,
+                       .baseArrayLayer = dest_base_layer,
+                       .layerCount = region->dstSubresource.layerCount,
+               };
+
+               radv_initialize_dcc(cmd_buffer, dest_image, &range, 0xffffffff);
+       }
 }
 
 /**