[Mesa-dev] [PATCH 02/26] ac: add radeon_info::marketing_name, replacing the winsys callback

Marek Olšák maraeo at gmail.com
Wed Feb 13 05:15:57 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

---
 src/amd/common/ac_gpu_info.c                  |  2 ++
 src/amd/common/ac_gpu_info.h                  |  1 +
 src/gallium/drivers/r600/r600_pipe_common.c   | 13 +------------
 src/gallium/drivers/radeon/radeon_winsys.h    |  2 --
 src/gallium/drivers/radeonsi/si_get.c         | 15 +++------------
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c |  7 -------
 6 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index fc8c6a09d2f..4e3190015e7 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -333,6 +333,8 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
 		return false;
 	}
 
+	info->marketing_name = amdgpu_get_marketing_name(dev);
+
 	/* Set which chips have dedicated VRAM. */
 	info->has_dedicated_vram =
 		!(amdinfo->ids_flags & AMDGPU_IDS_FLAGS_FUSION);
diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h
index b1ef9c53734..8971d51dfd7 100644
--- a/src/amd/common/ac_gpu_info.h
+++ b/src/amd/common/ac_gpu_info.h
@@ -48,6 +48,7 @@ struct radeon_info {
 
 	/* Device info. */
 	const char                  *name;
+	const char                  *marketing_name;
 	uint32_t                    pci_id;
 	enum radeon_family          family;
 	enum chip_class             chip_class;
diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c
index 19ba09ae82a..abfa250435d 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.c
+++ b/src/gallium/drivers/r600/r600_pipe_common.c
@@ -809,13 +809,6 @@ static const char* r600_get_device_vendor(struct pipe_screen* pscreen)
 	return "AMD";
 }
 
-static const char *r600_get_marketing_name(struct radeon_winsys *ws)
-{
-	if (!ws->get_chip_name)
-		return NULL;
-	return ws->get_chip_name(ws);
-}
-
 static const char *r600_get_family_name(const struct r600_common_screen *rscreen)
 {
 	switch (rscreen->info.family) {
@@ -1278,11 +1271,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
 	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) + 4);
-	else
-		chip_name = r600_get_family_name(rscreen);
+	chip_name = r600_get_family_name(rscreen);
 
 	if (uname(&uname_data) == 0)
 		snprintf(kernel_version, sizeof(kernel_version),
diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h
index 82feef39487..822d2e88ee2 100644
--- a/src/gallium/drivers/radeon/radeon_winsys.h
+++ b/src/gallium/drivers/radeon/radeon_winsys.h
@@ -677,8 +677,6 @@ 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_cmdbuf *cs, unsigned num_dw)
diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c
index f8ca02d4fcf..416eab1a3eb 100644
--- a/src/gallium/drivers/radeonsi/si_get.c
+++ b/src/gallium/drivers/radeonsi/si_get.c
@@ -48,13 +48,6 @@ static const char *si_get_device_vendor(struct pipe_screen *pscreen)
 	return "AMD";
 }
 
-static const char *si_get_marketing_name(struct radeon_winsys *ws)
-{
-	if (!ws->get_chip_name)
-		return NULL;
-	return ws->get_chip_name(ws);
-}
-
 static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 {
 	struct si_screen *sscreen = (struct si_screen *)pscreen;
@@ -941,14 +934,12 @@ static struct disk_cache *si_get_disk_shader_cache(struct pipe_screen *pscreen)
 
 static void si_init_renderer_string(struct si_screen *sscreen)
 {
-	struct radeon_winsys *ws = sscreen->ws;
 	char first_name[256], second_name[32] = {}, kernel_version[128] = {};
 	struct utsname uname_data;
 
-	const char *marketing_name = si_get_marketing_name(ws);
-
-	if (marketing_name) {
-		snprintf(first_name, sizeof(first_name), "%s", marketing_name);
+	if (sscreen->info.marketing_name) {
+		snprintf(first_name, sizeof(first_name), "%s",
+			 sscreen->info.marketing_name);
 		snprintf(second_name, sizeof(second_name), "%s, ",
 			 sscreen->info.name);
 	} else {
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index 79d2c1345ef..88f9d3180b1 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -269,12 +269,6 @@ static bool amdgpu_winsys_unref(struct radeon_winsys *rws)
    return destroy;
 }
 
-static 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);
-}
-
 static void amdgpu_pin_threads_to_L3_cache(struct radeon_winsys *rws,
                                            unsigned cache)
 {
@@ -384,7 +378,6 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
    ws->base.cs_request_feature = amdgpu_cs_request_feature;
    ws->base.query_value = amdgpu_query_value;
    ws->base.read_registers = amdgpu_read_registers;
-   ws->base.get_chip_name = amdgpu_get_chip_name;
    ws->base.pin_threads_to_L3_cache = amdgpu_pin_threads_to_L3_cache;
 
    amdgpu_bo_init_functions(ws);
-- 
2.17.1



More information about the mesa-dev mailing list