From: Lionel Landwerlin Date: Wed, 28 Nov 2018 15:10:09 +0000 (+0000) Subject: intel/perf: add mdapi writes for register perf counters X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ba6d9941b5dda95b88b924ac51133f36bd0f653;p=mesa.git intel/perf: add mdapi writes for register perf counters Those are not part of the OA reports. Signed-off-by: Lionel Landwerlin Reviewed-by: Rafael Antognolli --- diff --git a/src/intel/perf/gen_perf_mdapi.h b/src/intel/perf/gen_perf_mdapi.h index 9747198be95..c0e8d811c1d 100644 --- a/src/intel/perf/gen_perf_mdapi.h +++ b/src/intel/perf/gen_perf_mdapi.h @@ -134,6 +134,42 @@ int gen_perf_query_result_write_mdapi(void *data, uint32_t data_size, const struct gen_perf_query_result *result, uint64_t freq_start, uint64_t freq_end); +static inline void gen_perf_query_mdapi_write_perfcntr(void *data, uint32_t data_size, + const struct gen_device_info *devinfo, + const uint64_t *begin_perf_cntrs, + const uint64_t *end_perf_cntrs) +{ + /* Only bits 0:43 of the 64bit registers contains the value. */ + const uint64_t mask = (1ull << 44) - 1; + + switch (devinfo->gen) { + case 8: { + if (data_size < sizeof(struct gen8_mdapi_metrics)) + return; + struct gen8_mdapi_metrics *mdapi_data = data; + mdapi_data->PerfCounter1 = + (end_perf_cntrs[0] & mask) - (begin_perf_cntrs[0] & mask); + mdapi_data->PerfCounter2 = + (end_perf_cntrs[1] & mask) - (begin_perf_cntrs[1] & mask); + break; + } + case 9: + case 10: + case 11: { + if (data_size < sizeof(struct gen9_mdapi_metrics)) + return; + struct gen9_mdapi_metrics *mdapi_data = data; + mdapi_data->PerfCounter1 = + (end_perf_cntrs[0] & mask) - (begin_perf_cntrs[0] & mask); + mdapi_data->PerfCounter2 = + (end_perf_cntrs[1] & mask) - (begin_perf_cntrs[1] & mask); + break; + } + default: + break; + } +} + static inline void gen_perf_query_mdapi_write_marker(void *data, uint32_t data_size, const struct gen_device_info *devinfo, uint64_t value)