1 #ifndef AUBINATOR_VIEWER_H
2 #define AUBINATOR_VIEWER_H
4 #include "imgui/imgui.h"
6 #include "common/gen_decoder.h"
7 #include "common/gen_disasm.h"
9 struct aub_viewer_cfg
{
12 ImColor highlight_color
;
14 ImColor missing_color
;
15 ImColor boolean_color
;
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) {}
26 struct aub_viewer_decode_cfg
{
27 struct ImGuiTextFilter command_filter
;
28 struct ImGuiTextFilter field_filter
;
33 aub_viewer_decode_cfg() :
38 enum aub_decode_stage
{
48 struct aub_decode_urb_stage_state
{
53 uint32_t const_rd_length
;
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
);
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
);
71 struct gen_spec
*spec
;
72 struct gen_disasm
*disasm
;
73 enum drm_i915_gem_engine_class engine
;
75 struct aub_viewer_cfg
*cfg
;
76 struct aub_viewer_decode_cfg
*decode_cfg
;
78 uint64_t surface_base
;
79 uint64_t dynamic_base
;
80 uint64_t instruction_base
;
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
];
86 int n_batch_buffer_start
;
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 struct gen_spec
*spec
,
93 struct gen_disasm
*disasm
,
94 struct gen_batch_decode_bo (*get_bo
)(void *, bool, uint64_t),
95 unsigned (*get_state_size
)(void *, uint32_t),
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
);
102 #endif /* AUBINATOR_VIEWER_H */