intel/perf: fix roll over PERF_CNT counter accumulation
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 5ba6d9941b
("intel/perf: add mdapi writes for register perf counters")
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9163>
This commit is contained in:

committed by
Marge Bot

parent
018393d851
commit
8b44e45347
@@ -1144,8 +1144,12 @@ gen_perf_query_result_read_perfcnts(struct gen_perf_query_result *result,
|
||||
const uint64_t *end)
|
||||
{
|
||||
for (uint32_t i = 0; i < 2; i++) {
|
||||
result->accumulator[query->perfcnt_offset + i] =
|
||||
(end[i] & PERF_CNT_VALUE_MASK) - (start[i] & PERF_CNT_VALUE_MASK);
|
||||
uint64_t v0 = start[i] & PERF_CNT_VALUE_MASK;
|
||||
uint64_t v1 = end[i] & PERF_CNT_VALUE_MASK;
|
||||
|
||||
result->accumulator[query->perfcnt_offset + i] = v0 > v1 ?
|
||||
(PERF_CNT_VALUE_MASK + 1 + v1 - v0) :
|
||||
(v1 - v0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user