[Mesa-dev] [PATCH 1/1] radeonsi: Use libdrm to get chipset name

Li, Samuel Samuel.Li at amd.com
Tue May 2 21:51:19 UTC 2017


>From f097509a17a6ddf6a0f40fb1b73f289227a9539a Mon Sep 17 00:00:00 2001
From: Samuel Li <Samuel.Li at amd.com>
Date: Thu, 27 Apr 2017 13:45:24 -0400
Subject: [PATCH 1/1] radeonsi: Use libdrm to get chipset name

Change-Id: I614ea71424f9e5c97e4ae68654315d28c89eaa5f
Signed-off-by: Samuel Li <Samuel.Li at amd.com>
---
src/gallium/drivers/radeon/r600_pipe_common.c | 10 +++++++++-
src/gallium/winsys/amdgpu/drm/amdgpu_public.h |  1 +
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c |  7 +++++++
3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index ce84139..b4f9beb 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -36,6 +36,7 @@
#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
#include "radeon/radeon_video.h"
+#include "gallium/winsys/amdgpu/drm/amdgpu_public.h"
#include <inttypes.h>
#include <sys/utsname.h>
@@ -788,6 +789,13 @@ 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 = amdgpu_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";
@@ -1314,6 +1322,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),
@@ -1355,7 +1364,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/winsys/amdgpu/drm/amdgpu_public.h b/src/gallium/winsys/amdgpu/drm/amdgpu_public.h
index ad133b2..8a50c4d 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_public.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_public.h
@@ -34,6 +34,7 @@ struct pipe_screen;
 typedef struct pipe_screen *(*radeon_screen_create_t)(struct radeon_winsys *);
+const char* amdgpu_get_chip_name(struct radeon_winsys *ws);
struct radeon_winsys *
amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create);
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index f3a0c95..0c8c329 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -532,6 +532,13 @@ static bool amdgpu_winsys_unref(struct radeon_winsys *rws)
    return destroy;
}
+const char* amdgpu_get_chip_name(struct radeon_winsys *ws)
+{
+             amdgpu_device_handle dev = ((struct amdgpu_winsys *)ws)->dev;
+             return amdgpu_get_marketing_name(dev);
+}
+
+
PUBLIC struct radeon_winsys *
amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
{
--
2.7.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170502/a9d8ecf3/attachment.html>


More information about the mesa-dev mailing list