Mesa (main): radv/amdgpu: do not add "global" BO to the virtual BO list

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 20 07:07:30 UTC 2022


Module: Mesa
Branch: main
Commit: 6dd2699e9f9cfb482349afc582470a4f9709c5f7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6dd2699e9f9cfb482349afc582470a4f9709c5f7

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Jun 16 17:20:14 2022 +0200

radv/amdgpu: do not add "global" BO to the virtual BO list

To avoid dangling BO references if it's destroyed without being
previously unbound. This is under Vulkan spec clarification but it
looks like the "global" BO fix is simple enough to workaround the
issue for now.

This fixes a CPU hang with Halo Infinite because the kernel rejects
a submission (invalid BO handle found).

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17085>

---

 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 1c3b466a910..b246e52d1ce 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -140,6 +140,21 @@ radv_amdgpu_winsys_bo_virtual_bind(struct radeon_winsys *_ws, struct radeon_wins
       return VK_ERROR_OUT_OF_DEVICE_MEMORY;
    }
 
+   /* Do not add the BO to the virtual BO list if it's already in the global list to avoid dangling
+    * BO references because it might have been destroyed without being previously unbound. Resetting
+    * it to NULL clears the old BO ranges if present.
+    *
+    * This is going to be clarified in the Vulkan spec:
+    * https://gitlab.khronos.org/vulkan/vulkan/-/issues/3125
+    *
+    * The issue still exists for non-global BO but it will be addressed later, once we are 100% it's
+    * RADV fault (mostly because the solution looks more complicated).
+    */
+   if (bo && bo->base.use_global_list) {
+      bo = NULL;
+      bo_offset = 0;
+   }
+
    /* We have at most 2 new ranges (1 by the bind, and another one by splitting a range that
     * contains the newly bound range). */
    if (parent->range_capacity - parent->range_count < 2) {



More information about the mesa-commit mailing list