[Mesa-dev] [PATCH 08/15] radv/winsys: add a read_registers() callback

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Sep 12 10:35:45 UTC 2017


To dump some status MMIO registers when a hang is detected.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_radeon_winsys.h               |  3 +++
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index a9c1f54c23..8e60c23f48 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 36606defb7..9e9b1bf061 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);
-- 
2.14.1



More information about the mesa-dev mailing list