intel/perf: Replace drm_i915_perf_record_header by intel_perf_record_header

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 <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/29421>
This commit is contained in:
José Roberto de Souza 2024-05-15 09:43:46 -07:00 committed by Marge Bot
parent da43bf3f2e
commit 2f128b2ba5
4 changed files with 28 additions and 15 deletions

View file

@ -202,9 +202,9 @@ std::vector<PerfRecord> IntelDriver::parse_perf_records(const std::vector<uint8_
while (iter < end) {
// Iterate a record at a time
auto header = reinterpret_cast<const drm_i915_perf_record_header *>(iter);
auto header = reinterpret_cast<const intel_perf_record_header *>(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<const uint32_t *>(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<const drm_i915_perf_record_header *>(records[0].data.data());
auto record_b = reinterpret_cast<const drm_i915_perf_record_header *>(records[1].data.data());
auto record_a = reinterpret_cast<const intel_perf_record_header *>(records[0].data.data());
auto record_b = reinterpret_cast<const intel_perf_record_header *>(records[1].data.data());
intel_perf_query_result_accumulate_fields(&perf->result,
selected_query,

View file

@ -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<uint8_t> data;
};

View file

@ -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

View file

@ -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;
}
}