mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
pan/perf: Pass counter info to raw read function
When a counter is derived, it can't be read based on just the offsets into the buffer. To prepare for that, pass the info struct instead.
This commit is contained in:
parent
6cde1e3403
commit
77f46dfb5a
3 changed files with 11 additions and 15 deletions
|
|
@ -174,9 +174,7 @@ PanfrostPerf::create_available_counters() const
|
|||
auto &pan_driver = PanfrostDriver::into(d);
|
||||
struct pan_perf *perf = static_cast<struct pan_perf *>(
|
||||
pan_driver.perf->get_subinstance());
|
||||
return pan_perf_counter_read_raw(
|
||||
perf, (enum pan_perf_counter_categories)cat_idx, block_idx,
|
||||
cinfo->offset);
|
||||
return pan_perf_counter_read_raw(perf, cinfo, block_idx);
|
||||
});
|
||||
|
||||
group.counters.push_back(counter.id);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@
|
|||
|
||||
int64_t
|
||||
pan_perf_counter_read_raw(const struct pan_perf *perf,
|
||||
enum pan_perf_counter_categories category,
|
||||
uint8_t block_index, uint32_t counter_index)
|
||||
const struct pan_perf_counter *counter, uint8_t block)
|
||||
{
|
||||
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_FRONTEND == (int)PAN_PERF_COUNTER_CAT_FRONTEND);
|
||||
STATIC_ASSERT((int)PAN_KMOD_PERF_CAT_TILER == (int)PAN_PERF_COUNTER_CAT_TILER);
|
||||
|
|
@ -29,11 +28,12 @@ pan_perf_counter_read_raw(const struct pan_perf *perf,
|
|||
|
||||
assert(perf->session->data != NULL);
|
||||
|
||||
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;
|
||||
const uint32_t category = counter->category_index;
|
||||
const uint32_t offset = perf->mem_layout.category[category].offset +
|
||||
perf->mem_layout.block_stride * block +
|
||||
perf->mem_layout.counter_stride * counter->offset;
|
||||
|
||||
uint8_t *val_ptr = ((uint8_t *)perf->session->data) + val_offset;
|
||||
uint8_t *val_ptr = ((uint8_t *)perf->session->data) + offset;
|
||||
return pan_kmod_perf_load_counter(perf->session, val_ptr);
|
||||
}
|
||||
|
||||
|
|
@ -41,16 +41,14 @@ int64_t
|
|||
pan_perf_counter_read(const struct pan_perf_counter *counter,
|
||||
const struct pan_perf *perf)
|
||||
{
|
||||
int64_t ret = pan_perf_counter_read_raw(perf, counter->category_index, 0,
|
||||
counter->offset);
|
||||
int64_t ret = pan_perf_counter_read_raw(perf, counter, 0);
|
||||
|
||||
/* If counter belongs to shader core, sum values for all cores. */
|
||||
if (counter->category_index == PAN_PERF_COUNTER_CAT_SHADER) {
|
||||
uint32_t n_cores =
|
||||
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_PERF_COUNTER_CAT_SHADER,
|
||||
core, counter->offset);
|
||||
ret += pan_perf_counter_read_raw(perf, counter, core);
|
||||
assert(ret >= 0 && "counter sum should not overflow");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ struct pan_perf {
|
|||
};
|
||||
|
||||
int64_t pan_perf_counter_read_raw(const struct pan_perf *perf,
|
||||
enum pan_perf_counter_categories category,
|
||||
uint8_t block_index, uint32_t counter_index);
|
||||
const struct pan_perf_counter *counter,
|
||||
uint8_t block);
|
||||
|
||||
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