radv/winsys: add a read_registers() callback
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 6 Sep 2017 07:38:19 +0000 (09:38 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Sep 2017 08:37:57 +0000 (10:37 +0200)
To dump some status MMIO registers when a hang is detected.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_radeon_winsys.h
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c

index a9c1f54c238b967358d17a8ca92ce0cd2e4b547b..8e60c23f48f47db7dddf45fd0a95bfa534c53ef6 100644 (file)
@@ -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,
index 36606defb7757fbdf051a3a40bdc0f3431a73a40..9e9b1bf061d04c26172e77816daa8dbdc08c0eaa 100644 (file)
@@ -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);