From f313dc2a07458c7adadbed8c1fc557d6e4a25730 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 25 Apr 2022 06:44:25 -0400 Subject: [PATCH] radeonsi: improve the subsampled copy_image calculation This fixes a few cases for AMD_TEST=copyimage, but it's still pretty broken. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_compute_blit.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_compute_blit.c b/src/gallium/drivers/radeonsi/si_compute_blit.c index f9cf809..83dd961 100644 --- a/src/gallium/drivers/radeonsi/si_compute_blit.c +++ b/src/gallium/drivers/radeonsi/si_compute_blit.c @@ -557,7 +557,20 @@ void si_compute_copy_image(struct si_context *sctx, struct pipe_resource *dst, u } if (util_format_is_subsampled_422(src_format)) { + assert(src_format == dst_format); + + src_access |= SI_IMAGE_ACCESS_BLOCK_FORMAT_AS_UINT; + dst_access |= SI_IMAGE_ACCESS_BLOCK_FORMAT_AS_UINT; + + dstx = util_format_get_nblocksx(src_format, dstx); + + new_box = *src_box; + new_box.x = util_format_get_nblocksx(src_format, src_box->x); + new_box.width = util_format_get_nblocksx(src_format, src_box->width); + src_box = &new_box; + src_format = dst_format = PIPE_FORMAT_R32_UINT; + /* Interpreting 422 subsampled format (16 bpp) as 32 bpp * should force us to divide src_box->x, dstx and width by 2. * But given that ac_surface allocates this format as 32 bpp -- 2.7.4