intel/perf: Implement function that returns OA format for Xe KMD

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29312>
This commit is contained in:
José Roberto de Souza 2024-05-10 10:24:50 -07:00 committed by Marge Bot
parent bdeeaaff59
commit f0c62b6438
5 changed files with 47 additions and 1 deletions

View file

@ -42,6 +42,7 @@
#include "dev/intel_device_info.h"
#include "perf/i915/intel_perf.h"
#include "perf/xe/intel_perf.h"
#include "perf/intel_perf.h"
#include "perf/intel_perf_common.h"
#include "perf/intel_perf_regs.h"
@ -1489,6 +1490,8 @@ intel_perf_get_oa_format(struct intel_perf_config *perf_cfg)
switch (perf_cfg->devinfo->kmd_type) {
case INTEL_KMD_TYPE_I915:
return i915_perf_get_oa_format(perf_cfg);
case INTEL_KMD_TYPE_XE:
return xe_perf_get_oa_format(perf_cfg);
default:
unreachable("missing");
return 0;

View file

@ -254,7 +254,7 @@ struct intel_perf_query_info {
/* OA specific */
uint64_t oa_metrics_set_id;
uint64_t oa_format;
uint64_t oa_format;/* KMD value */
/* For indexing into the accumulator[] ... */
int gpu_time_offset;

View file

@ -20,6 +20,8 @@ endforeach
intel_perf_sources = [
'i915/intel_perf.c',
'i915/intel_perf.h',
'xe/intel_perf.c',
'xe/intel_perf.h',
'intel_perf_common.c',
'intel_perf_common.h',
'intel_perf.c',

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 Intel Corporation
* SPDX-License-Identifier: MIT
*/
#include "perf/xe/intel_perf.h"
#include <sys/stat.h>
#include "perf/intel_perf.h"
#include "drm-uapi/xe_drm.h"
#define FIELD_PREP_ULL(_mask, _val) (((_val) << (ffsll(_mask) - 1)) & (_mask))
uint64_t xe_perf_get_oa_format(struct intel_perf_config *perf)
{
uint64_t fmt = FIELD_PREP_ULL(DRM_XE_OA_FORMAT_MASK_FMT_TYPE, DRM_XE_OA_FMT_TYPE_OAG);
/* same as I915_OA_FORMAT_A24u40_A14u32_B8_C8 and
* I915_OA_FORMAT_A32u40_A4u32_B8_C8 returned for gfx 125+ and gfx 120
* respectively.
*/
fmt |= FIELD_PREP_ULL(DRM_XE_OA_FORMAT_MASK_COUNTER_SEL, 5);
fmt |= FIELD_PREP_ULL(DRM_XE_OA_FORMAT_MASK_COUNTER_SIZE, 0);
fmt |= FIELD_PREP_ULL(DRM_XE_OA_FORMAT_MASK_BC_REPORT, 0);
return fmt;
}

View file

@ -0,0 +1,12 @@
/*
* Copyright 2024 Intel Corporation
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <stdint.h>
struct intel_perf_config;
uint64_t xe_perf_get_oa_format(struct intel_perf_config *perf);