[Mesa-dev] [PATCH 09/22] r600g, radeonsi: consolidate get_name and get_vendor queries

Marek Olšák maraeo at gmail.com
Wed Jan 22 12:13:01 PST 2014


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

---
 src/gallium/drivers/r600/r600_pipe.c          | 45 ------------------------
 src/gallium/drivers/radeon/r600_pipe_common.c | 50 +++++++++++++++++++++++++++
 src/gallium/drivers/radeonsi/si_pipe.c        | 29 ----------------
 3 files changed, 50 insertions(+), 74 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 9c0cb0d..30cf8c4 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -310,49 +310,6 @@ fail:
 /*
  * pipe_screen
  */
-static const char* r600_get_vendor(struct pipe_screen* pscreen)
-{
-	return "X.Org";
-}
-
-static const char *r600_get_family_name(enum radeon_family family)
-{
-	switch(family) {
-	case CHIP_R600: return "AMD R600";
-	case CHIP_RV610: return "AMD RV610";
-	case CHIP_RV630: return "AMD RV630";
-	case CHIP_RV670: return "AMD RV670";
-	case CHIP_RV620: return "AMD RV620";
-	case CHIP_RV635: return "AMD RV635";
-	case CHIP_RS780: return "AMD RS780";
-	case CHIP_RS880: return "AMD RS880";
-	case CHIP_RV770: return "AMD RV770";
-	case CHIP_RV730: return "AMD RV730";
-	case CHIP_RV710: return "AMD RV710";
-	case CHIP_RV740: return "AMD RV740";
-	case CHIP_CEDAR: return "AMD CEDAR";
-	case CHIP_REDWOOD: return "AMD REDWOOD";
-	case CHIP_JUNIPER: return "AMD JUNIPER";
-	case CHIP_CYPRESS: return "AMD CYPRESS";
-	case CHIP_HEMLOCK: return "AMD HEMLOCK";
-	case CHIP_PALM: return "AMD PALM";
-	case CHIP_SUMO: return "AMD SUMO";
-	case CHIP_SUMO2: return "AMD SUMO2";
-	case CHIP_BARTS: return "AMD BARTS";
-	case CHIP_TURKS: return "AMD TURKS";
-	case CHIP_CAICOS: return "AMD CAICOS";
-	case CHIP_CAYMAN: return "AMD CAYMAN";
-	case CHIP_ARUBA: return "AMD ARUBA";
-	default: return "AMD unknown";
-	}
-}
-
-static const char* r600_get_name(struct pipe_screen* pscreen)
-{
-	struct r600_screen *rscreen = (struct r600_screen *)pscreen;
-
-	return r600_get_family_name(rscreen->b.family);
-}
 
 static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 {
@@ -846,8 +803,6 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
 	/* Set functions first. */
 	rscreen->b.b.context_create = r600_create_context;
 	rscreen->b.b.destroy = r600_destroy_screen;
-	rscreen->b.b.get_name = r600_get_name;
-	rscreen->b.b.get_vendor = r600_get_vendor;
 	rscreen->b.b.get_param = r600_get_param;
 	rscreen->b.b.get_shader_param = r600_get_shader_param;
 	rscreen->b.b.get_paramf = r600_get_paramf;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 7462d43..cabc6ef 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -140,6 +140,54 @@ static const struct debug_named_value common_debug_options[] = {
 	DEBUG_NAMED_VALUE_END /* must be last */
 };
 
+static const char* r600_get_vendor(struct pipe_screen* pscreen)
+{
+	return "X.Org";
+}
+
+static const char* r600_get_name(struct pipe_screen* pscreen)
+{
+	struct r600_common_screen *rscreen = (struct r600_common_screen*)pscreen;
+
+	switch (rscreen->family) {
+	case CHIP_R600: return "AMD R600";
+	case CHIP_RV610: return "AMD RV610";
+	case CHIP_RV630: return "AMD RV630";
+	case CHIP_RV670: return "AMD RV670";
+	case CHIP_RV620: return "AMD RV620";
+	case CHIP_RV635: return "AMD RV635";
+	case CHIP_RS780: return "AMD RS780";
+	case CHIP_RS880: return "AMD RS880";
+	case CHIP_RV770: return "AMD RV770";
+	case CHIP_RV730: return "AMD RV730";
+	case CHIP_RV710: return "AMD RV710";
+	case CHIP_RV740: return "AMD RV740";
+	case CHIP_CEDAR: return "AMD CEDAR";
+	case CHIP_REDWOOD: return "AMD REDWOOD";
+	case CHIP_JUNIPER: return "AMD JUNIPER";
+	case CHIP_CYPRESS: return "AMD CYPRESS";
+	case CHIP_HEMLOCK: return "AMD HEMLOCK";
+	case CHIP_PALM: return "AMD PALM";
+	case CHIP_SUMO: return "AMD SUMO";
+	case CHIP_SUMO2: return "AMD SUMO2";
+	case CHIP_BARTS: return "AMD BARTS";
+	case CHIP_TURKS: return "AMD TURKS";
+	case CHIP_CAICOS: return "AMD CAICOS";
+	case CHIP_CAYMAN: return "AMD CAYMAN";
+	case CHIP_ARUBA: return "AMD ARUBA";
+	case CHIP_TAHITI: return "AMD TAHITI";
+	case CHIP_PITCAIRN: return "AMD PITCAIRN";
+	case CHIP_VERDE: return "AMD CAPE VERDE";
+	case CHIP_OLAND: return "AMD OLAND";
+	case CHIP_HAINAN: return "AMD HAINAN";
+	case CHIP_BONAIRE: return "AMD BONAIRE";
+	case CHIP_KAVERI: return "AMD KAVERI";
+	case CHIP_KABINI: return "AMD KABINI";
+	case CHIP_HAWAII: return "AMD HAWAII";
+	default: return "AMD unknown";
+	}
+}
+
 static void r600_fence_reference(struct pipe_screen *screen,
 				 struct pipe_fence_handle **ptr,
 				 struct pipe_fence_handle *fence)
@@ -293,6 +341,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
 {
 	ws->query_info(ws, &rscreen->info);
 
+	rscreen->b.get_name = r600_get_name;
+	rscreen->b.get_vendor = r600_get_vendor;
 	rscreen->b.fence_finish = r600_fence_finish;
 	rscreen->b.fence_reference = r600_fence_reference;
 	rscreen->b.fence_signalled = r600_fence_signalled;
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index f29a819..bd3be48 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -218,10 +218,6 @@ fail:
 /*
  * pipe_screen
  */
-static const char* si_get_vendor(struct pipe_screen* pscreen)
-{
-	return "X.Org";
-}
 
 const char *si_get_llvm_processor_name(enum radeon_family family)
 {
@@ -243,29 +239,6 @@ const char *si_get_llvm_processor_name(enum radeon_family family)
 	}
 }
 
-static const char *si_get_family_name(enum radeon_family family)
-{
-	switch(family) {
-	case CHIP_TAHITI: return "AMD TAHITI";
-	case CHIP_PITCAIRN: return "AMD PITCAIRN";
-	case CHIP_VERDE: return "AMD CAPE VERDE";
-	case CHIP_OLAND: return "AMD OLAND";
-	case CHIP_HAINAN: return "AMD HAINAN";
-	case CHIP_BONAIRE: return "AMD BONAIRE";
-	case CHIP_KAVERI: return "AMD KAVERI";
-	case CHIP_KABINI: return "AMD KABINI";
-	case CHIP_HAWAII: return "AMD HAWAII";
-	default: return "AMD unknown";
-	}
-}
-
-static const char* si_get_name(struct pipe_screen* pscreen)
-{
-	struct si_screen *sscreen = (struct si_screen *)pscreen;
-
-	return si_get_family_name(sscreen->b.family);
-}
-
 static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 {
 	struct si_screen *sscreen = (struct si_screen *)pscreen;
@@ -619,8 +592,6 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
 	/* Set functions first. */
 	sscreen->b.b.context_create = si_create_context;
 	sscreen->b.b.destroy = si_destroy_screen;
-	sscreen->b.b.get_name = si_get_name;
-	sscreen->b.b.get_vendor = si_get_vendor;
 	sscreen->b.b.get_param = si_get_param;
 	sscreen->b.b.get_shader_param = si_get_shader_param;
 	sscreen->b.b.get_paramf = si_get_paramf;
-- 
1.8.3.2



More information about the mesa-dev mailing list