From dc3d39771ff561fe3e71aa0d08623e190ff496f9 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 17 Apr 2018 16:05:17 +0200 Subject: radv: decompress DCC for multisampled source images before resolving Multisampled source images (ie. color attachments) can be now DCC compressed, so the driver needs to perform a DCC decompression pass before resolving Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_meta.h | 1 + src/amd/vulkan/radv_meta_resolve.c | 17 +++++++++++++++-- src/amd/vulkan/radv_meta_resolve_cs.c | 2 +- src/amd/vulkan/radv_meta_resolve_fs.c | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/amd/vulkan') diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h index 47eec5cd6a0..4a9abae30ac 100644 --- a/src/amd/vulkan/radv_meta.h +++ b/src/amd/vulkan/radv_meta.h @@ -195,6 +195,7 @@ void radv_decompress_resolve_subpass_src(struct radv_cmd_buffer *cmd_buffer); void radv_decompress_resolve_src(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image, + VkImageLayout src_image_layout, uint32_t region_count, const VkImageResolve *regions); diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index d66f1c9f933..f3e088b10c4 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -697,7 +697,8 @@ radv_decompress_resolve_subpass_src(struct radv_cmd_buffer *cmd_buffer) region.srcSubresource.mipLevel = 0; region.srcSubresource.layerCount = 1; - radv_decompress_resolve_src(cmd_buffer, src_image, 1, ®ion); + radv_decompress_resolve_src(cmd_buffer, src_image, + src_att.layout, 1, ®ion); } } @@ -707,6 +708,7 @@ radv_decompress_resolve_subpass_src(struct radv_cmd_buffer *cmd_buffer) void radv_decompress_resolve_src(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image, + VkImageLayout src_image_layout, uint32_t region_count, const VkImageResolve *regions) { @@ -722,6 +724,17 @@ radv_decompress_resolve_src(struct radv_cmd_buffer *cmd_buffer, range.baseArrayLayer = src_base_layer; range.layerCount = region->srcSubresource.layerCount; - radv_fast_clear_flush_image_inplace(cmd_buffer, src_image, &range); + uint32_t queue_mask = + radv_image_queue_family_mask(src_image, + cmd_buffer->queue_family_index, + cmd_buffer->queue_family_index); + + if (radv_layout_dcc_compressed(src_image, src_image_layout, + queue_mask)) { + radv_decompress_dcc(cmd_buffer, src_image, &range); + } else { + radv_fast_clear_flush_image_inplace(cmd_buffer, + src_image, &range); + } } } diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index ede55f6d005..274e64999a5 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -388,7 +388,7 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer, { struct radv_meta_saved_state saved_state; - radv_decompress_resolve_src(cmd_buffer, src_image, + radv_decompress_resolve_src(cmd_buffer, src_image, src_image_layout, region_count, regions); radv_meta_save(&saved_state, cmd_buffer, diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c index 499b3ae27af..ef8c1d8b1da 100644 --- a/src/amd/vulkan/radv_meta_resolve_fs.c +++ b/src/amd/vulkan/radv_meta_resolve_fs.c @@ -458,7 +458,7 @@ void radv_meta_resolve_fragment_image(struct radv_cmd_buffer *cmd_buffer, unsigned dst_layout = radv_meta_dst_layout_from_layout(dest_image_layout); VkRenderPass rp; - radv_decompress_resolve_src(cmd_buffer, src_image, + radv_decompress_resolve_src(cmd_buffer, src_image, src_image_layout, region_count, regions); rp = device->meta_state.resolve_fragment.rc[samples_log2].render_pass[fs_key][dst_layout]; -- cgit v1.2.3