asahi: Locate low VA BOs correctly
authorAsahi Lina <lina@asahilina.net>
Wed, 5 Apr 2023 14:48:42 +0000 (23:48 +0900)
committerMarge Bot <emma+marge@anholt.net>
Fri, 7 Apr 2023 03:23:04 +0000 (03:23 +0000)
These need the shader_base added to them.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>

src/asahi/lib/agx_device.c

index 5010361..959b03c 100644 (file)
@@ -385,10 +385,14 @@ agx_debug_fault(struct agx_device *dev, uint64_t addr)
 
    for (uint32_t handle = 0; handle < dev->max_handle; handle++) {
       struct agx_bo *bo = agx_lookup_bo(dev, handle);
-      if (!bo->dev || bo->ptr.gpu > addr)
+      uint64_t bo_addr = bo->ptr.gpu;
+      if (bo->flags & AGX_BO_LOW_VA)
+         bo_addr += dev->shader_base;
+
+      if (!bo->dev || bo_addr > addr)
          continue;
 
-      if (!best || bo->ptr.gpu > best->ptr.gpu)
+      if (!best || bo_addr > best->ptr.gpu)
          best = bo;
    }