From c705caaff9e6cc874e90651d6f8e459741978b06 Mon Sep 17 00:00:00 2001 From: Samuel Li Date: Tue, 6 Jun 2017 18:21:08 -0400 Subject: radeonsi: Use libdrm to get chipset name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: Add a func pointer to radeon_winsys to support radeon later. Change-Id: I614ea71424f9e5c97e4ae68654315d28c89eaa5f Signed-off-by: Samuel Li Signed-off-by: Marek Olšák --- src/gallium/drivers/radeon/r600_pipe_common.c | 11 ++++++++++- src/gallium/drivers/radeon/radeon_winsys.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/radeon') diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 2c0cadb0309..48d136a032f 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -790,6 +790,15 @@ static const char* r600_get_device_vendor(struct pipe_screen* pscreen) static const char* r600_get_chip_name(struct r600_common_screen *rscreen) { + const char *mname; + + if (rscreen->ws->get_chip_name) { + mname = rscreen->ws->get_chip_name(rscreen->ws); + if (mname != NULL) + return mname; + } + + /* fall back to family names*/ switch (rscreen->info.family) { case CHIP_R600: return "AMD R600"; case CHIP_RV610: return "AMD RV610"; @@ -1321,6 +1330,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, struct utsname uname_data; ws->query_info(ws, &rscreen->info); + rscreen->ws = ws; if (uname(&uname_data) == 0) snprintf(kernel_version, sizeof(kernel_version), @@ -1362,7 +1372,6 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, r600_init_screen_texture_functions(rscreen); r600_init_screen_query_functions(rscreen); - rscreen->ws = ws; rscreen->family = rscreen->info.family; rscreen->chip_class = rscreen->info.chip_class; rscreen->debug_flags = debug_get_flags_option("R600_DEBUG", common_debug_options, 0); diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 524bb467e1b..e19fde6e431 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -637,6 +637,8 @@ struct radeon_winsys { bool (*read_registers)(struct radeon_winsys *ws, unsigned reg_offset, unsigned num_registers, uint32_t *out); + + const char* (*get_chip_name)(struct radeon_winsys *ws); }; static inline bool radeon_emitted(struct radeon_winsys_cs *cs, unsigned num_dw) -- cgit v1.2.3