intel/compiler: Get rid of struct gen_disasm
[mesa.git] / src / intel / tools / aubinator_viewer.h
1 #ifndef AUBINATOR_VIEWER_H
2 #define AUBINATOR_VIEWER_H
3
4 #include "imgui/imgui.h"
5
6 #include "common/gen_decoder.h"
7 #include "common/gen_disasm.h"
8
9 struct aub_viewer_cfg {
10 ImColor clear_color;
11 ImColor dwords_color;
12 ImColor highlight_color;
13 ImColor error_color;
14 ImColor missing_color;
15 ImColor boolean_color;
16
17 aub_viewer_cfg() :
18 clear_color(114, 144, 154),
19 dwords_color(29, 177, 194, 255),
20 highlight_color(0, 230, 0, 255),
21 error_color(236, 255, 0, 255),
22 missing_color(230, 0, 230, 255),
23 boolean_color(228, 75, 255) {}
24 };
25
26 struct aub_viewer_decode_cfg {
27 struct ImGuiTextFilter command_filter;
28 struct ImGuiTextFilter field_filter;
29
30 bool drop_filtered;
31 bool show_dwords;
32
33 aub_viewer_decode_cfg() :
34 drop_filtered(false),
35 show_dwords(true) {}
36 };
37
38 enum aub_decode_stage {
39 AUB_DECODE_STAGE_VS,
40 AUB_DECODE_STAGE_HS,
41 AUB_DECODE_STAGE_DS,
42 AUB_DECODE_STAGE_GS,
43 AUB_DECODE_STAGE_PS,
44 AUB_DECODE_STAGE_CS,
45 AUB_DECODE_N_STAGE,
46 };
47
48 struct aub_decode_urb_stage_state {
49 uint32_t start;
50 uint32_t size;
51 uint32_t n_entries;
52
53 uint32_t const_rd_length;
54 uint32_t rd_offset;
55 uint32_t rd_length;
56 uint32_t wr_offset;
57 uint32_t wr_length;
58 };
59
60 struct aub_viewer_decode_ctx {
61 struct gen_batch_decode_bo (*get_bo)(void *user_data, bool ppgtt, uint64_t address);
62 unsigned (*get_state_size)(void *user_data,
63 uint32_t offset_from_dynamic_state_base_addr);
64
65 void (*display_shader)(void *user_data, const char *shader_desc, uint64_t address);
66 void (*display_urb)(void *user_data, const struct aub_decode_urb_stage_state *stages);
67 void (*edit_address)(void *user_data, uint64_t address, uint32_t length);
68
69 void *user_data;
70
71 const struct gen_device_info *devinfo;
72 struct gen_spec *spec;
73 enum drm_i915_gem_engine_class engine;
74
75 struct aub_viewer_cfg *cfg;
76 struct aub_viewer_decode_cfg *decode_cfg;
77
78 uint64_t surface_base;
79 uint64_t dynamic_base;
80 uint64_t instruction_base;
81
82 enum aub_decode_stage stage;
83 uint32_t end_urb_offset;
84 struct aub_decode_urb_stage_state urb_stages[AUB_DECODE_N_STAGE];
85
86 int n_batch_buffer_start;
87 };
88
89 void aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx,
90 struct aub_viewer_cfg *cfg,
91 struct aub_viewer_decode_cfg *decode_cfg,
92 const struct gen_device_info *devinfo,
93 struct gen_spec *spec,
94 struct gen_batch_decode_bo (*get_bo)(void *, bool, uint64_t),
95 unsigned (*get_state_size)(void *, uint32_t),
96 void *user_data);
97
98 void aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx,
99 const void *batch, uint32_t batch_size,
100 uint64_t batch_addr, bool from_ring);
101
102 #endif /* AUBINATOR_VIEWER_H */