intel/tools: Add ELK support for aubinator_viewer

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27563>
This commit is contained in:
Caio Oliveira 2024-02-09 09:29:21 -08:00 committed by Marge Bot
parent 9d379f08af
commit d641ca5b86
2 changed files with 18 additions and 6 deletions

View file

@ -41,6 +41,8 @@
#include "compiler/brw_disasm.h"
#include "compiler/brw_isa_info.h"
#include "compiler/elk/elk_disasm.h"
#include "compiler/elk/elk_isa_info.h"
#define xtzalloc(name) ((decltype(&name)) calloc(1, sizeof(name)))
#define xtalloc(name) ((decltype(&name)) malloc(sizeof(name)))
@ -63,7 +65,8 @@ struct aub_file {
/* Device state */
struct intel_device_info devinfo;
struct brw_isa_info isa;
struct brw_isa_info brw;
struct elk_isa_info elk;
struct intel_spec *spec;
};
@ -131,7 +134,10 @@ handle_info(void *user_data, int pci_id, const char *app_name)
fprintf(stderr, "can't find device information: pci_id=0x%x\n", file->pci_id);
exit(EXIT_FAILURE);
}
brw_init_isa_info(&file->isa, &file->devinfo);
if (file->devinfo.ver >= 9)
brw_init_isa_info(&file->brw, &file->devinfo);
else
elk_init_isa_info(&file->elk, &file->devinfo);
file->spec = intel_spec_load(&file->devinfo);
}
@ -395,9 +401,15 @@ new_shader_window(struct aub_mem *mem, uint64_t address, const char *desc)
if (shader_bo.map) {
FILE *f = open_memstream(&window->shader, &window->shader_size);
if (f) {
brw_disassemble_with_errors(&context.file->isa,
(const uint8_t *) shader_bo.map +
(address - shader_bo.addr), 0, f);
if (context.file->devinfo.ver >= 9) {
brw_disassemble_with_errors(&context.file->brw,
(const uint8_t *) shader_bo.map +
(address - shader_bo.addr), 0, f);
} else {
elk_disassemble_with_errors(&context.file->elk,
(const uint8_t *) shader_bo.map +
(address - shader_bo.addr), 0, f);
}
fclose(f);
}
}

View file

@ -165,7 +165,7 @@ if with_tools.contains('intel-ui')
files('aubinator_viewer.cpp', 'aubinator_viewer_decoder.cpp'),
dependencies : [idep_mesautil, dep_zlib, dep_dl, dep_thread, dep_m, libintel_imgui_gtk_dep, idep_intel_dev],
include_directories : [inc_include, inc_src, inc_intel],
link_with : [libintel_common, libintel_compiler, libaub],
link_with : [libintel_common, libintel_compiler, libintel_compiler_elk, libaub],
c_args : [no_override_init_args],
gnu_symbol_visibility : 'hidden',
cpp_args : ['-fpermissive', '-Wno-parentheses'],