[Mesa-dev] [PATCH 14/14] anv: Add support for MSAA fast-clears
Nanley Chery
nanleychery at gmail.com
Thu Nov 23 01:25:05 UTC 2017
On Mon, Nov 13, 2017 at 08:12:54AM -0800, Jason Ekstrand wrote:
> This speeds up the Sascha Willems multisampling demo by around 25% when
> using 8x MSAA.
> ---
> src/intel/vulkan/anv_blorp.c | 6 ++++++
> src/intel/vulkan/genX_cmd_buffer.c | 22 ++++++++++++----------
> 2 files changed, 18 insertions(+), 10 deletions(-)
>
For better performance, I think this patch should include a hunk in
cmd_buffer_subpass_sync_fast_clear_values() to mark the needs_resolve
dword to false if the fast clear color is 0. We currently do this for
CCS_E.
-Nanley
> diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
> index 266cb9a..1e15797 100644
> --- a/src/intel/vulkan/anv_blorp.c
> +++ b/src/intel/vulkan/anv_blorp.c
> @@ -1549,6 +1549,12 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer)
> get_blorp_surf_for_anv_image(src_iview->image,
> VK_IMAGE_ASPECT_COLOR_BIT,
> src_aux_usage, &src_surf);
> + if (src_aux_usage == ISL_AUX_USAGE_MCS) {
> + src_surf.clear_color_addr = anv_to_blorp_address(
> + anv_image_get_clear_color_addr(cmd_buffer->device,
> + src_iview->image,
> + VK_IMAGE_ASPECT_COLOR_BIT, 0));
> + }
> get_blorp_surf_for_anv_image(dst_iview->image,
> VK_IMAGE_ASPECT_COLOR_BIT,
> dst_aux_usage, &dst_surf);
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
> index 2491b1d..1c1c644 100644
> --- a/src/intel/vulkan/genX_cmd_buffer.c
> +++ b/src/intel/vulkan/genX_cmd_buffer.c
> @@ -244,8 +244,6 @@ color_attachment_compute_aux_usage(struct anv_device * device,
> } else if (iview->image->planes[0].aux_usage == ISL_AUX_USAGE_MCS) {
> att_state->aux_usage = ISL_AUX_USAGE_MCS;
> att_state->input_aux_usage = ISL_AUX_USAGE_MCS;
> - att_state->fast_clear = false;
> - return;
> } else if (iview->image->planes[0].aux_usage == ISL_AUX_USAGE_CCS_E) {
> att_state->aux_usage = ISL_AUX_USAGE_CCS_E;
> att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E;
> @@ -281,7 +279,8 @@ color_attachment_compute_aux_usage(struct anv_device * device,
> }
> }
>
> - assert(iview->image->planes[0].aux_surface.isl.usage & ISL_SURF_USAGE_CCS_BIT);
> + assert(iview->image->planes[0].aux_surface.isl.usage &
> + (ISL_SURF_USAGE_CCS_BIT | ISL_SURF_USAGE_MCS_BIT));
>
> att_state->clear_color_is_zero_one =
> color_is_zero_one(att_state->clear_value.color, iview->planes[0].isl.format);
> @@ -726,9 +725,6 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
> * if the initial layout is COLOR_ATTACHMENT_OPTIMAL.
> */
> return;
> - } else if (image->samples > 1) {
> - /* MCS buffers don't need resolving. */
> - return;
> }
>
> /* Perform a resolve to synchronize data between the main and aux buffer.
> @@ -760,10 +756,16 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
>
> genX(load_needs_resolve_predicate)(cmd_buffer, image, aspect, level);
>
> - anv_ccs_resolve(cmd_buffer, image, aspect, level, base_layer, layer_count,
> - image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E ?
> - BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL :
> - BLORP_FAST_CLEAR_OP_RESOLVE_FULL);
> + if (image->samples > 1) {
> + anv_mcs_partial_resolve(cmd_buffer, image, aspect,
> + base_layer, layer_count);
> + } else {
> + anv_ccs_resolve(cmd_buffer, image, aspect,
> + level, base_layer, layer_count,
> + image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E ?
> + BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL :
> + BLORP_FAST_CLEAR_OP_RESOLVE_FULL);
> + }
>
> genX(set_image_needs_resolve)(cmd_buffer, image, aspect, level, false);
> }
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list