radv: fix trace dumping for !use_ib_bos
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 11 Jun 2017 13:46:17 +0000 (16:46 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 11 Jun 2017 20:07:09 +0000 (23:07 +0300)
Fixes trace dumping crash for SI or when RADV_DEBUG=noibs is set.

Fixes: 97dfff5410 "radv: Dump command buffer on hang."
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 7b749700d1cc3c0c3f20a7b5bfb056286d217b8a..ffc756617c0a3b543af7b5c9f38f83dd6f6b7995 100644 (file)
@@ -952,6 +952,9 @@ static void *radv_amdgpu_winsys_get_cpu_addr(void *_cs, uint64_t addr)
 {
        struct radv_amdgpu_cs *cs = (struct radv_amdgpu_cs *)_cs;
        void *ret = NULL;
+
+       if (!cs->ib_buffer)
+               return NULL;
        for (unsigned i = 0; i <= cs->num_old_ib_buffers; ++i) {
                struct radv_amdgpu_winsys_bo *bo;
 
@@ -970,10 +973,15 @@ static void radv_amdgpu_winsys_cs_dump(struct radeon_winsys_cs *_cs,
                                        uint32_t trace_id)
 {
        struct radv_amdgpu_cs *cs = (struct radv_amdgpu_cs *)_cs;
+       void *ib = cs->base.buf;
+       int num_dw = cs->base.cdw;
 
-       ac_parse_ib(file,
-                   radv_amdgpu_winsys_get_cpu_addr(cs, cs->ib.ib_mc_address),
-                   cs->ib.size, trace_id,  "main IB", cs->ws->info.chip_class,
+       if (cs->ws->use_ib_bos) {
+               ib = radv_amdgpu_winsys_get_cpu_addr(cs, cs->ib.ib_mc_address);
+               num_dw = cs->ib.size;
+       }
+       assert(ib);
+       ac_parse_ib(file, ib, num_dw, trace_id, "main IB", cs->ws->info.chip_class,
                    radv_amdgpu_winsys_get_cpu_addr, cs);
 }