ac/spm: switch to SPM version 2.0
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 3 May 2023 08:05:14 +0000 (10:05 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 9 May 2023 11:25:18 +0000 (11:25 +0000)
Found this while glancing in PAL.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22817>

src/amd/common/ac_rgp.c

index 86706db..60296e7 100644 (file)
@@ -887,19 +887,22 @@ static enum elf_gfxip_level ac_gfx_level_to_elf_gfxip_level(enum amd_gfx_level g
 struct sqtt_spm_counter_info {
    enum ac_pc_gpu_block block;
    uint32_t instance;
-   uint32_t data_offset; /* offset of counter from the beginning of the chunk */
    uint32_t event_index; /* index of counter within the block */
+   uint32_t data_offset; /* offset of counter from the beginning of the chunk */
+   uint32_t data_size;   /* size in bytes of a single counter data item */
 };
 
 struct sqtt_file_chunk_spm_db {
    struct sqtt_file_chunk_header header;
    uint32_t flags;
+   uint32_t preamble_size;
    uint32_t num_timestamps;
    uint32_t num_spm_counter_info;
+   uint32_t spm_counter_info_size;
    uint32_t sample_interval;
 };
 
-static_assert(sizeof(struct sqtt_file_chunk_spm_db) == 32,
+static_assert(sizeof(struct sqtt_file_chunk_spm_db) == 40,
               "sqtt_file_chunk_spm_db doesn't match RGP spec");
 
 static void ac_sqtt_fill_spm_db(const struct ac_spm_trace *spm_trace,
@@ -909,13 +912,15 @@ static void ac_sqtt_fill_spm_db(const struct ac_spm_trace *spm_trace,
 {
    chunk->header.chunk_id.type = SQTT_FILE_CHUNK_TYPE_SPM_DB;
    chunk->header.chunk_id.index = 0;
-   chunk->header.major_version = 1;
-   chunk->header.minor_version = 3;
+   chunk->header.major_version = 2;
+   chunk->header.minor_version = 0;
    chunk->header.size_in_bytes = chunk_size;
 
    chunk->flags = 0;
+   chunk->preamble_size = sizeof(struct sqtt_file_chunk_spm_db);
    chunk->num_timestamps = num_samples;
    chunk->num_spm_counter_info = spm_trace->num_counters;
+   chunk->spm_counter_info_size = sizeof(struct sqtt_spm_counter_info);
    chunk->sample_interval = spm_trace->sample_interval;
 }
 
@@ -957,6 +962,7 @@ static void ac_sqtt_dump_spm(const struct ac_spm_trace *spm_trace,
          .block = spm_trace->counters[c].gpu_block,
          .instance = spm_trace->counters[c].instance,
          .data_offset = counter_values_offset,
+         .data_size = sizeof(uint16_t),
          .event_index = spm_trace->counters[c].event_id,
       };