xref: /aosp_15_r20/external/mesa3d/src/intel/perf/i915/intel_perf.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2024 Intel Corporation
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #pragma once
7 
8 #include <stdbool.h>
9 #include <stddef.h>
10 #include <stdint.h>
11 
12 struct intel_perf_config;
13 struct intel_perf_registers;
14 struct drm_i915_perf_oa_config;
15 
16 uint64_t i915_perf_get_oa_format(struct intel_perf_config *perf);
17 
18 int i915_perf_stream_open(struct intel_perf_config *perf_config, int drm_fd,
19                           uint32_t ctx_id, uint64_t metrics_set_id,
20                           uint64_t report_format, uint64_t period_exponent,
21                           bool hold_preemption, bool enable);
22 int i915_perf_stream_read_samples(struct intel_perf_config *perf_config, int perf_stream_fd, uint8_t *buffer, size_t buffer_len);
23 int i915_perf_stream_set_state(int perf_stream_fd, bool enable);
24 int i915_perf_stream_set_metrics_id(int perf_stream_fd, uint64_t metrics_set_id);
25 
26 struct intel_perf_registers *i915_perf_load_configurations(struct intel_perf_config *perf_cfg, int fd, const char *guid);
27 
28 bool i915_oa_metrics_available(struct intel_perf_config *perf, int fd, bool use_register_snapshots);
29 
30 bool i915_has_dynamic_config_support(struct intel_perf_config *perf, int fd);
31 uint64_t i915_add_config(struct intel_perf_config *perf, int fd,
32                          const struct intel_perf_registers *config,
33                          const char *guid);
34 int i915_remove_config(struct intel_perf_config *perf, int fd, uint64_t config_id);
35