[Mesa-dev] [PATCH 1/2] radv: reduce CB/DB meta flushes in radv_dst_access_flush()

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Fri Jul 27 11:07:06 UTC 2018


Reviewed-by: Bas Nieuwenhuizeh <bas at basnieuwenhuizen.nl>

for the series.

On Fri, Jul 27, 2018 at 11:55 AM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_cmd_buffer.c | 31 +++++++++++++++++++++++--------
>  1 file changed, 23 insertions(+), 8 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
> index f9f57a1065..2e65be4f30 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -2019,8 +2019,23 @@ radv_dst_access_flush(struct radv_cmd_buffer *cmd_buffer,
>                        VkAccessFlags dst_flags,
>                        struct radv_image *image)
>  {
> +       bool flush_CB_meta = true, flush_DB_meta = true;
>         enum radv_cmd_flush_bits flush_bits = 0;
> +       bool flush_CB = true, flush_DB = true;
>         uint32_t b;
> +
> +       if (image) {
> +               if (!(image->usage & VK_IMAGE_USAGE_STORAGE_BIT)) {
> +                       flush_CB = false;
> +                       flush_DB = false;
> +               }
> +
> +               if (!radv_image_has_CB_metadata(image))
> +                       flush_CB_meta = false;
> +               if (!radv_image_has_htile(image))
> +                       flush_DB_meta = false;
> +       }
> +
>         for_each_bit(b, dst_flags) {
>                 switch ((VkAccessFlagBits)(1 << b)) {
>                 case VK_ACCESS_INDIRECT_COMMAND_READ_BIT:
> @@ -2037,16 +2052,16 @@ radv_dst_access_flush(struct radv_cmd_buffer *cmd_buffer,
>                                       RADV_CMD_FLAG_INV_GLOBAL_L2;
>                         break;
>                 case VK_ACCESS_COLOR_ATTACHMENT_READ_BIT:
> -                       /* TODO: change to image && when the image gets passed
> -                        * through from the subpass. */
> -                       if (!image || (image->usage & VK_IMAGE_USAGE_STORAGE_BIT))
> -                               flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_CB |
> -                                             RADV_CMD_FLAG_FLUSH_AND_INV_CB_META;
> +                       if (flush_CB)
> +                               flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_CB;
> +                       if (flush_CB_meta)
> +                               flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_CB_META;
>                         break;
>                 case VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT:
> -                       if (!image || (image->usage & VK_IMAGE_USAGE_STORAGE_BIT))
> -                               flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB |
> -                                             RADV_CMD_FLAG_FLUSH_AND_INV_DB_META;
> +                       if (flush_DB)
> +                               flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB;
> +                       if (flush_DB_meta)
> +                               flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_DB_META;
>                         break;
>                 default:
>                         break;
> --
> 2.18.0
>
> _______________________________________________
> 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