winsys/amdgpu: fix non-page-aligned sparse buffer creation

ARB_sparse_buffer does not require sparse buffer size to be
page aligned. So we need to align it before VM ops as KMD
will check whether it's aligned and return EINVAL if not.

Fixes: 667da4eaed ("winsys/amdgpu: sparse buffer creation / destruction / commitment")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7104
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18206>
This commit is contained in:
Qiang Yu
2022-08-23 16:14:56 +08:00
committed by Marge Bot
parent e767f54f28
commit 4fc9125ca2

View File

@@ -1145,7 +1145,7 @@ amdgpu_bo_sparse_create(struct amdgpu_winsys *ws, uint64_t size,
if (r) if (r)
goto error_va_alloc; goto error_va_alloc;
r = amdgpu_bo_va_op_raw(ws->dev, NULL, 0, size, bo->va, r = amdgpu_bo_va_op_raw(ws->dev, NULL, 0, map_size, bo->va,
AMDGPU_VM_PAGE_PRT, AMDGPU_VA_OP_MAP); AMDGPU_VM_PAGE_PRT, AMDGPU_VA_OP_MAP);
if (r) if (r)
goto error_va_map; goto error_va_map;