radv: Fix dword alignment in SDMA buffer copy.

Also add a comment that explains the dword aligned mode.

Note that the SDMA shader uploads are always dword aligned
so this commit doesn't fix any issues but just prepares this
function for more general use.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22551>
This commit is contained in:
Timur Kristóf
2023-04-18 13:26:19 +02:00
committed by Marge Bot
parent cf181fef68
commit b32556b058

View File

@@ -159,8 +159,14 @@ radv_sdma_copy_buffer(struct radv_device *device, struct radeon_cmdbuf *cs, uint
assert(gfx_level >= GFX7);
/* Align copy size to dw if src/dst address are dw aligned */
if ((src_va & 0x3) == 0 && (src_va & 0x3) == 0 && size > 4 && (size & 3) != 0) {
/* SDMA FW automatically enables a faster dword copy mode when
* source, destination and size are all dword-aligned.
*
* When source and destination are dword-aligned, round down the size to
* take advantage of faster dword copy, and copy the remaining few bytes
* with the last copy packet.
*/
if ((src_va & 0x3) == 0 && (dst_va & 0x3) == 0 && size > 4 && (size & 0x3) != 0) {
align = ~0x3u;
ncopy++;
}