diff --git a/src/freedreno/perfcntrs/dumpctrs.c b/src/freedreno/perfcntrs/dumpctrs.c new file mode 100644 index 00000000000..62b9fe4e1fe --- /dev/null +++ b/src/freedreno/perfcntrs/dumpctrs.c @@ -0,0 +1,82 @@ +/* + * Copyright © 2016 Rob Clark + * All Rights Reserved. + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "drm/freedreno_drmif.h" +#include "drm/freedreno_ringbuffer.h" + +#include "util/os_file.h" + +#include "freedreno_dt.h" +#include "freedreno_perfcntr.h" + +/* + * Simple tool to dump perfctr tables (so we can make sure nothing gets + * missed while converting to generated tables) + */ + +int +main(int argc, char **argv) +{ + struct fd_dev_id dev_id = {}; + unsigned ngroups = 0; + const struct fd_perfcntr_group *groups; + + if (argc != 2) + return -1; + + if (!strcmp(argv[1], "a2xx")) { + dev_id.gpu_id = 200; + } else if (!strcmp(argv[1], "a5xx")) { + dev_id.gpu_id = 530; + } else if (!strcmp(argv[1], "a6xx")) { + dev_id.gpu_id = 630; + } else if (!strcmp(argv[1], "a7xx")) { + dev_id.chip_id = 0xffff07030001; + } + + groups = fd_perfcntrs(&dev_id, &ngroups); + if (!groups) { + errx(1, "no perfcntr support"); + } + + for (int i = 0; i < ngroups; i++) { + const struct fd_perfcntr_group *g = &groups[i]; + printf("GROUP[%s]: num_counters=%u, num_countables=%u\n", + g->name, g->num_counters, g->num_countables); + + for (int j = 0; j < g->num_counters; j++) { + const struct fd_perfcntr_counter *counter = &g->counters[j]; + printf("COUNTER: %04x, %04x, %04x, %04x, %04x\n", + counter->select_reg, counter->counter_reg_lo, counter->counter_reg_hi, + counter->enable, counter->clear); + } + + for (int j = 0; j < g->num_countables; j++) { + const struct fd_perfcntr_countable *countable = &g->countables[j]; + printf("COUNTABLE[%s]: %04x\n", countable->name, countable->selector); + } + + printf("\n"); + } + + + return 0; +} diff --git a/src/freedreno/perfcntrs/meson.build b/src/freedreno/perfcntrs/meson.build index 5b0dbf8a0d2..5caa91fbf30 100644 --- a/src/freedreno/perfcntrs/meson.build +++ b/src/freedreno/perfcntrs/meson.build @@ -51,3 +51,23 @@ if dep_libconfig.found() and dep_curses.found() install : with_tools.contains('freedreno'), ) endif + +dumpctrs = executable( + 'dumpctrs', + ['dumpctrs.c', freedreno_xml_header_files], + include_directories : [ + inc_freedreno, + inc_include, + inc_src, + ], + link_with : [ + libfreedreno_common, + libfreedreno_drm, + libfreedreno_perfcntrs, + ], + dependencies : [ + dep_libdrm, + idep_mesautil, + ], + build_by_default : with_tools.contains('freedreno'), +)