xref: /aosp_15_r20/external/mesa3d/src/intel/decoder/intel_decoder.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard Worker /*
2*61046927SAndroid Build Coastguard Worker  * Copyright © 2016 Intel Corporation
3*61046927SAndroid Build Coastguard Worker  *
4*61046927SAndroid Build Coastguard Worker  * Permission is hereby granted, free of charge, to any person obtaining a
5*61046927SAndroid Build Coastguard Worker  * copy of this software and associated documentation files (the "Software"),
6*61046927SAndroid Build Coastguard Worker  * to deal in the Software without restriction, including without limitation
7*61046927SAndroid Build Coastguard Worker  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*61046927SAndroid Build Coastguard Worker  * and/or sell copies of the Software, and to permit persons to whom the
9*61046927SAndroid Build Coastguard Worker  * Software is furnished to do so, subject to the following conditions:
10*61046927SAndroid Build Coastguard Worker  *
11*61046927SAndroid Build Coastguard Worker  * The above copyright notice and this permission notice (including the next
12*61046927SAndroid Build Coastguard Worker  * paragraph) shall be included in all copies or substantial portions of the
13*61046927SAndroid Build Coastguard Worker  * Software.
14*61046927SAndroid Build Coastguard Worker  *
15*61046927SAndroid Build Coastguard Worker  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*61046927SAndroid Build Coastguard Worker  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*61046927SAndroid Build Coastguard Worker  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18*61046927SAndroid Build Coastguard Worker  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*61046927SAndroid Build Coastguard Worker  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20*61046927SAndroid Build Coastguard Worker  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21*61046927SAndroid Build Coastguard Worker  * IN THE SOFTWARE.
22*61046927SAndroid Build Coastguard Worker  */
23*61046927SAndroid Build Coastguard Worker 
24*61046927SAndroid Build Coastguard Worker #ifndef INTEL_DECODER_H
25*61046927SAndroid Build Coastguard Worker #define INTEL_DECODER_H
26*61046927SAndroid Build Coastguard Worker 
27*61046927SAndroid Build Coastguard Worker #include <stdint.h>
28*61046927SAndroid Build Coastguard Worker #include <stdbool.h>
29*61046927SAndroid Build Coastguard Worker #include <stdio.h>
30*61046927SAndroid Build Coastguard Worker 
31*61046927SAndroid Build Coastguard Worker #include "dev/intel_device_info.h"
32*61046927SAndroid Build Coastguard Worker #include "util/hash_table.h"
33*61046927SAndroid Build Coastguard Worker #include "util/bitset.h"
34*61046927SAndroid Build Coastguard Worker 
35*61046927SAndroid Build Coastguard Worker #include "common/intel_engine.h"
36*61046927SAndroid Build Coastguard Worker 
37*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
38*61046927SAndroid Build Coastguard Worker extern "C" {
39*61046927SAndroid Build Coastguard Worker #endif
40*61046927SAndroid Build Coastguard Worker 
41*61046927SAndroid Build Coastguard Worker struct intel_spec;
42*61046927SAndroid Build Coastguard Worker struct intel_group;
43*61046927SAndroid Build Coastguard Worker struct intel_field;
44*61046927SAndroid Build Coastguard Worker union intel_field_value;
45*61046927SAndroid Build Coastguard Worker 
46*61046927SAndroid Build Coastguard Worker #define INTEL_ENGINE_CLASS_TO_MASK(x) BITSET_BIT(x)
47*61046927SAndroid Build Coastguard Worker 
intel_make_gen(uint32_t major,uint32_t minor)48*61046927SAndroid Build Coastguard Worker static inline uint32_t intel_make_gen(uint32_t major, uint32_t minor)
49*61046927SAndroid Build Coastguard Worker {
50*61046927SAndroid Build Coastguard Worker    return (major << 8) | minor;
51*61046927SAndroid Build Coastguard Worker }
52*61046927SAndroid Build Coastguard Worker 
53*61046927SAndroid Build Coastguard Worker struct intel_group *intel_spec_find_struct(struct intel_spec *spec, const char *name);
54*61046927SAndroid Build Coastguard Worker struct intel_spec *intel_spec_load(const struct intel_device_info *devinfo);
55*61046927SAndroid Build Coastguard Worker struct intel_spec *
56*61046927SAndroid Build Coastguard Worker intel_spec_load_from_path(const struct intel_device_info *devinfo,
57*61046927SAndroid Build Coastguard Worker                           const char *path);
58*61046927SAndroid Build Coastguard Worker struct intel_spec *intel_spec_load_filename(const char *dir, const char *name);
59*61046927SAndroid Build Coastguard Worker void intel_spec_destroy(struct intel_spec *spec);
60*61046927SAndroid Build Coastguard Worker uint32_t intel_spec_get_gen(struct intel_spec *spec);
61*61046927SAndroid Build Coastguard Worker struct intel_group *intel_spec_find_instruction(struct intel_spec *spec,
62*61046927SAndroid Build Coastguard Worker                                                 enum intel_engine_class engine,
63*61046927SAndroid Build Coastguard Worker                                                 const uint32_t *p);
64*61046927SAndroid Build Coastguard Worker struct intel_group *intel_spec_find_register(struct intel_spec *spec, uint32_t offset);
65*61046927SAndroid Build Coastguard Worker struct intel_group *intel_spec_find_register_by_name(struct intel_spec *spec, const char *name);
66*61046927SAndroid Build Coastguard Worker struct intel_enum *intel_spec_find_enum(struct intel_spec *spec, const char *name);
67*61046927SAndroid Build Coastguard Worker 
68*61046927SAndroid Build Coastguard Worker int intel_group_get_length(const struct intel_group *group, const uint32_t *p);
69*61046927SAndroid Build Coastguard Worker const char *intel_group_get_name(const struct intel_group *group);
70*61046927SAndroid Build Coastguard Worker uint32_t intel_group_get_opcode(const struct intel_group *group);
71*61046927SAndroid Build Coastguard Worker struct intel_field *intel_group_find_field(struct intel_group *group, const char *name);
72*61046927SAndroid Build Coastguard Worker struct intel_enum *intel_spec_find_enum(struct intel_spec *spec, const char *name);
73*61046927SAndroid Build Coastguard Worker 
74*61046927SAndroid Build Coastguard Worker bool intel_field_is_header(struct intel_field *field);
75*61046927SAndroid Build Coastguard Worker 
76*61046927SAndroid Build Coastguard Worker /* Only allow 5 levels of subgroup'ing
77*61046927SAndroid Build Coastguard Worker  */
78*61046927SAndroid Build Coastguard Worker #define DECODE_MAX_ARRAY_DEPTH 5
79*61046927SAndroid Build Coastguard Worker 
80*61046927SAndroid Build Coastguard Worker struct intel_field_iterator {
81*61046927SAndroid Build Coastguard Worker    struct intel_group *group;
82*61046927SAndroid Build Coastguard Worker    char name[128];
83*61046927SAndroid Build Coastguard Worker    char value[128];
84*61046927SAndroid Build Coastguard Worker    uint64_t raw_value;
85*61046927SAndroid Build Coastguard Worker    struct intel_group *struct_desc;
86*61046927SAndroid Build Coastguard Worker    const uint32_t *p;
87*61046927SAndroid Build Coastguard Worker    int p_bit; /**< bit offset into p */
88*61046927SAndroid Build Coastguard Worker    const uint32_t *p_end;
89*61046927SAndroid Build Coastguard Worker    int start_bit; /**< current field starts at this bit offset into p */
90*61046927SAndroid Build Coastguard Worker    int end_bit; /**< current field ends at this bit offset into p */
91*61046927SAndroid Build Coastguard Worker 
92*61046927SAndroid Build Coastguard Worker    struct intel_field *fields[DECODE_MAX_ARRAY_DEPTH];
93*61046927SAndroid Build Coastguard Worker    struct intel_group *groups[DECODE_MAX_ARRAY_DEPTH];
94*61046927SAndroid Build Coastguard Worker    int array_iter[DECODE_MAX_ARRAY_DEPTH];
95*61046927SAndroid Build Coastguard Worker    int level;
96*61046927SAndroid Build Coastguard Worker 
97*61046927SAndroid Build Coastguard Worker    struct intel_field *field;
98*61046927SAndroid Build Coastguard Worker    bool print_colors;
99*61046927SAndroid Build Coastguard Worker };
100*61046927SAndroid Build Coastguard Worker 
101*61046927SAndroid Build Coastguard Worker struct intel_spec {
102*61046927SAndroid Build Coastguard Worker    uint32_t gen;
103*61046927SAndroid Build Coastguard Worker 
104*61046927SAndroid Build Coastguard Worker    struct hash_table *commands;
105*61046927SAndroid Build Coastguard Worker    struct hash_table *structs;
106*61046927SAndroid Build Coastguard Worker    struct hash_table *registers_by_name;
107*61046927SAndroid Build Coastguard Worker    struct hash_table *registers_by_offset;
108*61046927SAndroid Build Coastguard Worker    struct hash_table *enums;
109*61046927SAndroid Build Coastguard Worker 
110*61046927SAndroid Build Coastguard Worker    struct hash_table *access_cache;
111*61046927SAndroid Build Coastguard Worker };
112*61046927SAndroid Build Coastguard Worker 
113*61046927SAndroid Build Coastguard Worker struct intel_group {
114*61046927SAndroid Build Coastguard Worker    struct intel_spec *spec;
115*61046927SAndroid Build Coastguard Worker    char *name;
116*61046927SAndroid Build Coastguard Worker 
117*61046927SAndroid Build Coastguard Worker    struct intel_field *fields; /* linked list of fields */
118*61046927SAndroid Build Coastguard Worker    struct intel_field *dword_length_field; /* <instruction> specific */
119*61046927SAndroid Build Coastguard Worker 
120*61046927SAndroid Build Coastguard Worker    uint32_t dw_length;
121*61046927SAndroid Build Coastguard Worker    uint32_t engine_mask; /* <instruction> specific */
122*61046927SAndroid Build Coastguard Worker    uint32_t bias; /* <instruction> specific */
123*61046927SAndroid Build Coastguard Worker    uint32_t array_offset; /* <group> specific */
124*61046927SAndroid Build Coastguard Worker    uint32_t array_count; /* number of elements, <group> specific */
125*61046927SAndroid Build Coastguard Worker    uint32_t array_item_size; /* <group> specific */
126*61046927SAndroid Build Coastguard Worker    bool variable; /* <group> specific */
127*61046927SAndroid Build Coastguard Worker    bool fixed_length; /* True for <struct> & <register> */
128*61046927SAndroid Build Coastguard Worker 
129*61046927SAndroid Build Coastguard Worker    struct intel_group *parent;
130*61046927SAndroid Build Coastguard Worker    struct intel_group *next;
131*61046927SAndroid Build Coastguard Worker 
132*61046927SAndroid Build Coastguard Worker    uint32_t opcode_mask;
133*61046927SAndroid Build Coastguard Worker    uint32_t opcode;
134*61046927SAndroid Build Coastguard Worker 
135*61046927SAndroid Build Coastguard Worker    uint32_t register_offset; /* <register> specific */
136*61046927SAndroid Build Coastguard Worker };
137*61046927SAndroid Build Coastguard Worker 
138*61046927SAndroid Build Coastguard Worker struct intel_value {
139*61046927SAndroid Build Coastguard Worker    char *name;
140*61046927SAndroid Build Coastguard Worker    uint64_t value;
141*61046927SAndroid Build Coastguard Worker };
142*61046927SAndroid Build Coastguard Worker 
143*61046927SAndroid Build Coastguard Worker struct intel_enum {
144*61046927SAndroid Build Coastguard Worker    char *name;
145*61046927SAndroid Build Coastguard Worker    int nvalues;
146*61046927SAndroid Build Coastguard Worker    struct intel_value **values;
147*61046927SAndroid Build Coastguard Worker };
148*61046927SAndroid Build Coastguard Worker 
149*61046927SAndroid Build Coastguard Worker struct intel_type {
150*61046927SAndroid Build Coastguard Worker    enum {
151*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_UNKNOWN,
152*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_INT,
153*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_UINT,
154*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_BOOL,
155*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_FLOAT,
156*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_ADDRESS,
157*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_OFFSET,
158*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_STRUCT,
159*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_UFIXED,
160*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_SFIXED,
161*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_MBO,
162*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_MBZ,
163*61046927SAndroid Build Coastguard Worker       INTEL_TYPE_ENUM
164*61046927SAndroid Build Coastguard Worker    } kind;
165*61046927SAndroid Build Coastguard Worker 
166*61046927SAndroid Build Coastguard Worker    /* Struct definition for  INTEL_TYPE_STRUCT */
167*61046927SAndroid Build Coastguard Worker    union {
168*61046927SAndroid Build Coastguard Worker       struct intel_group *intel_struct;
169*61046927SAndroid Build Coastguard Worker       struct intel_enum *intel_enum;
170*61046927SAndroid Build Coastguard Worker       struct {
171*61046927SAndroid Build Coastguard Worker          /* Integer and fractional sizes for INTEL_TYPE_UFIXED and INTEL_TYPE_SFIXED */
172*61046927SAndroid Build Coastguard Worker          int i, f;
173*61046927SAndroid Build Coastguard Worker       };
174*61046927SAndroid Build Coastguard Worker    };
175*61046927SAndroid Build Coastguard Worker };
176*61046927SAndroid Build Coastguard Worker 
177*61046927SAndroid Build Coastguard Worker union intel_field_value {
178*61046927SAndroid Build Coastguard Worker    bool b32;
179*61046927SAndroid Build Coastguard Worker    float f32;
180*61046927SAndroid Build Coastguard Worker    uint64_t u64;
181*61046927SAndroid Build Coastguard Worker    int64_t i64;
182*61046927SAndroid Build Coastguard Worker };
183*61046927SAndroid Build Coastguard Worker 
184*61046927SAndroid Build Coastguard Worker struct intel_field {
185*61046927SAndroid Build Coastguard Worker    struct intel_group *parent;
186*61046927SAndroid Build Coastguard Worker    struct intel_field *next;
187*61046927SAndroid Build Coastguard Worker    struct intel_group *array;
188*61046927SAndroid Build Coastguard Worker 
189*61046927SAndroid Build Coastguard Worker    char *name;
190*61046927SAndroid Build Coastguard Worker    int start, end;
191*61046927SAndroid Build Coastguard Worker    struct intel_type type;
192*61046927SAndroid Build Coastguard Worker    bool has_default;
193*61046927SAndroid Build Coastguard Worker    uint32_t default_value;
194*61046927SAndroid Build Coastguard Worker 
195*61046927SAndroid Build Coastguard Worker    struct intel_enum inline_enum;
196*61046927SAndroid Build Coastguard Worker };
197*61046927SAndroid Build Coastguard Worker 
198*61046927SAndroid Build Coastguard Worker void intel_field_iterator_init(struct intel_field_iterator *iter,
199*61046927SAndroid Build Coastguard Worker                                struct intel_group *group,
200*61046927SAndroid Build Coastguard Worker                                const uint32_t *p, int p_bit,
201*61046927SAndroid Build Coastguard Worker                                bool print_colors);
202*61046927SAndroid Build Coastguard Worker 
203*61046927SAndroid Build Coastguard Worker bool intel_field_iterator_next(struct intel_field_iterator *iter);
204*61046927SAndroid Build Coastguard Worker 
205*61046927SAndroid Build Coastguard Worker void intel_print_group_custom_spacing(FILE *outfile, struct intel_group *group,
206*61046927SAndroid Build Coastguard Worker                                       uint64_t offset, const uint32_t *p,
207*61046927SAndroid Build Coastguard Worker                                       int p_bit, bool color,
208*61046927SAndroid Build Coastguard Worker                                       const char *spacing_reg,
209*61046927SAndroid Build Coastguard Worker                                       const char *spacing_dword);
210*61046927SAndroid Build Coastguard Worker void intel_print_group(FILE *out,
211*61046927SAndroid Build Coastguard Worker                        struct intel_group *group,
212*61046927SAndroid Build Coastguard Worker                        uint64_t offset, const uint32_t *p, int p_bit,
213*61046927SAndroid Build Coastguard Worker                        bool color);
214*61046927SAndroid Build Coastguard Worker 
215*61046927SAndroid Build Coastguard Worker enum intel_batch_decode_flags {
216*61046927SAndroid Build Coastguard Worker    /** Print in color! */
217*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_IN_COLOR    = (1 << 0),
218*61046927SAndroid Build Coastguard Worker    /** Print everything, not just headers */
219*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_FULL        = (1 << 1),
220*61046927SAndroid Build Coastguard Worker    /** Print offsets along with the batch */
221*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_OFFSETS     = (1 << 2),
222*61046927SAndroid Build Coastguard Worker    /** Guess when a value is a float and print it as such */
223*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_FLOATS      = (1 << 3),
224*61046927SAndroid Build Coastguard Worker    /** Print surface states */
225*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_SURFACES    = (1 << 4),
226*61046927SAndroid Build Coastguard Worker    /** Print sampler states */
227*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_SAMPLERS    = (1 << 5),
228*61046927SAndroid Build Coastguard Worker    /** Print accumulated state
229*61046927SAndroid Build Coastguard Worker     *
230*61046927SAndroid Build Coastguard Worker     *  Instead of printing instructions as we parse them, retain a pointer to
231*61046927SAndroid Build Coastguard Worker     *  each of the last instruction emitted and print it upon parsing one of
232*61046927SAndroid Build Coastguard Worker     *  the following instructions :
233*61046927SAndroid Build Coastguard Worker     *     - 3DPRIMITIVE
234*61046927SAndroid Build Coastguard Worker     *     - GPGPU_WALKER
235*61046927SAndroid Build Coastguard Worker     *     - 3DSTATE_WM_HZ_OP
236*61046927SAndroid Build Coastguard Worker     *     - COMPUTE_WALKER
237*61046927SAndroid Build Coastguard Worker     */
238*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_ACCUMULATE  = (1 << 6),
239*61046927SAndroid Build Coastguard Worker    /** Print vertex buffer data */
240*61046927SAndroid Build Coastguard Worker    INTEL_BATCH_DECODE_VB_DATA     = (1 << 7),
241*61046927SAndroid Build Coastguard Worker };
242*61046927SAndroid Build Coastguard Worker 
243*61046927SAndroid Build Coastguard Worker #define INTEL_BATCH_DECODE_DEFAULT_FLAGS \
244*61046927SAndroid Build Coastguard Worker    (INTEL_BATCH_DECODE_FULL |            \
245*61046927SAndroid Build Coastguard Worker     INTEL_BATCH_DECODE_OFFSETS |         \
246*61046927SAndroid Build Coastguard Worker     INTEL_BATCH_DECODE_FLOATS |          \
247*61046927SAndroid Build Coastguard Worker     INTEL_BATCH_DECODE_SURFACES |        \
248*61046927SAndroid Build Coastguard Worker     INTEL_BATCH_DECODE_SAMPLERS |        \
249*61046927SAndroid Build Coastguard Worker     INTEL_BATCH_DECODE_VB_DATA)
250*61046927SAndroid Build Coastguard Worker 
251*61046927SAndroid Build Coastguard Worker struct intel_batch_decode_bo {
252*61046927SAndroid Build Coastguard Worker    uint64_t addr;
253*61046927SAndroid Build Coastguard Worker    uint32_t size;
254*61046927SAndroid Build Coastguard Worker    const void *map;
255*61046927SAndroid Build Coastguard Worker };
256*61046927SAndroid Build Coastguard Worker 
257*61046927SAndroid Build Coastguard Worker struct intel_batch_decode_ctx {
258*61046927SAndroid Build Coastguard Worker    /**
259*61046927SAndroid Build Coastguard Worker     * Return information about the buffer containing the given address.
260*61046927SAndroid Build Coastguard Worker     *
261*61046927SAndroid Build Coastguard Worker     * If the given address is inside a buffer, the map pointer should be
262*61046927SAndroid Build Coastguard Worker     * offset accordingly so it points at the data corresponding to address.
263*61046927SAndroid Build Coastguard Worker     */
264*61046927SAndroid Build Coastguard Worker    struct intel_batch_decode_bo (*get_bo)(void *user_data, bool ppgtt, uint64_t address);
265*61046927SAndroid Build Coastguard Worker    unsigned (*get_state_size)(void *user_data,
266*61046927SAndroid Build Coastguard Worker                               uint64_t address,
267*61046927SAndroid Build Coastguard Worker                               uint64_t base_address);
268*61046927SAndroid Build Coastguard Worker 
269*61046927SAndroid Build Coastguard Worker    void (*shader_binary)(void *user_data,
270*61046927SAndroid Build Coastguard Worker                          const char *short_name,
271*61046927SAndroid Build Coastguard Worker                          uint64_t address,
272*61046927SAndroid Build Coastguard Worker                          const void *data,
273*61046927SAndroid Build Coastguard Worker                          unsigned data_length);
274*61046927SAndroid Build Coastguard Worker 
275*61046927SAndroid Build Coastguard Worker    void *user_data;
276*61046927SAndroid Build Coastguard Worker 
277*61046927SAndroid Build Coastguard Worker    FILE *fp;
278*61046927SAndroid Build Coastguard Worker    const struct brw_isa_info *brw;
279*61046927SAndroid Build Coastguard Worker    const struct elk_isa_info *elk;
280*61046927SAndroid Build Coastguard Worker    struct intel_device_info devinfo;
281*61046927SAndroid Build Coastguard Worker    struct intel_spec *spec;
282*61046927SAndroid Build Coastguard Worker    enum intel_batch_decode_flags flags;
283*61046927SAndroid Build Coastguard Worker 
284*61046927SAndroid Build Coastguard Worker    bool use_256B_binding_tables;
285*61046927SAndroid Build Coastguard Worker    uint64_t surface_base;
286*61046927SAndroid Build Coastguard Worker    uint64_t bt_pool_base;
287*61046927SAndroid Build Coastguard Worker    uint64_t dynamic_base;
288*61046927SAndroid Build Coastguard Worker    uint64_t instruction_base;
289*61046927SAndroid Build Coastguard Worker 
290*61046927SAndroid Build Coastguard Worker    int max_vbo_decoded_lines;
291*61046927SAndroid Build Coastguard Worker 
292*61046927SAndroid Build Coastguard Worker    enum intel_engine_class engine;
293*61046927SAndroid Build Coastguard Worker 
294*61046927SAndroid Build Coastguard Worker    int n_batch_buffer_start;
295*61046927SAndroid Build Coastguard Worker    uint64_t acthd;
296*61046927SAndroid Build Coastguard Worker 
297*61046927SAndroid Build Coastguard Worker    struct hash_table *commands;
298*61046927SAndroid Build Coastguard Worker    struct hash_table *stats;
299*61046927SAndroid Build Coastguard Worker 
300*61046927SAndroid Build Coastguard Worker    void (*disassemble_program)(struct intel_batch_decode_ctx *ctx,
301*61046927SAndroid Build Coastguard Worker                                uint32_t ksp,
302*61046927SAndroid Build Coastguard Worker                                const char *short_name,
303*61046927SAndroid Build Coastguard Worker                                const char *name);
304*61046927SAndroid Build Coastguard Worker };
305*61046927SAndroid Build Coastguard Worker 
306*61046927SAndroid Build Coastguard Worker void intel_batch_decode_ctx_init_brw(struct intel_batch_decode_ctx *ctx,
307*61046927SAndroid Build Coastguard Worker                                      const struct brw_isa_info *isa,
308*61046927SAndroid Build Coastguard Worker                                      const struct intel_device_info *devinfo,
309*61046927SAndroid Build Coastguard Worker                                      FILE *fp, enum intel_batch_decode_flags flags,
310*61046927SAndroid Build Coastguard Worker                                      const char *xml_path,
311*61046927SAndroid Build Coastguard Worker                                      struct intel_batch_decode_bo (*get_bo)(void *,
312*61046927SAndroid Build Coastguard Worker                                                                             bool,
313*61046927SAndroid Build Coastguard Worker                                                                             uint64_t),
314*61046927SAndroid Build Coastguard Worker                                      unsigned (*get_state_size)(void *, uint64_t,
315*61046927SAndroid Build Coastguard Worker                                                                 uint64_t),
316*61046927SAndroid Build Coastguard Worker                                      void *user_data);
317*61046927SAndroid Build Coastguard Worker void intel_batch_decode_ctx_init_elk(struct intel_batch_decode_ctx *ctx,
318*61046927SAndroid Build Coastguard Worker                                      const struct elk_isa_info *isa,
319*61046927SAndroid Build Coastguard Worker                                      const struct intel_device_info *devinfo,
320*61046927SAndroid Build Coastguard Worker                                      FILE *fp, enum intel_batch_decode_flags flags,
321*61046927SAndroid Build Coastguard Worker                                      const char *xml_path,
322*61046927SAndroid Build Coastguard Worker                                      struct intel_batch_decode_bo (*get_bo)(void *,
323*61046927SAndroid Build Coastguard Worker                                                                             bool,
324*61046927SAndroid Build Coastguard Worker                                                                             uint64_t),
325*61046927SAndroid Build Coastguard Worker                                      unsigned (*get_state_size)(void *, uint64_t,
326*61046927SAndroid Build Coastguard Worker                                                                 uint64_t),
327*61046927SAndroid Build Coastguard Worker                                      void *user_data);
328*61046927SAndroid Build Coastguard Worker void intel_batch_decode_ctx_finish(struct intel_batch_decode_ctx *ctx);
329*61046927SAndroid Build Coastguard Worker 
330*61046927SAndroid Build Coastguard Worker 
331*61046927SAndroid Build Coastguard Worker void intel_print_batch(struct intel_batch_decode_ctx *ctx,
332*61046927SAndroid Build Coastguard Worker                        const uint32_t *batch, uint32_t batch_size,
333*61046927SAndroid Build Coastguard Worker                        uint64_t batch_addr, bool from_ring);
334*61046927SAndroid Build Coastguard Worker 
335*61046927SAndroid Build Coastguard Worker void intel_batch_stats_reset(struct intel_batch_decode_ctx *ctx);
336*61046927SAndroid Build Coastguard Worker 
337*61046927SAndroid Build Coastguard Worker void intel_batch_stats(struct intel_batch_decode_ctx *ctx,
338*61046927SAndroid Build Coastguard Worker                        const uint32_t *batch, uint32_t batch_size,
339*61046927SAndroid Build Coastguard Worker                        uint64_t batch_addr, bool from_ring);
340*61046927SAndroid Build Coastguard Worker 
341*61046927SAndroid Build Coastguard Worker void intel_batch_print_stats(struct intel_batch_decode_ctx *ctx);
342*61046927SAndroid Build Coastguard Worker 
343*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus
344*61046927SAndroid Build Coastguard Worker }
345*61046927SAndroid Build Coastguard Worker #endif
346*61046927SAndroid Build Coastguard Worker 
347*61046927SAndroid Build Coastguard Worker 
348*61046927SAndroid Build Coastguard Worker #endif /* INTEL_DECODER_H */
349