};
struct si_pc_block_base {
- const char *name;
+ char name[8];
unsigned num_counters;
unsigned flags;
unsigned select_or;
unsigned select0;
unsigned counter0_lo;
- unsigned *select;
- unsigned *counters;
+ unsigned select[4];
+ unsigned counters[4];
unsigned num_multi;
unsigned num_prelude;
unsigned layout;
};
struct si_pc_block {
- struct si_pc_block_base *b;
+ const struct si_pc_block_base *b;
unsigned selectors;
unsigned instances;
};
S_036780_CS_EN(1),
};
-static struct si_pc_block_base cik_CB = {
+static const struct si_pc_block_base cik_CB = {
.name = "CB",
.num_counters = 4,
.flags = R600_PC_BLOCK_SE | R600_PC_BLOCK_INSTANCE_GROUPS,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static unsigned cik_CPC_select[] = {
- R_036024_CPC_PERFCOUNTER0_SELECT,
- R_036010_CPC_PERFCOUNTER0_SELECT1,
- R_03600C_CPC_PERFCOUNTER1_SELECT,
-};
-static struct si_pc_block_base cik_CPC = {
+static const struct si_pc_block_base cik_CPC = {
.name = "CPC",
.num_counters = 2,
- .select = cik_CPC_select,
+ .select = { R_036024_CPC_PERFCOUNTER0_SELECT,
+ R_036010_CPC_PERFCOUNTER0_SELECT1,
+ R_03600C_CPC_PERFCOUNTER1_SELECT },
.counter0_lo = R_034018_CPC_PERFCOUNTER0_LO,
.num_multi = 1,
.layout = SI_PC_MULTI_CUSTOM | SI_PC_REG_REVERSE,
};
-static struct si_pc_block_base cik_CPF = {
+static const struct si_pc_block_base cik_CPF = {
.name = "CPF",
.num_counters = 2,
.layout = SI_PC_MULTI_ALTERNATE | SI_PC_REG_REVERSE,
};
-static struct si_pc_block_base cik_CPG = {
+static const struct si_pc_block_base cik_CPG = {
.name = "CPG",
.num_counters = 2,
.layout = SI_PC_MULTI_ALTERNATE | SI_PC_REG_REVERSE,
};
-static struct si_pc_block_base cik_DB = {
+static const struct si_pc_block_base cik_DB = {
.name = "DB",
.num_counters = 4,
.flags = R600_PC_BLOCK_SE | R600_PC_BLOCK_INSTANCE_GROUPS,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static struct si_pc_block_base cik_GDS = {
+static const struct si_pc_block_base cik_GDS = {
.name = "GDS",
.num_counters = 4,
.layout = SI_PC_MULTI_TAIL,
};
-static unsigned cik_GRBM_counters[] = {
- R_034100_GRBM_PERFCOUNTER0_LO,
- R_03410C_GRBM_PERFCOUNTER1_LO,
-};
-static struct si_pc_block_base cik_GRBM = {
+static const struct si_pc_block_base cik_GRBM = {
.name = "GRBM",
.num_counters = 2,
.select0 = R_036100_GRBM_PERFCOUNTER0_SELECT,
- .counters = cik_GRBM_counters,
+ .counters = { R_034100_GRBM_PERFCOUNTER0_LO,
+ R_03410C_GRBM_PERFCOUNTER1_LO },
};
-static struct si_pc_block_base cik_GRBMSE = {
+static const struct si_pc_block_base cik_GRBMSE = {
.name = "GRBMSE",
.num_counters = 4,
.counter0_lo = R_034114_GRBM_SE0_PERFCOUNTER_LO,
};
-static struct si_pc_block_base cik_IA = {
+static const struct si_pc_block_base cik_IA = {
.name = "IA",
.num_counters = 4,
.layout = SI_PC_MULTI_TAIL,
};
-static struct si_pc_block_base cik_PA_SC = {
+static const struct si_pc_block_base cik_PA_SC = {
.name = "PA_SC",
.num_counters = 8,
.flags = R600_PC_BLOCK_SE,
};
/* According to docs, PA_SU counters are only 48 bits wide. */
-static struct si_pc_block_base cik_PA_SU = {
+static const struct si_pc_block_base cik_PA_SU = {
.name = "PA_SU",
.num_counters = 4,
.flags = R600_PC_BLOCK_SE,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static struct si_pc_block_base cik_SPI = {
+static const struct si_pc_block_base cik_SPI = {
.name = "SPI",
.num_counters = 6,
.flags = R600_PC_BLOCK_SE,
.layout = SI_PC_MULTI_BLOCK,
};
-static struct si_pc_block_base cik_SQ = {
+static const struct si_pc_block_base cik_SQ = {
.name = "SQ",
.num_counters = 16,
.flags = R600_PC_BLOCK_SE | R600_PC_BLOCK_SHADER,
.counter0_lo = R_034700_SQ_PERFCOUNTER0_LO,
};
-static struct si_pc_block_base cik_SX = {
+static const struct si_pc_block_base cik_SX = {
.name = "SX",
.num_counters = 4,
.flags = R600_PC_BLOCK_SE,
.layout = SI_PC_MULTI_TAIL,
};
-static struct si_pc_block_base cik_TA = {
+static const struct si_pc_block_base cik_TA = {
.name = "TA",
.num_counters = 2,
.flags = R600_PC_BLOCK_SE | R600_PC_BLOCK_INSTANCE_GROUPS | R600_PC_BLOCK_SHADER_WINDOWED,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static struct si_pc_block_base cik_TD = {
+static const struct si_pc_block_base cik_TD = {
.name = "TD",
.num_counters = 2,
.flags = R600_PC_BLOCK_SE | R600_PC_BLOCK_INSTANCE_GROUPS | R600_PC_BLOCK_SHADER_WINDOWED,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static struct si_pc_block_base cik_TCA = {
+static const struct si_pc_block_base cik_TCA = {
.name = "TCA",
.num_counters = 4,
.flags = R600_PC_BLOCK_INSTANCE_GROUPS,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static struct si_pc_block_base cik_TCC = {
+static const struct si_pc_block_base cik_TCC = {
.name = "TCC",
.num_counters = 4,
.flags = R600_PC_BLOCK_INSTANCE_GROUPS,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static struct si_pc_block_base cik_TCP = {
+static const struct si_pc_block_base cik_TCP = {
.name = "TCP",
.num_counters = 4,
.flags = R600_PC_BLOCK_SE | R600_PC_BLOCK_INSTANCE_GROUPS | R600_PC_BLOCK_SHADER_WINDOWED,
.layout = SI_PC_MULTI_ALTERNATE,
};
-static struct si_pc_block_base cik_VGT = {
+static const struct si_pc_block_base cik_VGT = (const struct si_pc_block_base) {
.name = "VGT",
.num_counters = 4,
.flags = R600_PC_BLOCK_SE,
.layout = SI_PC_MULTI_TAIL,
};
-static struct si_pc_block_base cik_WD = {
+static const struct si_pc_block_base cik_WD = {
.name = "WD",
.num_counters = 4,
.counter0_lo = R_034200_WD_PERFCOUNTER0_LO,
};
-static struct si_pc_block_base cik_MC = {
+static const struct si_pc_block_base cik_MC = {
.name = "MC",
.num_counters = 4,
.layout = SI_PC_FAKE,
};
-static struct si_pc_block_base cik_SRBM = {
+static const struct si_pc_block_base cik_SRBM = {
.name = "SRBM",
.num_counters = 2,
* blindly once it believes it has identified the hardware, so the order of
* blocks here matters.
*/
-static struct si_pc_block groups_CIK[] = {
+static const struct si_pc_block groups_CIK[] = {
{ &cik_CB, 226, 4 },
{ &cik_CPF, 17 },
{ &cik_DB, 257, 4 },
};
-static struct si_pc_block groups_VI[] = {
+static const struct si_pc_block groups_VI[] = {
{ &cik_CB, 396, 4 },
{ &cik_CPF, 19 },
{ &cik_DB, 257, 4 },
unsigned count, unsigned *selectors,
unsigned *num_select_dw, unsigned *num_read_dw)
{
- struct si_pc_block *sigroup = (struct si_pc_block *)group->data;
- struct si_pc_block_base *regs = sigroup->b;
+ const struct si_pc_block *sigroup = (const struct si_pc_block *)group->data;
+ const struct si_pc_block_base *regs = sigroup->b;
unsigned layout_multi = regs->layout & SI_PC_MULTI_MASK;
if (regs->layout & SI_PC_FAKE) {
struct r600_perfcounter_block *group,
unsigned count, unsigned *selectors)
{
- struct si_pc_block *sigroup = (struct si_pc_block *)group->data;
- struct si_pc_block_base *regs = sigroup->b;
+ const struct si_pc_block *sigroup = (const struct si_pc_block *)group->data;
+ const struct si_pc_block_base *regs = sigroup->b;
struct radeon_winsys_cs *cs = ctx->gfx.cs;
unsigned idx;
unsigned layout_multi = regs->layout & SI_PC_MULTI_MASK;
for (idx = 0; idx < select1_count; ++idx)
radeon_emit(cs, 0);
} else if (layout_multi == SI_PC_MULTI_CUSTOM) {
- unsigned *reg = regs->select;
+ const unsigned *reg = regs->select;
for (idx = 0; idx < count; ++idx) {
radeon_set_uconfig_reg(cs, *reg++, selectors[idx] | regs->select_or);
if (idx < regs->num_multi)
unsigned count, unsigned *selectors,
struct r600_resource *buffer, uint64_t va)
{
- struct si_pc_block *sigroup = (struct si_pc_block *)group->data;
- struct si_pc_block_base *regs = sigroup->b;
+ const struct si_pc_block *sigroup = (const struct si_pc_block *)group->data;
+ const struct si_pc_block_base *regs = sigroup->b;
struct radeon_winsys_cs *cs = ctx->gfx.cs;
unsigned idx;
unsigned reg = regs->counter0_lo;
void si_init_perfcounters(struct si_screen *screen)
{
struct r600_perfcounters *pc;
- struct si_pc_block *blocks;
+ const struct si_pc_block *blocks;
unsigned num_blocks;
unsigned i;
goto error;
for (i = 0; i < num_blocks; ++i) {
- struct si_pc_block *block = &blocks[i];
+ const struct si_pc_block *block = &blocks[i];
unsigned instances = block->instances;
if (!strcmp(block->b->name, "IA")) {