ac/rgp: add support for clock calibration
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13709>
This commit is contained in:
parent
aebf04ab3f
commit
1ee85e8bab
|
@ -841,6 +841,30 @@ ac_sqtt_fill_queue_event_timings(struct rgp_queue_info *rgp_queue_info,
|
|||
chunk->queue_event_table_size = queue_event_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* SQTT clock calibration info.
|
||||
*/
|
||||
struct sqtt_file_chunk_clock_calibration {
|
||||
struct sqtt_file_chunk_header header;
|
||||
uint64_t cpu_timestamp;
|
||||
uint64_t gpu_timestamp;
|
||||
uint64_t reserved;
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct sqtt_file_chunk_clock_calibration) == 40,
|
||||
"sqtt_file_chunk_clock_calibration doesn't match RGP spec");
|
||||
|
||||
static void
|
||||
ac_sqtt_fill_clock_calibration(struct sqtt_file_chunk_clock_calibration *chunk,
|
||||
int32_t chunk_index)
|
||||
{
|
||||
chunk->header.chunk_id.type = SQTT_FILE_CHUNK_TYPE_CLOCK_CALIBRATION;
|
||||
chunk->header.chunk_id.index = chunk_index;
|
||||
chunk->header.major_version = 0;
|
||||
chunk->header.minor_version = 0;
|
||||
chunk->header.size_in_bytes = sizeof(*chunk);
|
||||
}
|
||||
|
||||
/* Below values are from from llvm project
|
||||
* llvm/include/llvm/BinaryFormat/ELF.h
|
||||
*/
|
||||
|
@ -886,6 +910,7 @@ static void ac_sqtt_dump_data(struct radeon_info *rad_info,
|
|||
&thread_trace_data->rgp_pso_correlation;
|
||||
struct rgp_queue_info *rgp_queue_info = &thread_trace_data->rgp_queue_info;
|
||||
struct rgp_queue_event *rgp_queue_event = &thread_trace_data->rgp_queue_event;
|
||||
struct rgp_clock_calibration *rgp_clock_calibration = &thread_trace_data->rgp_clock_calibration;
|
||||
|
||||
/* SQTT header file. */
|
||||
ac_sqtt_fill_header(&header);
|
||||
|
@ -1002,6 +1027,27 @@ static void ac_sqtt_dump_data(struct radeon_info *rad_info,
|
|||
sizeof(struct sqtt_queue_event_record));
|
||||
}
|
||||
|
||||
/* SQTT clock calibration. */
|
||||
if (rgp_clock_calibration->record_count) {
|
||||
uint32_t num_records = 0;
|
||||
|
||||
list_for_each_entry_safe(struct rgp_clock_calibration_record, record,
|
||||
&rgp_clock_calibration->record, list) {
|
||||
struct sqtt_file_chunk_clock_calibration clock_calibration;
|
||||
|
||||
ac_sqtt_fill_clock_calibration(&clock_calibration, num_records);
|
||||
|
||||
clock_calibration.cpu_timestamp = record->cpu_timestamp;
|
||||
clock_calibration.gpu_timestamp = record->gpu_timestamp;
|
||||
|
||||
fwrite(&clock_calibration, sizeof(struct sqtt_file_chunk_clock_calibration), 1,
|
||||
output);
|
||||
file_offset += sizeof(struct sqtt_file_chunk_clock_calibration);
|
||||
|
||||
num_records++;
|
||||
}
|
||||
}
|
||||
|
||||
if (thread_trace) {
|
||||
for (unsigned i = 0; i < thread_trace->num_traces; i++) {
|
||||
const struct ac_thread_trace_se *se = &thread_trace->traces[i];
|
||||
|
|
|
@ -175,6 +175,18 @@ struct rgp_queue_event {
|
|||
simple_mtx_t lock;
|
||||
};
|
||||
|
||||
struct rgp_clock_calibration_record {
|
||||
uint64_t cpu_timestamp;
|
||||
uint64_t gpu_timestamp;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
struct rgp_clock_calibration {
|
||||
uint32_t record_count;
|
||||
struct list_head record;
|
||||
simple_mtx_t lock;
|
||||
};
|
||||
|
||||
int
|
||||
ac_dump_rgp_capture(struct radeon_info *info,
|
||||
struct ac_thread_trace *thread_trace);
|
||||
|
|
|
@ -52,6 +52,8 @@ struct ac_thread_trace_data {
|
|||
|
||||
struct rgp_queue_info rgp_queue_info;
|
||||
struct rgp_queue_event rgp_queue_event;
|
||||
|
||||
struct rgp_clock_calibration rgp_clock_calibration;
|
||||
};
|
||||
|
||||
#define SQTT_BUFFER_ALIGN_SHIFT 12
|
||||
|
|
Loading…
Reference in New Issue