From 2f128b2ba57dd95f93af1c372b2dcc93c6efd7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Wed, 15 May 2024 09:43:46 -0700 Subject: [PATCH] intel/perf: Replace drm_i915_perf_record_header by intel_perf_record_header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drm_i915_perf_record_header requires i915_drm.h but we want to remove all i915_drm.h includes from common code, so replacing it by intel_perf_record_header. No changes in behavior expected as the structs and enums are identical. Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/ds/intel_pps_driver.cc | 8 ++++---- src/intel/ds/intel_pps_driver.h | 2 +- src/intel/perf/intel_perf.h | 13 +++++++++++++ src/intel/perf/intel_perf_query.c | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/intel/ds/intel_pps_driver.cc b/src/intel/ds/intel_pps_driver.cc index d434b05f64a..9cc5c0c2731 100644 --- a/src/intel/ds/intel_pps_driver.cc +++ b/src/intel/ds/intel_pps_driver.cc @@ -202,9 +202,9 @@ std::vector IntelDriver::parse_perf_records(const std::vector(iter); + auto header = reinterpret_cast(iter); - if (header->type == DRM_I915_PERF_RECORD_SAMPLE) { + if (header->type == INTEL_PERF_RECORD_TYPE_SAMPLE) { // Report is next to the header const uint32_t *report = reinterpret_cast(header + 1); uint64_t gpu_timestamp_ldw = @@ -304,8 +304,8 @@ uint64_t IntelDriver::gpu_next() } // Get first and second - auto record_a = reinterpret_cast(records[0].data.data()); - auto record_b = reinterpret_cast(records[1].data.data()); + auto record_a = reinterpret_cast(records[0].data.data()); + auto record_b = reinterpret_cast(records[1].data.data()); intel_perf_query_result_accumulate_fields(&perf->result, selected_query, diff --git a/src/intel/ds/intel_pps_driver.h b/src/intel/ds/intel_pps_driver.h index 15651c65d9b..0daabd41682 100644 --- a/src/intel/ds/intel_pps_driver.h +++ b/src/intel/ds/intel_pps_driver.h @@ -23,7 +23,7 @@ struct PerfRecord { /// Timestamp in the GPU clock domain uint64_t timestamp; - /// drm_i915_perf_record_header + report data + /// intel_perf_record_header + report data std::vector data; }; diff --git a/src/intel/perf/intel_perf.h b/src/intel/perf/intel_perf.h index c2332c59cf2..b761b6a452e 100644 --- a/src/intel/perf/intel_perf.h +++ b/src/intel/perf/intel_perf.h @@ -416,6 +416,19 @@ struct intel_perf_counter_pass { struct intel_perf_query_counter *counter; }; +enum intel_perf_record_type { + INTEL_PERF_RECORD_TYPE_SAMPLE = 1, + INTEL_PERF_RECORD_TYPE_OA_REPORT_LOST = 2, + INTEL_PERF_RECORD_TYPE_OA_BUFFER_LOST = 3, + INTEL_PERF_RECORD_TYPE_MAX, +}; + +struct intel_perf_record_header { + uint32_t type; /* enum intel_perf_record_type */ + uint16_t pad; + uint16_t size; +}; + /** Initialize the intel_perf_config object for a given device. * * include_pipeline_statistics : Whether to add a pipeline statistic query diff --git a/src/intel/perf/intel_perf_query.c b/src/intel/perf/intel_perf_query.c index eb5f999362a..f223d31c3aa 100644 --- a/src/intel/perf/intel_perf_query.c +++ b/src/intel/perf/intel_perf_query.c @@ -1010,11 +1010,11 @@ read_oa_samples_until(struct intel_perf_context *perf_ctx, /* Go through the reports and update the last timestamp. */ offset = 0; while (offset < buf->len) { - const struct drm_i915_perf_record_header *header = - (const struct drm_i915_perf_record_header *) &buf->buf[offset]; + const struct intel_perf_record_header *header = + (const struct intel_perf_record_header *) &buf->buf[offset]; uint32_t *report = (uint32_t *) (header + 1); - if (header->type == DRM_I915_PERF_RECORD_SAMPLE) + if (header->type == INTEL_PERF_RECORD_TYPE_SAMPLE) last_timestamp = report[1]; offset += header->size; @@ -1281,8 +1281,8 @@ accumulate_oa_reports(struct intel_perf_context *perf_ctx, int offset = 0; while (offset < buf->len) { - const struct drm_i915_perf_record_header *header = - (const struct drm_i915_perf_record_header *)(buf->buf + offset); + const struct intel_perf_record_header *header = + (const struct intel_perf_record_header *)(buf->buf + offset); assert(header->size != 0); assert(header->size <= buf->len); @@ -1290,7 +1290,7 @@ accumulate_oa_reports(struct intel_perf_context *perf_ctx, offset += header->size; switch (header->type) { - case DRM_I915_PERF_RECORD_SAMPLE: { + case INTEL_PERF_RECORD_TYPE_SAMPLE: { uint32_t *report = (uint32_t *)(header + 1); bool report_ctx_match = true; bool add = true; @@ -1365,11 +1365,11 @@ accumulate_oa_reports(struct intel_perf_context *perf_ctx, break; } - case DRM_I915_PERF_RECORD_OA_BUFFER_LOST: - DBG("i915 perf: OA error: all reports lost\n"); + case INTEL_PERF_RECORD_TYPE_OA_BUFFER_LOST: + DBG("perf: OA error: all reports lost\n"); goto error; - case DRM_I915_PERF_RECORD_OA_REPORT_LOST: - DBG("i915 perf: OA report lost\n"); + case INTEL_PERF_RECORD_TYPE_OA_REPORT_LOST: + DBG("perf: OA report lost\n"); break; } }