Module: Mesa
Branch: staging/22.2
Commit: 2e3afb67657869946cf1cd59330d2de9aca5a744
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e3afb67657869946cf1cd59330d2de9aca5a744

Author: Qiang Yu <[email protected]>
Date:   Tue Aug 23 16:14:56 2022 +0800

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: 667da4eaed3 ("winsys/amdgpu: sparse buffer creation / destruction / 
commitment")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7104
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18206>
(cherry picked from commit 4fc9125ca28bf0b721a18fe8608c693d794d5cab)

---

 .pick_status.json                         | 2 +-
 src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8ccb489c4ac..7a925ac80e0 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -11011,7 +11011,7 @@
         "description": "winsys/amdgpu: fix non-page-aligned sparse buffer 
creation",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "667da4eaed37de143681711344aba19373bee1d0"
     },
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c 
b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index b8825ac53bc..76b34149292 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -1145,7 +1145,7 @@ amdgpu_bo_sparse_create(struct amdgpu_winsys *ws, 
uint64_t size,
    if (r)
       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);
    if (r)
       goto error_va_map;

Reply via email to