diff options
author | Bas Nieuwenhuizen <[email protected]> | 2016-12-23 23:51:18 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-01-09 21:44:03 +0100 |
commit | 97dfff54105ac10b6e2daace020687eefdcc28c0 (patch) | |
tree | 52520f9bcb806f000d4ea52b9d1548200ed14183 /src/amd/vulkan/winsys | |
parent | 0ef1b4d5b1a3af4ce7ae42ef4259d5db320724c5 (diff) |
radv: Dump command buffer on hang.
v2:
- Now use the filename specified by RADV_TRACE_FILE env var.
- Use the same var to enable tracing.
I thought we could as well always set the filename explicitly
instead of having some arbitrary defaults, and at that point
we don't need a separate feature enable.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/winsys')
-rw-r--r-- | src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c index b24aa997495..99b16192bcd 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c @@ -27,6 +27,7 @@ #include <amdgpu_drm.h> #include <assert.h> +#include "ac_debug.h" #include "amdgpu_id.h" #include "radv_radeon_winsys.h" #include "radv_amdgpu_cs.h" @@ -775,6 +776,34 @@ static int radv_amdgpu_winsys_cs_submit(struct radeon_winsys_ctx *_ctx, return ret; } + +static void *radv_amdgpu_winsys_get_cpu_addr(struct radv_amdgpu_cs *cs, uint64_t addr) +{ + void *ret = NULL; + for (unsigned i = 0; i <= cs->num_old_ib_buffers; ++i) { + struct radv_amdgpu_winsys_bo *bo; + + bo = (struct radv_amdgpu_winsys_bo*) + (i == cs->num_old_ib_buffers ? cs->ib_buffer : cs->old_ib_buffers[i]); + if (addr >= bo->va && addr - bo->va < bo->size) { + if (amdgpu_bo_cpu_map(bo->bo, &ret) == 0) + return (char *)ret + (addr - bo->va); + } + } + return ret; +} + +static void radv_amdgpu_winsys_cs_dump(struct radeon_winsys_cs *_cs, + FILE* file, + uint32_t trace_id) +{ + struct radv_amdgpu_cs *cs = (struct radv_amdgpu_cs *)_cs; + + 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); +} + static struct radeon_winsys_ctx *radv_amdgpu_ctx_create(struct radeon_winsys *_ws) { struct radv_amdgpu_winsys *ws = radv_amdgpu_winsys(_ws); @@ -850,6 +879,7 @@ void radv_amdgpu_cs_init_functions(struct radv_amdgpu_winsys *ws) ws->base.cs_add_buffer = radv_amdgpu_cs_add_buffer; ws->base.cs_execute_secondary = radv_amdgpu_cs_execute_secondary; ws->base.cs_submit = radv_amdgpu_winsys_cs_submit; + ws->base.cs_dump = radv_amdgpu_winsys_cs_dump; ws->base.create_fence = radv_amdgpu_create_fence; ws->base.destroy_fence = radv_amdgpu_destroy_fence; ws->base.create_sem = radv_amdgpu_create_sem; |