From: Eric Engestrom Date: Wed, 24 May 2023 19:39:16 +0000 (+0100) Subject: v3dv: fix align() computation for pixel formats with non-POT block sizes X-Git-Tag: upstream/23.3.3~8085 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3867e91da4a74c007641b0d7d0da43e4f985095e;p=platform%2Fupstream%2Fmesa.git v3dv: fix align() computation for pixel formats with non-POT block sizes Fixes hundreds of dEQP-VK.api.copy_and_blit.* tests when including the assert that the alignment in align() is valid, as added in !20153. Fixes: 3ba839bf734f37f50dfc ("v3dv: align compressed image regions to block size") Signed-off-by: Eric Engestrom Reviewed-by: Iago Toral Quiroga Part-of: --- diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index 34310b7..dd02e16 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -1207,14 +1207,21 @@ copy_image_blit(struct v3dv_cmd_buffer *cmd_buffer, * (since the region dimensions are already specified in terms of the source * image). */ + uint32_t region_width = region->extent.width * src_scale_w; + uint32_t region_height = region->extent.height * src_scale_h; + if (src_block_w > 1) + region_width = util_next_power_of_two(region_width); + if (src_block_h > 1) + region_height = util_next_power_of_two(region_height); + const VkOffset3D src_start = { region->srcOffset.x * src_scale_w, region->srcOffset.y * src_scale_h, region->srcOffset.z, }; const VkOffset3D src_end = { - src_start.x + align(region->extent.width, src_block_w) * src_scale_w, - src_start.y + align(region->extent.height, src_block_h) * src_scale_h, + src_start.x + region_width, + src_start.y + region_height, src_start.z + region->extent.depth, }; @@ -1224,8 +1231,8 @@ copy_image_blit(struct v3dv_cmd_buffer *cmd_buffer, region->dstOffset.z, }; const VkOffset3D dst_end = { - dst_start.x + align(region->extent.width, src_block_w) * src_scale_w, - dst_start.y + align(region->extent.height, src_block_h) * src_scale_h, + dst_start.x + region_width, + dst_start.y + region_height, dst_start.z + region->extent.depth, };