[Mesa-dev] [PATCH 09/19] radv: remove radv_layout_is_htile_compressed()

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Sun Oct 1 21:49:52 UTC 2017


I'd like to keep this because they specify different concepts:

has_htile is whether the htile metadata is valid in combination with
the image data, i.e. we can enable htile reads if we want, and don't
have to .
is_htile_compressed is whether we cannot read the data without the
htile metadata.

I'd like to extend has_htile to more layouts, but have run into a bug
with mad max, hence why they are currently the same. But given  that
they represent different concepts, I'd like to keep  both.

On Fri, Sep 29, 2017 at 5:48 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Similar to radv_layout_has_htile(). Also remove an assertion
> which was always false.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_cmd_buffer.c | 12 +++++-------
>  src/amd/vulkan/radv_image.c      | 10 ----------
>  src/amd/vulkan/radv_meta_clear.c |  4 ++--
>  src/amd/vulkan/radv_private.h    | 12 +++---------
>  4 files changed, 10 insertions(+), 28 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
> index 4db9d7628c..f13979cc9e 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -1388,9 +1388,7 @@ radv_emit_framebuffer_state(struct radv_cmd_buffer *cmd_buffer)
>                 MAYBE_UNUSED uint32_t queue_mask = radv_image_queue_family_mask(image,
>                                                                                 cmd_buffer->queue_family_index,
>                                                                                 cmd_buffer->queue_family_index);
> -               /* We currently don't support writing decompressed HTILE */
> -               assert(radv_layout_has_htile(image, layout, queue_mask) ==
> -                      radv_layout_is_htile_compressed(image, layout, queue_mask));
> +               /* XXX: We currently don't support writing decompressed HTILE */
>
>                 radv_emit_fb_ds_state(cmd_buffer, &att->ds, image, layout);
>
> @@ -3404,11 +3402,11 @@ static void radv_handle_depth_image_transition(struct radv_cmd_buffer *cmd_buffe
>                    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);
> -       } else if (!radv_layout_is_htile_compressed(image, src_layout, src_queue_mask) &&
> -                  radv_layout_is_htile_compressed(image, dst_layout, dst_queue_mask)) {
> +       } else if (!radv_layout_has_htile(image, src_layout, src_queue_mask) &&
> +                  radv_layout_has_htile(image, dst_layout, dst_queue_mask)) {
>                 radv_initialize_htile(cmd_buffer, image, range, 0xffffffff);
> -       } else if (radv_layout_is_htile_compressed(image, src_layout, src_queue_mask) &&
> -                  !radv_layout_is_htile_compressed(image, dst_layout, dst_queue_mask)) {
> +       } else if (radv_layout_has_htile(image, src_layout, src_queue_mask) &&
> +                  !radv_layout_has_htile(image, dst_layout, dst_queue_mask)) {
>                 VkImageSubresourceRange local_range = *range;
>                 local_range.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
>                 local_range.baseMipLevel = 0;
> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
> index 9fa4d8d2f7..f104ba2cb6 100644
> --- a/src/amd/vulkan/radv_image.c
> +++ b/src/amd/vulkan/radv_image.c
> @@ -1047,16 +1047,6 @@ bool radv_layout_has_htile(const struct radv_image *image,
>                queue_mask == (1u << RADV_QUEUE_GENERAL);
>  }
>
> -bool radv_layout_is_htile_compressed(const struct radv_image *image,
> -                                     VkImageLayout layout,
> -                                     unsigned queue_mask)
> -{
> -       return image->surface.htile_size &&
> -              (layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
> -               layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) &&
> -              queue_mask == (1u << RADV_QUEUE_GENERAL);
> -}
> -
>  bool radv_layout_can_fast_clear(const struct radv_image *image,
>                                 VkImageLayout layout,
>                                 unsigned queue_mask)
> diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c
> index 5242078a86..a354ceecba 100644
> --- a/src/amd/vulkan/radv_meta_clear.c
> +++ b/src/amd/vulkan/radv_meta_clear.c
> @@ -556,7 +556,7 @@ static bool depth_view_can_fast_clear(struct radv_cmd_buffer *cmd_buffer,
>         if (iview->image->surface.htile_size &&
>             iview->base_mip == 0 &&
>             iview->base_layer == 0 &&
> -           radv_layout_is_htile_compressed(iview->image, layout, queue_mask) &&
> +           radv_layout_has_htile(iview->image, layout, queue_mask) &&
>             !radv_image_extent_compare(iview->image, &iview->extent))
>                 return true;
>         return false;
> @@ -681,7 +681,7 @@ emit_fast_htile_clear(struct radv_cmd_buffer *cmd_buffer,
>         if (cmd_buffer->device->debug_flags & RADV_DEBUG_NO_FAST_CLEARS)
>                 return false;
>
> -       if (!radv_layout_is_htile_compressed(iview->image, image_layout, radv_image_queue_family_mask(iview->image, cmd_buffer->queue_family_index, cmd_buffer->queue_family_index)))
> +       if (!radv_layout_has_htile(iview->image, image_layout, radv_image_queue_family_mask(iview->image, cmd_buffer->queue_family_index, cmd_buffer->queue_family_index)))
>                 goto fail;
>
>         /* don't fast clear 3D */
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index f292709805..0f94af9852 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -1229,21 +1229,15 @@ struct radv_image {
>         uint32_t dcc_pred_offset;
>  };
>
> -/* Whether the image has a htile that is known consistent with the contents of
> - * the image. */
> -bool radv_layout_has_htile(const struct radv_image *image,
> -                           VkImageLayout layout,
> -                           unsigned queue_mask);
> -
>  /* Whether the image has a htile  that is known consistent with the contents of
>   * the image and is allowed to be in compressed form.
>   *
>   * If this is false reads that don't use the htile should be able to return
>   * correct results.
>   */
> -bool radv_layout_is_htile_compressed(const struct radv_image *image,
> -                                     VkImageLayout layout,
> -                                     unsigned queue_mask);
> +bool radv_layout_has_htile(const struct radv_image *image,
> +                           VkImageLayout layout,
> +                           unsigned queue_mask);
>
>  bool radv_layout_can_fast_clear(const struct radv_image *image,
>                                 VkImageLayout layout,
> --
> 2.14.2
>
> _______________________________________________
> 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