From: Samuel Pitoiset Date: Wed, 6 Sep 2017 07:38:19 +0000 (+0200) Subject: radv/winsys: add a read_registers() callback X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=140621f7c4f217e3b77847e29890dadf25a466c1;p=mesa.git radv/winsys: add a read_registers() callback To dump some status MMIO registers when a hang is detected. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h index a9c1f54c238..8e60c23f48f 100644 --- a/src/amd/vulkan/radv_radeon_winsys.h +++ b/src/amd/vulkan/radv_radeon_winsys.h @@ -156,6 +156,9 @@ struct radeon_winsys { void (*query_info)(struct radeon_winsys *ws, struct radeon_info *info); + bool (*read_registers)(struct radeon_winsys *ws, unsigned reg_offset, + unsigned num_registers, uint32_t *out); + struct radeon_winsys_bo *(*buffer_create)(struct radeon_winsys *ws, uint64_t size, unsigned alignment, diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c index 36606defb77..9e9b1bf061d 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c @@ -72,6 +72,16 @@ static void radv_amdgpu_winsys_query_info(struct radeon_winsys *rws, *info = ((struct radv_amdgpu_winsys *)rws)->info; } +static bool radv_amdgpu_winsys_read_registers(struct radeon_winsys *rws, + unsigned reg_offset, + unsigned num_registers, uint32_t *out) +{ + struct radv_amdgpu_winsys *ws = (struct radv_amdgpu_winsys*)rws; + + return amdgpu_read_mm_registers(ws->dev, reg_offset / 4, num_registers, + 0xffffffff, 0, out) == 0; +} + static void radv_amdgpu_winsys_destroy(struct radeon_winsys *rws) { struct radv_amdgpu_winsys *ws = (struct radv_amdgpu_winsys*)rws; @@ -111,6 +121,7 @@ radv_amdgpu_winsys_create(int fd, uint64_t debug_flags, uint64_t perftest_flags) LIST_INITHEAD(&ws->global_bo_list); pthread_mutex_init(&ws->global_bo_list_lock, NULL); ws->base.query_info = radv_amdgpu_winsys_query_info; + ws->base.read_registers = radv_amdgpu_winsys_read_registers; ws->base.destroy = radv_amdgpu_winsys_destroy; radv_amdgpu_bo_init_functions(ws); radv_amdgpu_cs_init_functions(ws);