From f0d881106a5643521e5f2c75d3d38a9c4e0a35fc Mon Sep 17 00:00:00 2001 From: Vadim Girlin Date: Tue, 16 Jul 2013 14:45:29 +0400 Subject: [PATCH] r600g/sb: move chip & class name functions to sb_context Signed-off-by: Vadim Girlin --- src/gallium/drivers/r600/sb/sb_bc.h | 3 ++ src/gallium/drivers/r600/sb/sb_context.cpp | 50 ++++++++++++++++++++ src/gallium/drivers/r600/sb/sb_shader.cpp | 53 +--------------------- src/gallium/drivers/r600/sb/sb_shader.h | 2 - 4 files changed, 55 insertions(+), 53 deletions(-) diff --git a/src/gallium/drivers/r600/sb/sb_bc.h b/src/gallium/drivers/r600/sb/sb_bc.h index 0e951920e73..ad1b862fd57 100644 --- a/src/gallium/drivers/r600/sb/sb_bc.h +++ b/src/gallium/drivers/r600/sb/sb_bc.h @@ -683,6 +683,9 @@ public: return ((sel >= 128 && sel < 192) || (sel >= 256 && sel < 320)); } + const char * get_hw_class_name(); + const char * get_hw_chip_name(); + }; #define SB_DUMP_STAT(a) do { if (sb_context::dump_stat) { a } } while (0) diff --git a/src/gallium/drivers/r600/sb/sb_context.cpp b/src/gallium/drivers/r600/sb/sb_context.cpp index 78b26d5cae8..9474f74e89f 100644 --- a/src/gallium/drivers/r600/sb/sb_context.cpp +++ b/src/gallium/drivers/r600/sb/sb_context.cpp @@ -83,4 +83,54 @@ int sb_context::init(r600_isa *isa, sb_hw_chip chip, sb_hw_class cclass) { return 0; } +const char* sb_context::get_hw_class_name() { + switch (hw_class) { +#define TRANSLATE_HW_CLASS(c) case HW_CLASS_##c: return #c + TRANSLATE_HW_CLASS(R600); + TRANSLATE_HW_CLASS(R700); + TRANSLATE_HW_CLASS(EVERGREEN); + TRANSLATE_HW_CLASS(CAYMAN); +#undef TRANSLATE_HW_CLASS + default: + assert(!"unknown chip class"); + return "INVALID_CHIP_CLASS"; + } } + +const char* sb_context::get_hw_chip_name() { + switch (hw_chip) { +#define TRANSLATE_CHIP(c) case HW_CHIP_##c: return #c + TRANSLATE_CHIP(R600); + TRANSLATE_CHIP(RV610); + TRANSLATE_CHIP(RV630); + TRANSLATE_CHIP(RV670); + TRANSLATE_CHIP(RV620); + TRANSLATE_CHIP(RV635); + TRANSLATE_CHIP(RS780); + TRANSLATE_CHIP(RS880); + TRANSLATE_CHIP(RV770); + TRANSLATE_CHIP(RV730); + TRANSLATE_CHIP(RV710); + TRANSLATE_CHIP(RV740); + TRANSLATE_CHIP(CEDAR); + TRANSLATE_CHIP(REDWOOD); + TRANSLATE_CHIP(JUNIPER); + TRANSLATE_CHIP(CYPRESS); + TRANSLATE_CHIP(HEMLOCK); + TRANSLATE_CHIP(PALM); + TRANSLATE_CHIP(SUMO); + TRANSLATE_CHIP(SUMO2); + TRANSLATE_CHIP(BARTS); + TRANSLATE_CHIP(TURKS); + TRANSLATE_CHIP(CAICOS); + TRANSLATE_CHIP(CAYMAN); + TRANSLATE_CHIP(ARUBA); +#undef TRANSLATE_CHIP + + default: + assert(!"unknown chip"); + return "INVALID_CHIP"; + } +} + +} // namespace r600_sb diff --git a/src/gallium/drivers/r600/sb/sb_shader.cpp b/src/gallium/drivers/r600/sb/sb_shader.cpp index 32760ec056f..9fc47ae4044 100644 --- a/src/gallium/drivers/r600/sb/sb_shader.cpp +++ b/src/gallium/drivers/r600/sb/sb_shader.cpp @@ -426,61 +426,12 @@ cf_node* shader::create_cf(unsigned op) { std::string shader::get_full_target_name() { std::string s = get_shader_target_name(); s += "/"; - s += get_hw_chip_name(); + s += ctx.get_hw_chip_name(); s += "/"; - s += get_hw_class_name(); + s += ctx.get_hw_class_name(); return s; } -const char* shader::get_hw_class_name() { - switch (ctx.hw_class) { -#define TRANSLATE_HW_CLASS(c) case HW_CLASS_##c: return #c - TRANSLATE_HW_CLASS(R600); - TRANSLATE_HW_CLASS(R700); - TRANSLATE_HW_CLASS(EVERGREEN); - TRANSLATE_HW_CLASS(CAYMAN); -#undef TRANSLATE_HW_CLASS - default: - return "INVALID_CHIP_CLASS"; - } -} - -const char* shader::get_hw_chip_name() { - switch (ctx.hw_chip) { -#define TRANSLATE_CHIP(c) case HW_CHIP_##c: return #c - TRANSLATE_CHIP(R600); - TRANSLATE_CHIP(RV610); - TRANSLATE_CHIP(RV630); - TRANSLATE_CHIP(RV670); - TRANSLATE_CHIP(RV620); - TRANSLATE_CHIP(RV635); - TRANSLATE_CHIP(RS780); - TRANSLATE_CHIP(RS880); - TRANSLATE_CHIP(RV770); - TRANSLATE_CHIP(RV730); - TRANSLATE_CHIP(RV710); - TRANSLATE_CHIP(RV740); - TRANSLATE_CHIP(CEDAR); - TRANSLATE_CHIP(REDWOOD); - TRANSLATE_CHIP(JUNIPER); - TRANSLATE_CHIP(CYPRESS); - TRANSLATE_CHIP(HEMLOCK); - TRANSLATE_CHIP(PALM); - TRANSLATE_CHIP(SUMO); - TRANSLATE_CHIP(SUMO2); - TRANSLATE_CHIP(BARTS); - TRANSLATE_CHIP(TURKS); - TRANSLATE_CHIP(CAICOS); - TRANSLATE_CHIP(CAYMAN); - TRANSLATE_CHIP(ARUBA); -#undef TRANSLATE_CHIP - - default: - assert(!"unknown chip"); - return "INVALID_CHIP"; - } -} - const char* shader::get_shader_target_name() { switch (target) { case TARGET_VS: return "VS"; diff --git a/src/gallium/drivers/r600/sb/sb_shader.h b/src/gallium/drivers/r600/sb/sb_shader.h index 040dbf46667..e515d312d80 100644 --- a/src/gallium/drivers/r600/sb/sb_shader.h +++ b/src/gallium/drivers/r600/sb/sb_shader.h @@ -367,8 +367,6 @@ public: alu_node* create_mov(value* dst, value* src); alu_node* create_copy_mov(value *dst, value *src, unsigned affcost = 1); - const char * get_hw_class_name(); - const char * get_hw_chip_name(); const char * get_shader_target_name(); std::string get_full_target_name(); -- 2.30.2