mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
panfrost: Create an enumeration for the counter categories
The Mali-Gx10 series (G710, G610 and G510) introduce one new category of counters which needs to be accounted for in the setup code. Adding this into an enum ensures relevant structs are updated automatically. v2: - Modified generator script to use the enum Signed-off-by: Lukas Zapolskas <lukas.zapolskas@arm.com>
This commit is contained in:
parent
0c0b2a4d38
commit
1749999200
3 changed files with 22 additions and 16 deletions
|
|
@ -120,7 +120,7 @@ def main():
|
|||
c.indent(tab_size)
|
||||
|
||||
n_categories = len(prod.categories)
|
||||
c.write("STATIC_ASSERT(%u <= PAN_PERF_MAX_CATEGORIES);" % n_categories)
|
||||
c.write("STATIC_ASSERT(%u <= PAN_PERF_COUNTER_CAT_MAX);" % n_categories)
|
||||
n_counters = 0
|
||||
for category in prod.categories:
|
||||
category_counters_count = len(category.counters)
|
||||
|
|
|
|||
|
|
@ -17,18 +17,16 @@
|
|||
#include <lib/pan_props.h>
|
||||
#include <pan_perf_metrics.h>
|
||||
|
||||
#define PAN_SHADER_CORE_INDEX 3
|
||||
|
||||
int64_t
|
||||
pan_perf_counter_read_raw(const struct pan_perf *perf, uint8_t category_index,
|
||||
pan_perf_counter_read_raw(const struct pan_perf *perf,
|
||||
enum pan_perf_counter_categories category,
|
||||
uint8_t block_index, uint32_t counter_index)
|
||||
{
|
||||
assert(perf->session->data != NULL);
|
||||
|
||||
const uint32_t val_offset =
|
||||
perf->mem_layout.category[category_index].offset +
|
||||
perf->mem_layout.block_stride * block_index +
|
||||
perf->mem_layout.counter_stride * counter_index;
|
||||
const uint32_t val_offset = perf->mem_layout.category[category].offset +
|
||||
perf->mem_layout.block_stride * block_index +
|
||||
perf->mem_layout.counter_stride * counter_index;
|
||||
|
||||
uint8_t *val_ptr = ((uint8_t *)perf->session->data) + val_offset;
|
||||
return pan_kmod_perf_load_counter(perf->session, val_ptr);
|
||||
|
|
@ -42,12 +40,12 @@ pan_perf_counter_read(const struct pan_perf_counter *counter,
|
|||
counter->offset);
|
||||
|
||||
/* If counter belongs to shader core, sum values for all cores. */
|
||||
if (counter->category_index == PAN_SHADER_CORE_INDEX) {
|
||||
if (counter->category_index == PAN_PERF_COUNTER_CAT_SHADER) {
|
||||
uint32_t n_cores =
|
||||
perf->mem_layout.category[PAN_SHADER_CORE_INDEX].n_blocks;
|
||||
perf->mem_layout.category[PAN_PERF_COUNTER_CAT_SHADER].n_blocks;
|
||||
for (uint32_t core = 1; core < n_cores; ++core) {
|
||||
ret += pan_perf_counter_read_raw(perf, PAN_SHADER_CORE_INDEX, core,
|
||||
counter->offset);
|
||||
ret += pan_perf_counter_read_raw(perf, PAN_PERF_COUNTER_CAT_SHADER,
|
||||
core, counter->offset);
|
||||
assert(ret >= 0 && "counter sum should not overflow");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,17 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PAN_PERF_MAX_CATEGORIES 4
|
||||
#define PAN_PERF_MAX_COUNTERS 64
|
||||
|
||||
enum pan_perf_counter_categories {
|
||||
PAN_PERF_COUNTER_CAT_FRONTEND,
|
||||
PAN_PERF_COUNTER_CAT_TILER,
|
||||
PAN_PERF_COUNTER_CAT_MEMSYS,
|
||||
PAN_PERF_COUNTER_CAT_SHADER,
|
||||
/* Must be last. */
|
||||
PAN_PERF_COUNTER_CAT_MAX,
|
||||
};
|
||||
|
||||
enum pan_perf_counter_units {
|
||||
PAN_PERF_COUNTER_UNITS_CYCLES,
|
||||
PAN_PERF_COUNTER_UNITS_JOBS,
|
||||
|
|
@ -59,7 +67,7 @@ struct pan_perf_category {
|
|||
struct pan_perf_config {
|
||||
const char *name;
|
||||
|
||||
struct pan_perf_category categories[PAN_PERF_MAX_CATEGORIES];
|
||||
struct pan_perf_category categories[PAN_PERF_COUNTER_CAT_MAX];
|
||||
uint32_t n_categories;
|
||||
};
|
||||
|
||||
|
|
@ -71,8 +79,8 @@ struct pan_perf {
|
|||
};
|
||||
|
||||
int64_t pan_perf_counter_read_raw(const struct pan_perf *perf,
|
||||
uint8_t category_index, uint8_t block_index,
|
||||
uint32_t counter_index);
|
||||
enum pan_perf_counter_categories category,
|
||||
uint8_t block_index, uint32_t counter_index);
|
||||
|
||||
int64_t pan_perf_counter_read(const struct pan_perf_counter *counter,
|
||||
const struct pan_perf *perf);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue