From 4d9942d89169deae348ec020f333286385c42532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 15 May 2023 12:01:52 -0400 Subject: [PATCH] radv: fix SDMA image address calculation for large images by using uint64_t Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/amd/vulkan/radv_sdma_copy_image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_sdma_copy_image.c b/src/amd/vulkan/radv_sdma_copy_image.c index c94538efbad..6e93a9f4cf2 100644 --- a/src/amd/vulkan/radv_sdma_copy_image.c +++ b/src/amd/vulkan/radv_sdma_copy_image.c @@ -43,7 +43,7 @@ radv_sdma_v4_v5_copy_image_to_buffer(struct radv_device *device, struct radeon_c /* Linear -> linear sub-window copy. */ if (image->planes[0].surface.is_linear) { ASSERTED unsigned cdw_max = radeon_check_space(device->ws, cs, 7); - unsigned bytes = src_pitch * copy_height * bpp; + uint64_t bytes = (uint64_t)src_pitch * copy_height * bpp; if (!(bytes < (1u << 22))) return false; @@ -68,7 +68,7 @@ radv_sdma_v4_v5_copy_image_to_buffer(struct radv_device *device, struct radeon_c unsigned tiled_width = copy_width; unsigned tiled_height = copy_height; unsigned linear_pitch = region->bufferRowLength; - unsigned linear_slice_pitch = region->bufferRowLength * copy_height; + uint64_t linear_slice_pitch = (uint64_t)region->bufferRowLength * copy_height; uint64_t tiled_address = src_address; uint64_t linear_address = dst_address; bool is_v5 = device->physical_device->rad_info.gfx_level >= GFX10;