[Mesa-dev] [PATCH 3/6] radv: add radv_dcc_clear_level() helper
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Tue Jun 18 23:37:27 UTC 2019
On Tue, Jun 18, 2019 at 4:12 PM Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
> For clearing only one level.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/amd/vulkan/radv_meta.h | 3 +++
> src/amd/vulkan/radv_meta_clear.c | 23 ++++++++++++++++++++---
> 2 files changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h
> index d58b08514fe..238de5b5e29 100644
> --- a/src/amd/vulkan/radv_meta.h
> +++ b/src/amd/vulkan/radv_meta.h
> @@ -218,6 +218,9 @@ uint32_t radv_clear_fmask(struct radv_cmd_buffer *cmd_buffer,
> uint32_t radv_clear_dcc(struct radv_cmd_buffer *cmd_buffer,
> struct radv_image *image,
> const VkImageSubresourceRange *range, uint32_t value);
> +uint32_t radv_dcc_clear_level(struct radv_cmd_buffer *cmd_buffer,
> + const struct radv_image *image,
> + uint32_t level, uint32_t value);
> uint32_t radv_clear_htile(struct radv_cmd_buffer *cmd_buffer,
> struct radv_image *image,
> const VkImageSubresourceRange *range, uint32_t value);
> diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c
> index c43ed6eeef1..49f572c6889 100644
> --- a/src/amd/vulkan/radv_meta_clear.c
> +++ b/src/amd/vulkan/radv_meta_clear.c
> @@ -1333,6 +1333,25 @@ radv_clear_fmask(struct radv_cmd_buffer *cmd_buffer,
> image->fmask.size, value);
> }
>
> +uint32_t
> +radv_dcc_clear_level(struct radv_cmd_buffer *cmd_buffer,
> + const struct radv_image *image,
> + uint32_t level, uint32_t value)
> +{
> + const struct legacy_surf_level *surf_level =
> + &image->planes[0].surface.u.legacy.level[level];
I am not comfortable using the legacy stuff without a <= GFX8 predicate.
> + uint64_t offset;
> + uint32_t size;
> +
> + /* If this is 0, fast clear isn't possible. */
> + assert(surf_level->dcc_fast_clear_size);
> +
> + offset = image->offset + image->dcc_offset + surf_level->dcc_offset;
> + size = surf_level->dcc_fast_clear_size;
> +
> + return radv_fill_buffer(cmd_buffer, image->bo, offset, size, value);
> +}
> +
> uint32_t
> radv_clear_dcc(struct radv_cmd_buffer *cmd_buffer,
> struct radv_image *image,
> @@ -1341,9 +1360,7 @@ radv_clear_dcc(struct radv_cmd_buffer *cmd_buffer,
> /* Mark the image as being compressed. */
> radv_update_dcc_metadata(cmd_buffer, image, range, true);
>
> - return radv_fill_buffer(cmd_buffer, image->bo,
> - image->offset + image->dcc_offset,
> - image->planes[0].surface.dcc_size, value);
> + return radv_dcc_clear_level(cmd_buffer, image, 0, value);
> }
>
> uint32_t
> --
> 2.22.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