From 1307ed430a13dfb92d6ecd843dca02cb1739b6a6 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 13 Jun 2017 01:39:02 +0200 Subject: [PATCH] gallium/radeon: Include the family name in the renderer string if it's not equal to the marketing name. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The "family" name is often more informative than the "marketing" name. More importantly, applications, like for example Wine, may recognise GPUs based on the existing "family" names. Reviewed-by: Marek Olšák Signed-off-by: Henri Verbeet --- src/gallium/drivers/radeon/r600_pipe_common.c | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 48d136a032f..1cec6d5ea68 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -788,17 +788,15 @@ static const char* r600_get_device_vendor(struct pipe_screen* pscreen) return "AMD"; } -static const char* r600_get_chip_name(struct r600_common_screen *rscreen) +static const char *r600_get_marketing_name(struct radeon_winsys *ws) { - const char *mname; - - if (rscreen->ws->get_chip_name) { - mname = rscreen->ws->get_chip_name(rscreen->ws); - if (mname != NULL) - return mname; - } + if (!ws->get_chip_name) + return NULL; + return ws->get_chip_name(ws); +} - /* fall back to family names*/ +static const char *r600_get_family_name(const struct r600_common_screen *rscreen) +{ switch (rscreen->info.family) { case CHIP_R600: return "AMD R600"; case CHIP_RV610: return "AMD RV610"; @@ -876,7 +874,7 @@ static void r600_disk_cache_create(struct r600_common_screen *rscreen) #endif if (res != -1) { rscreen->disk_shader_cache = - disk_cache_create(r600_get_chip_name(rscreen), + disk_cache_create(r600_get_family_name(rscreen), timestamp_str, rscreen->debug_flags); free(timestamp_str); @@ -1326,12 +1324,18 @@ struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen, bool r600_common_screen_init(struct r600_common_screen *rscreen, struct radeon_winsys *ws) { - char llvm_string[32] = {}, kernel_version[128] = {}; + char family_name[32] = {}, llvm_string[32] = {}, kernel_version[128] = {}; struct utsname uname_data; + const char *chip_name; ws->query_info(ws, &rscreen->info); rscreen->ws = ws; + if ((chip_name = r600_get_marketing_name(ws))) + snprintf(family_name, sizeof(family_name), "%s / ", r600_get_family_name(rscreen)); + else + chip_name = r600_get_family_name(rscreen); + if (uname(&uname_data) == 0) snprintf(kernel_version, sizeof(kernel_version), " / %s", uname_data.release); @@ -1343,8 +1347,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, } snprintf(rscreen->renderer_string, sizeof(rscreen->renderer_string), - "%s (DRM %i.%i.%i%s%s)", - r600_get_chip_name(rscreen), rscreen->info.drm_major, + "%s (%sDRM %i.%i.%i%s%s)", + chip_name, family_name, rscreen->info.drm_major, rscreen->info.drm_minor, rscreen->info.drm_patchlevel, kernel_version, llvm_string); @@ -1396,7 +1400,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, if (rscreen->debug_flags & DBG_INFO) { printf("pci_id = 0x%x\n", rscreen->info.pci_id); printf("family = %i (%s)\n", rscreen->info.family, - r600_get_chip_name(rscreen)); + r600_get_family_name(rscreen)); printf("chip_class = %i\n", rscreen->info.chip_class); printf("gart_size = %i MB\n", (int)DIV_ROUND_UP(rscreen->info.gart_size, 1024*1024)); printf("vram_size = %i MB\n", (int)DIV_ROUND_UP(rscreen->info.vram_size, 1024*1024)); -- 2.30.2