2 * Copyright (C) 2017-2019 Alyssa Rosenzweig
3 * Copyright (C) 2017-2019 Connor Abbott
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 #include <panfrost-job.h>
33 #include "../pan_pretty_print.h"
34 #include "../midgard/disassemble.h"
35 int pandecode_replay_jc(mali_ptr jc_gpu_va
, bool bifrost
);
37 #define MEMORY_PROP(obj, p) {\
38 char *a = pointer_as_memory_reference(obj->p); \
39 pandecode_prop("%s = %s", #p, a); \
43 #define MEMORY_COMMENT(obj, p) {\
44 char *a = pointer_as_memory_reference(obj->p); \
45 pandecode_msg("%s = %s\n", #p, a); \
49 #define DYN_MEMORY_PROP(obj, no, p) { \
51 pandecode_prop("%s = %s_%d_p", #p, #p, no); \
54 /* Semantic logging type.
56 * Raw: for raw messages to be printed as is.
57 * Message: for helpful information to be commented out in replays.
58 * Property: for properties of a struct
60 * Use one of pandecode_log, pandecode_msg, or pandecode_prop as syntax sugar.
63 enum pandecode_log_type
{
69 #define pandecode_log(...) pandecode_log_typed(PANDECODE_RAW, __VA_ARGS__)
70 #define pandecode_msg(...) pandecode_log_typed(PANDECODE_MESSAGE, __VA_ARGS__)
71 #define pandecode_prop(...) pandecode_log_typed(PANDECODE_PROPERTY, __VA_ARGS__)
73 unsigned pandecode_indent
= 0;
76 pandecode_make_indent(void)
78 for (unsigned i
= 0; i
< pandecode_indent
; ++i
)
83 pandecode_log_typed(enum pandecode_log_type type
, const char *format
, ...)
87 pandecode_make_indent();
89 if (type
== PANDECODE_MESSAGE
)
91 else if (type
== PANDECODE_PROPERTY
)
98 if (type
== PANDECODE_PROPERTY
)
103 pandecode_log_cont(const char *format
, ...)
107 va_start(ap
, format
);
112 struct pandecode_flag_info
{
118 pandecode_log_decoded_flags(const struct pandecode_flag_info
*flag_info
,
121 bool decodable_flags_found
= false;
123 for (int i
= 0; flag_info
[i
].name
; i
++) {
124 if ((flags
& flag_info
[i
].flag
) != flag_info
[i
].flag
)
127 if (!decodable_flags_found
) {
128 decodable_flags_found
= true;
130 pandecode_log_cont(" | ");
133 pandecode_log_cont("%s", flag_info
[i
].name
);
135 flags
&= ~flag_info
[i
].flag
;
138 if (decodable_flags_found
) {
140 pandecode_log_cont(" | 0x%" PRIx64
, flags
);
142 pandecode_log_cont("0x%" PRIx64
, flags
);
146 #define FLAG_INFO(flag) { MALI_##flag, "MALI_" #flag }
147 static const struct pandecode_flag_info gl_enable_flag_info
[] = {
148 FLAG_INFO(CULL_FACE_FRONT
),
149 FLAG_INFO(CULL_FACE_BACK
),
150 FLAG_INFO(OCCLUSION_QUERY
),
151 FLAG_INFO(OCCLUSION_PRECISE
),
156 #define FLAG_INFO(flag) { MALI_CLEAR_##flag, "MALI_CLEAR_" #flag }
157 static const struct pandecode_flag_info clear_flag_info
[] = {
160 FLAG_INFO(SLOW_STENCIL
),
165 #define FLAG_INFO(flag) { MALI_MASK_##flag, "MALI_MASK_" #flag }
166 static const struct pandecode_flag_info mask_flag_info
[] = {
175 #define FLAG_INFO(flag) { MALI_##flag, "MALI_" #flag }
176 static const struct pandecode_flag_info u3_flag_info
[] = {
178 FLAG_INFO(CAN_DISCARD
),
179 FLAG_INFO(HAS_BLEND_SHADER
),
180 FLAG_INFO(DEPTH_TEST
),
184 static const struct pandecode_flag_info u4_flag_info
[] = {
186 FLAG_INFO(NO_DITHER
),
187 FLAG_INFO(DEPTH_RANGE_A
),
188 FLAG_INFO(DEPTH_RANGE_B
),
189 FLAG_INFO(STENCIL_TEST
),
190 FLAG_INFO(SAMPLE_ALPHA_TO_COVERAGE_NO_BLEND_SHADER
),
195 #define FLAG_INFO(flag) { MALI_FRAMEBUFFER_##flag, "MALI_FRAMEBUFFER_" #flag }
196 static const struct pandecode_flag_info fb_fmt_flag_info
[] = {
204 #define FLAG_INFO(flag) { MALI_MFBD_FORMAT_##flag, "MALI_MFBD_FORMAT_" #flag }
205 static const struct pandecode_flag_info mfbd_fmt_flag_info
[] = {
212 #define FLAG_INFO(flag) { MALI_EXTRA_##flag, "MALI_EXTRA_" #flag }
213 static const struct pandecode_flag_info mfbd_extra_flag_info
[] = {
221 #define FLAG_INFO(flag) { MALI_##flag, "MALI_" #flag }
222 static const struct pandecode_flag_info shader_unknown1_flag_info
[] = {
223 FLAG_INFO(NO_ALPHA_TO_COVERAGE
),
224 FLAG_INFO(READS_TILEBUFFER
),
230 extern char *replace_fragment
;
231 extern char *replace_vertex
;
234 pandecode_job_type_name(enum mali_job_type type
)
236 #define DEFINE_CASE(name) case JOB_TYPE_ ## name: return "JOB_TYPE_" #name
240 DEFINE_CASE(SET_VALUE
);
241 DEFINE_CASE(CACHE_FLUSH
);
242 DEFINE_CASE(COMPUTE
);
246 DEFINE_CASE(FRAGMENT
);
248 case JOB_NOT_STARTED
:
249 return "NOT_STARTED";
252 pandecode_log("Warning! Unknown job type %x\n", type
);
260 pandecode_draw_mode_name(enum mali_draw_mode mode
)
262 #define DEFINE_CASE(name) case MALI_ ## name: return "MALI_" #name
265 DEFINE_CASE(DRAW_NONE
);
268 DEFINE_CASE(TRIANGLES
);
269 DEFINE_CASE(TRIANGLE_STRIP
);
270 DEFINE_CASE(TRIANGLE_FAN
);
271 DEFINE_CASE(LINE_STRIP
);
272 DEFINE_CASE(LINE_LOOP
);
273 DEFINE_CASE(POLYGON
);
275 DEFINE_CASE(QUAD_STRIP
);
278 return "MALI_TRIANGLES /* XXX: Unknown GL mode, check dump */";
284 #define DEFINE_CASE(name) case MALI_FUNC_ ## name: return "MALI_FUNC_" #name
286 pandecode_func_name(enum mali_func mode
)
293 DEFINE_CASE(GREATER
);
294 DEFINE_CASE(NOTEQUAL
);
299 return "MALI_FUNC_NEVER /* XXX: Unknown function, check dump */";
304 /* Why is this duplicated? Who knows... */
305 #define DEFINE_CASE(name) case MALI_ALT_FUNC_ ## name: return "MALI_ALT_FUNC_" #name
307 pandecode_alt_func_name(enum mali_alt_func mode
)
314 DEFINE_CASE(GREATER
);
315 DEFINE_CASE(NOTEQUAL
);
320 return "MALI_FUNC_NEVER /* XXX: Unknown function, check dump */";
325 #define DEFINE_CASE(name) case MALI_STENCIL_ ## name: return "MALI_STENCIL_" #name
327 pandecode_stencil_op_name(enum mali_stencil_op op
)
331 DEFINE_CASE(REPLACE
);
334 DEFINE_CASE(INCR_WRAP
);
335 DEFINE_CASE(DECR_WRAP
);
340 return "MALI_STENCIL_KEEP /* XXX: Unknown stencil op, check dump */";
346 #define DEFINE_CASE(name) case MALI_ATTR_ ## name: return "MALI_ATTR_" #name
347 static char *pandecode_attr_mode_name(enum mali_attr_mode mode
)
352 DEFINE_CASE(POT_DIVIDE
);
354 DEFINE_CASE(NPOT_DIVIDE
);
355 default: return "MALI_ATTR_UNUSED /* XXX: Unknown stencil op, check dump */";
361 #define DEFINE_CASE(name) case MALI_CHANNEL_## name: return "MALI_CHANNEL_" #name
363 pandecode_channel_name(enum mali_channel channel
)
372 DEFINE_CASE(RESERVED_0
);
373 DEFINE_CASE(RESERVED_1
);
376 return "MALI_CHANNEL_ZERO /* XXX: Unknown channel, check dump */";
381 #define DEFINE_CASE(name) case MALI_WRAP_## name: return "MALI_WRAP_" #name
383 pandecode_wrap_mode_name(enum mali_wrap_mode op
)
387 DEFINE_CASE(CLAMP_TO_EDGE
);
388 DEFINE_CASE(CLAMP_TO_BORDER
);
389 DEFINE_CASE(MIRRORED_REPEAT
);
392 return "MALI_WRAP_REPEAT /* XXX: Unknown wrap mode, check dump */";
398 pandecode_decode_fbd_type(enum mali_fbd_type type
)
400 if (type
== MALI_SFBD
) return "SFBD";
401 else if (type
== MALI_MFBD
) return "MFBD";
402 else return "WATFBD /* XXX */";
406 pandecode_replay_sfbd(uint64_t gpu_va
, int job_no
)
408 struct pandecode_mapped_memory
*mem
= pandecode_find_mapped_gpu_mem_containing(gpu_va
);
409 const struct mali_single_framebuffer
*PANDECODE_PTR_VAR(s
, mem
, (mali_ptr
) gpu_va
);
411 pandecode_log("struct mali_single_framebuffer framebuffer_%d = {\n", job_no
);
414 pandecode_prop("unknown1 = 0x%" PRIx32
, s
->unknown1
);
415 pandecode_prop("unknown2 = 0x%" PRIx32
, s
->unknown2
);
417 pandecode_log(".format = ");
418 pandecode_log_decoded_flags(fb_fmt_flag_info
, s
->format
);
419 pandecode_log_cont(",\n");
421 pandecode_prop("width = MALI_POSITIVE(%" PRId16
")", s
->width
+ 1);
422 pandecode_prop("height = MALI_POSITIVE(%" PRId16
")", s
->height
+ 1);
424 MEMORY_PROP(s
, framebuffer
);
425 pandecode_prop("stride = %d", s
->stride
);
427 /* Earlier in the actual commandstream -- right before width -- but we
428 * delay to flow nicer */
430 pandecode_log(".clear_flags = ");
431 pandecode_log_decoded_flags(clear_flag_info
, s
->clear_flags
);
432 pandecode_log_cont(",\n");
434 if (s
->depth_buffer
| s
->depth_buffer_enable
) {
435 MEMORY_PROP(s
, depth_buffer
);
436 pandecode_prop("depth_buffer_enable = %s", DS_ENABLE(s
->depth_buffer_enable
));
439 if (s
->stencil_buffer
| s
->stencil_buffer_enable
) {
440 MEMORY_PROP(s
, stencil_buffer
);
441 pandecode_prop("stencil_buffer_enable = %s", DS_ENABLE(s
->stencil_buffer_enable
));
444 if (s
->clear_color_1
| s
->clear_color_2
| s
->clear_color_3
| s
->clear_color_4
) {
445 pandecode_prop("clear_color_1 = 0x%" PRIx32
, s
->clear_color_1
);
446 pandecode_prop("clear_color_2 = 0x%" PRIx32
, s
->clear_color_2
);
447 pandecode_prop("clear_color_3 = 0x%" PRIx32
, s
->clear_color_3
);
448 pandecode_prop("clear_color_4 = 0x%" PRIx32
, s
->clear_color_4
);
451 if (s
->clear_depth_1
!= 0 || s
->clear_depth_2
!= 0 || s
->clear_depth_3
!= 0 || s
->clear_depth_4
!= 0) {
452 pandecode_prop("clear_depth_1 = %f", s
->clear_depth_1
);
453 pandecode_prop("clear_depth_2 = %f", s
->clear_depth_2
);
454 pandecode_prop("clear_depth_3 = %f", s
->clear_depth_3
);
455 pandecode_prop("clear_depth_4 = %f", s
->clear_depth_4
);
458 if (s
->clear_stencil
) {
459 pandecode_prop("clear_stencil = 0x%x", s
->clear_stencil
);
462 MEMORY_PROP(s
, unknown_address_0
);
463 MEMORY_PROP(s
, unknown_address_1
);
464 MEMORY_PROP(s
, unknown_address_2
);
466 pandecode_prop("resolution_check = 0x%" PRIx32
, s
->resolution_check
);
467 pandecode_prop("tiler_flags = 0x%" PRIx32
, s
->tiler_flags
);
469 MEMORY_PROP(s
, tiler_heap_free
);
470 MEMORY_PROP(s
, tiler_heap_end
);
473 pandecode_log("};\n");
475 pandecode_prop("zero0 = 0x%" PRIx64
, s
->zero0
);
476 pandecode_prop("zero1 = 0x%" PRIx64
, s
->zero1
);
477 pandecode_prop("zero2 = 0x%" PRIx32
, s
->zero2
);
478 pandecode_prop("zero4 = 0x%" PRIx32
, s
->zero4
);
480 printf(".zero3 = {");
482 for (int i
= 0; i
< sizeof(s
->zero3
) / sizeof(s
->zero3
[0]); ++i
)
483 printf("%X, ", s
->zero3
[i
]);
487 printf(".zero6 = {");
489 for (int i
= 0; i
< sizeof(s
->zero6
) / sizeof(s
->zero6
[0]); ++i
)
490 printf("%X, ", s
->zero6
[i
]);
496 pandecode_replay_swizzle(unsigned swizzle
)
498 pandecode_prop("swizzle = %s | (%s << 3) | (%s << 6) | (%s << 9)",
499 pandecode_channel_name((swizzle
>> 0) & 0x7),
500 pandecode_channel_name((swizzle
>> 3) & 0x7),
501 pandecode_channel_name((swizzle
>> 6) & 0x7),
502 pandecode_channel_name((swizzle
>> 9) & 0x7));
506 pandecode_rt_format(struct mali_rt_format format
)
508 pandecode_log(".format = {\n");
511 pandecode_prop("unk1 = 0x%" PRIx32
, format
.unk1
);
512 pandecode_prop("unk2 = 0x%" PRIx32
, format
.unk2
);
514 pandecode_prop("nr_channels = MALI_POSITIVE(%d)",
515 MALI_NEGATIVE(format
.nr_channels
));
517 pandecode_log(".flags = ");
518 pandecode_log_decoded_flags(mfbd_fmt_flag_info
, format
.flags
);
519 pandecode_log_cont(",\n");
521 pandecode_replay_swizzle(format
.swizzle
);
523 pandecode_prop("unk4 = 0x%" PRIx32
, format
.unk4
);
526 pandecode_log("},\n");
530 pandecode_replay_mfbd_bfr(uint64_t gpu_va
, int job_no
)
532 struct pandecode_mapped_memory
*mem
= pandecode_find_mapped_gpu_mem_containing(gpu_va
);
533 const struct bifrost_framebuffer
*PANDECODE_PTR_VAR(fb
, mem
, (mali_ptr
) gpu_va
);
535 if (fb
->sample_locations
) {
536 /* The blob stores all possible sample locations in a single buffer
537 * allocated on startup, and just switches the pointer when switching
538 * MSAA state. For now, we just put the data into the cmdstream, but we
539 * should do something like what the blob does with a real driver.
541 * There seem to be 32 slots for sample locations, followed by another
542 * 16. The second 16 is just the center location followed by 15 zeros
543 * in all the cases I've identified (maybe shader vs. depth/color
547 struct pandecode_mapped_memory
*smem
= pandecode_find_mapped_gpu_mem_containing(fb
->sample_locations
);
549 const u16
*PANDECODE_PTR_VAR(samples
, smem
, fb
->sample_locations
);
551 pandecode_log("uint16_t sample_locations_%d[] = {\n", job_no
);
554 for (int i
= 0; i
< 32 + 16; i
++) {
555 pandecode_log("%d, %d,\n", samples
[2 * i
], samples
[2 * i
+ 1]);
559 pandecode_log("};\n");
562 pandecode_log("struct bifrost_framebuffer framebuffer_%d = {\n", job_no
);
565 pandecode_prop("unk0 = 0x%x", fb
->unk0
);
567 if (fb
->sample_locations
)
568 pandecode_prop("sample_locations = sample_locations_%d", job_no
);
570 /* Assume that unknown1 and tiler_meta were emitted in the last job for
572 /*pandecode_prop("unknown1 = unknown1_%d_p", job_no - 1);
573 pandecode_prop("tiler_meta = tiler_meta_%d_p", job_no - 1);*/
574 MEMORY_PROP(fb
, unknown1
);
575 MEMORY_PROP(fb
, tiler_meta
);
577 pandecode_prop("width1 = MALI_POSITIVE(%d)", fb
->width1
+ 1);
578 pandecode_prop("height1 = MALI_POSITIVE(%d)", fb
->height1
+ 1);
579 pandecode_prop("width2 = MALI_POSITIVE(%d)", fb
->width2
+ 1);
580 pandecode_prop("height2 = MALI_POSITIVE(%d)", fb
->height2
+ 1);
582 pandecode_prop("unk1 = 0x%x", fb
->unk1
);
583 pandecode_prop("unk2 = 0x%x", fb
->unk2
);
584 pandecode_prop("rt_count_1 = MALI_POSITIVE(%d)", fb
->rt_count_1
+ 1);
585 pandecode_prop("rt_count_2 = %d", fb
->rt_count_2
);
587 pandecode_prop("unk3 = 0x%x", fb
->unk3
);
588 pandecode_prop("clear_stencil = 0x%x", fb
->clear_stencil
);
589 pandecode_prop("clear_depth = %f", fb
->clear_depth
);
591 pandecode_prop("unknown2 = 0x%x", fb
->unknown2
);
592 MEMORY_PROP(fb
, scratchpad
);
593 MEMORY_PROP(fb
, tiler_scratch_start
);
594 MEMORY_PROP(fb
, tiler_scratch_middle
);
595 MEMORY_PROP(fb
, tiler_heap_start
);
596 MEMORY_PROP(fb
, tiler_heap_end
);
598 if (fb
->zero3
|| fb
->zero4
|| fb
->zero9
|| fb
->zero10
|| fb
->zero11
|| fb
->zero12
) {
599 pandecode_msg("framebuffer zeros tripped\n");
600 pandecode_prop("zero3 = 0x%" PRIx32
, fb
->zero3
);
601 pandecode_prop("zero4 = 0x%" PRIx32
, fb
->zero4
);
602 pandecode_prop("zero9 = 0x%" PRIx64
, fb
->zero9
);
603 pandecode_prop("zero10 = 0x%" PRIx64
, fb
->zero10
);
604 pandecode_prop("zero11 = 0x%" PRIx64
, fb
->zero11
);
605 pandecode_prop("zero12 = 0x%" PRIx64
, fb
->zero12
);
609 pandecode_log("};\n");
611 gpu_va
+= sizeof(struct bifrost_framebuffer
);
613 if (fb
->unk3
& MALI_MFBD_EXTRA
) {
614 mem
= pandecode_find_mapped_gpu_mem_containing(gpu_va
);
615 const struct bifrost_fb_extra
*PANDECODE_PTR_VAR(fbx
, mem
, (mali_ptr
) gpu_va
);
617 pandecode_log("struct bifrost_fb_extra fb_extra_%d = {\n", job_no
);
620 MEMORY_PROP(fbx
, checksum
);
622 if (fbx
->checksum_stride
)
623 pandecode_prop("checksum_stride = %d", fbx
->checksum_stride
);
625 pandecode_log(".flags = ");
626 pandecode_log_decoded_flags(mfbd_extra_flag_info
, fbx
->flags
);
627 pandecode_log_cont(",\n");
629 if (fbx
->flags
& MALI_EXTRA_AFBC_ZS
) {
630 pandecode_log(".ds_afbc = {\n");
633 MEMORY_PROP((&fbx
->ds_afbc
), depth_stencil_afbc_metadata
);
634 pandecode_prop("depth_stencil_afbc_stride = %d",
635 fbx
->ds_afbc
.depth_stencil_afbc_stride
);
636 MEMORY_PROP((&fbx
->ds_afbc
), depth_stencil
);
638 if (fbx
->ds_afbc
.zero1
|| fbx
->ds_afbc
.padding
) {
639 pandecode_msg("Depth/stencil AFBC zeros tripped\n");
640 pandecode_prop("zero1 = 0x%" PRIx32
,
642 pandecode_prop("padding = 0x%" PRIx64
,
643 fbx
->ds_afbc
.padding
);
647 pandecode_log("},\n");
649 pandecode_log(".ds_linear = {\n");
652 if (fbx
->ds_linear
.depth
) {
653 MEMORY_PROP((&fbx
->ds_linear
), depth
);
654 pandecode_prop("depth_stride = %d",
655 fbx
->ds_linear
.depth_stride
);
658 if (fbx
->ds_linear
.stencil
) {
659 MEMORY_PROP((&fbx
->ds_linear
), stencil
);
660 pandecode_prop("stencil_stride = %d",
661 fbx
->ds_linear
.stencil_stride
);
664 if (fbx
->ds_linear
.depth_stride_zero
||
665 fbx
->ds_linear
.stencil_stride_zero
||
666 fbx
->ds_linear
.zero1
|| fbx
->ds_linear
.zero2
) {
667 pandecode_msg("Depth/stencil zeros tripped\n");
668 pandecode_prop("depth_stride_zero = 0x%x",
669 fbx
->ds_linear
.depth_stride_zero
);
670 pandecode_prop("stencil_stride_zero = 0x%x",
671 fbx
->ds_linear
.stencil_stride_zero
);
672 pandecode_prop("zero1 = 0x%" PRIx32
,
673 fbx
->ds_linear
.zero1
);
674 pandecode_prop("zero2 = 0x%" PRIx32
,
675 fbx
->ds_linear
.zero2
);
679 pandecode_log("},\n");
682 if (fbx
->zero3
|| fbx
->zero4
) {
683 pandecode_msg("fb_extra zeros tripped\n");
684 pandecode_prop("zero3 = 0x%" PRIx64
, fbx
->zero3
);
685 pandecode_prop("zero4 = 0x%" PRIx64
, fbx
->zero4
);
689 pandecode_log("};\n");
691 gpu_va
+= sizeof(struct bifrost_fb_extra
);
694 pandecode_log("struct bifrost_render_target rts_list_%d[] = {\n", job_no
);
697 for (int i
= 0; i
< MALI_NEGATIVE(fb
->rt_count_1
); i
++) {
698 mali_ptr rt_va
= gpu_va
+ i
* sizeof(struct bifrost_render_target
);
699 mem
= pandecode_find_mapped_gpu_mem_containing(rt_va
);
700 const struct bifrost_render_target
*PANDECODE_PTR_VAR(rt
, mem
, (mali_ptr
) rt_va
);
702 pandecode_log("{\n");
705 pandecode_rt_format(rt
->format
);
707 /* TODO: How the actual heck does AFBC enabling work here? */
709 pandecode_log(".afbc = {\n");
712 char *a
= pointer_as_memory_reference(rt
->afbc
.metadata
);
713 pandecode_prop("metadata = %s", a
);
716 pandecode_prop("stride = %d", rt
->afbc
.stride
);
717 pandecode_prop("unk = 0x%" PRIx32
, rt
->afbc
.unk
);
720 pandecode_log("},\n");
722 pandecode_log(".chunknown = {\n");
725 pandecode_prop("unk = 0x%" PRIx64
, rt
->chunknown
.unk
);
727 char *a
= pointer_as_memory_reference(rt
->chunknown
.pointer
);
728 pandecode_prop("pointer = %s", a
);
732 pandecode_log("},\n");
735 MEMORY_PROP(rt
, framebuffer
);
736 pandecode_prop("framebuffer_stride = %d", rt
->framebuffer_stride
);
738 if (rt
->clear_color_1
| rt
->clear_color_2
| rt
->clear_color_3
| rt
->clear_color_4
) {
739 pandecode_prop("clear_color_1 = 0x%" PRIx32
, rt
->clear_color_1
);
740 pandecode_prop("clear_color_2 = 0x%" PRIx32
, rt
->clear_color_2
);
741 pandecode_prop("clear_color_3 = 0x%" PRIx32
, rt
->clear_color_3
);
742 pandecode_prop("clear_color_4 = 0x%" PRIx32
, rt
->clear_color_4
);
745 if (rt
->zero1
|| rt
->zero2
|| rt
->zero3
) {
746 pandecode_msg("render target zeros tripped\n");
747 pandecode_prop("zero1 = 0x%" PRIx64
, rt
->zero1
);
748 pandecode_prop("zero2 = 0x%" PRIx32
, rt
->zero2
);
749 pandecode_prop("zero3 = 0x%" PRIx32
, rt
->zero3
);
753 pandecode_log("},\n");
757 pandecode_log("};\n");
761 pandecode_replay_attributes(const struct pandecode_mapped_memory
*mem
,
762 mali_ptr addr
, int job_no
, char *suffix
,
763 int count
, bool varying
)
765 char *prefix
= varying
? "varyings" : "attributes";
767 union mali_attr
*attr
= pandecode_fetch_gpu_mem(mem
, addr
, sizeof(union mali_attr
) * count
);
770 snprintf(base
, sizeof(base
), "%s_data_%d%s", prefix
, job_no
, suffix
);
772 for (int i
= 0; i
< count
; ++i
) {
773 enum mali_attr_mode mode
= attr
[i
].elements
& 7;
775 if (mode
== MALI_ATTR_UNUSED
)
778 mali_ptr raw_elements
= attr
[i
].elements
& ~7;
780 /* TODO: Do we maybe want to dump the attribute values
781 * themselves given the specified format? Or is that too hard?
784 char *a
= pointer_as_memory_reference(raw_elements
);
785 pandecode_log("mali_ptr %s_%d_p = %s;\n", base
, i
, a
);
789 pandecode_log("union mali_attr %s_%d[] = {\n", prefix
, job_no
);
792 for (int i
= 0; i
< count
; ++i
) {
793 pandecode_log("{\n");
796 pandecode_prop("elements = (%s_%d_p) | %s", base
, i
, pandecode_attr_mode_name(attr
[i
].elements
& 7));
797 pandecode_prop("shift = %d", attr
[i
].shift
);
798 pandecode_prop("extra_flags = %d", attr
[i
].extra_flags
);
799 pandecode_prop("stride = 0x%" PRIx32
, attr
[i
].stride
);
800 pandecode_prop("size = 0x%" PRIx32
, attr
[i
].size
);
802 pandecode_log("}, \n");
804 if ((attr
[i
].elements
& 7) == MALI_ATTR_NPOT_DIVIDE
) {
806 pandecode_log("{\n");
808 pandecode_prop("unk = 0x%x", attr
[i
].unk
);
809 pandecode_prop("magic_divisor = 0x%08x", attr
[i
].magic_divisor
);
810 if (attr
[i
].zero
!= 0)
811 pandecode_prop("zero = 0x%x /* XXX zero tripped */", attr
[i
].zero
);
812 pandecode_prop("divisor = %d", attr
[i
].divisor
);
814 pandecode_log("}, \n");
820 pandecode_log("};\n");
824 pandecode_replay_shader_address(const char *name
, mali_ptr ptr
)
826 /* TODO: Decode flags */
827 mali_ptr shader_ptr
= ptr
& ~15;
829 char *a
= pointer_as_memory_reference(shader_ptr
);
830 pandecode_prop("%s = (%s) | %d", name
, a
, (int) (ptr
& 15));
837 pandecode_replay_stencil(const char *name
, const struct mali_stencil_test
*stencil
)
839 const char *func
= pandecode_func_name(stencil
->func
);
840 const char *sfail
= pandecode_stencil_op_name(stencil
->sfail
);
841 const char *dpfail
= pandecode_stencil_op_name(stencil
->dpfail
);
842 const char *dppass
= pandecode_stencil_op_name(stencil
->dppass
);
845 pandecode_msg("Stencil zero tripped: %X\n", stencil
->zero
);
847 pandecode_log(".stencil_%s = {\n", name
);
849 pandecode_prop("ref = %d", stencil
->ref
);
850 pandecode_prop("mask = 0x%02X", stencil
->mask
);
851 pandecode_prop("func = %s", func
);
852 pandecode_prop("sfail = %s", sfail
);
853 pandecode_prop("dpfail = %s", dpfail
);
854 pandecode_prop("dppass = %s", dppass
);
856 pandecode_log("},\n");
860 pandecode_replay_blend_equation(const struct mali_blend_equation
*blend
, const char *suffix
)
863 pandecode_msg("Blend zero tripped: %X\n", blend
->zero1
);
865 pandecode_log(".blend_equation%s = {\n", suffix
);
868 pandecode_prop("rgb_mode = 0x%X", blend
->rgb_mode
);
869 pandecode_prop("alpha_mode = 0x%X", blend
->alpha_mode
);
871 pandecode_log(".color_mask = ");
872 pandecode_log_decoded_flags(mask_flag_info
, blend
->color_mask
);
873 pandecode_log_cont(",\n");
876 pandecode_log("},\n");
880 pandecode_replay_attribute_meta(int job_no
, int count
, const struct mali_vertex_tiler_postfix
*v
, bool varying
, char *suffix
)
883 char *prefix
= varying
? "varying" : "attribute";
884 unsigned max_index
= 0;
885 snprintf(base
, sizeof(base
), "%s_meta", prefix
);
887 pandecode_log("struct mali_attr_meta %s_%d%s[] = {\n", base
, job_no
, suffix
);
890 struct mali_attr_meta
*attr_meta
;
891 mali_ptr p
= varying
? (v
->varying_meta
& ~0xF) : v
->attribute_meta
;
893 struct pandecode_mapped_memory
*attr_mem
= pandecode_find_mapped_gpu_mem_containing(p
);
895 for (int i
= 0; i
< count
; ++i
, p
+= sizeof(struct mali_attr_meta
)) {
896 attr_meta
= pandecode_fetch_gpu_mem(attr_mem
, p
,
899 pandecode_log("{\n");
901 pandecode_prop("index = %d", attr_meta
->index
);
903 if (attr_meta
->index
> max_index
)
904 max_index
= attr_meta
->index
;
905 pandecode_replay_swizzle(attr_meta
->swizzle
);
906 pandecode_prop("format = %s", pandecode_format_name(attr_meta
->format
));
908 pandecode_prop("unknown1 = 0x%" PRIx64
, (u64
) attr_meta
->unknown1
);
909 pandecode_prop("unknown3 = 0x%" PRIx64
, (u64
) attr_meta
->unknown3
);
910 pandecode_prop("src_offset = 0x%" PRIx64
, (u64
) attr_meta
->src_offset
);
912 pandecode_log("},\n");
917 pandecode_log("};\n");
923 pandecode_replay_indices(uintptr_t pindices
, uint32_t index_count
, int job_no
)
925 struct pandecode_mapped_memory
*imem
= pandecode_find_mapped_gpu_mem_containing(pindices
);
928 /* Indices are literally just a u32 array :) */
930 uint32_t *PANDECODE_PTR_VAR(indices
, imem
, pindices
);
932 pandecode_log("uint32_t indices_%d[] = {\n", job_no
);
935 for (unsigned i
= 0; i
< (index_count
+ 1); i
+= 3)
936 pandecode_log("%d, %d, %d,\n",
942 pandecode_log("};\n");
946 /* return bits [lo, hi) of word */
948 bits(u32 word
, u32 lo
, u32 hi
)
951 return word
; // avoid undefined behavior with the shift
953 return (word
>> lo
) & ((1 << (hi
- lo
)) - 1);
957 pandecode_replay_vertex_tiler_prefix(struct mali_vertex_tiler_prefix
*p
, int job_no
)
959 pandecode_log_cont("{\n");
962 pandecode_prop("invocation_count = %" PRIx32
, p
->invocation_count
);
963 pandecode_prop("size_y_shift = %d", p
->size_y_shift
);
964 pandecode_prop("size_z_shift = %d", p
->size_z_shift
);
965 pandecode_prop("workgroups_x_shift = %d", p
->workgroups_x_shift
);
966 pandecode_prop("workgroups_y_shift = %d", p
->workgroups_y_shift
);
967 pandecode_prop("workgroups_z_shift = %d", p
->workgroups_z_shift
);
968 pandecode_prop("workgroups_x_shift_2 = 0x%" PRIx32
, p
->workgroups_x_shift_2
);
970 /* Decode invocation_count. See the comment before the definition of
971 * invocation_count for an explanation.
973 pandecode_msg("size: (%d, %d, %d)\n",
974 bits(p
->invocation_count
, 0, p
->size_y_shift
) + 1,
975 bits(p
->invocation_count
, p
->size_y_shift
, p
->size_z_shift
) + 1,
976 bits(p
->invocation_count
, p
->size_z_shift
,
977 p
->workgroups_x_shift
) + 1);
978 pandecode_msg("workgroups: (%d, %d, %d)\n",
979 bits(p
->invocation_count
, p
->workgroups_x_shift
,
980 p
->workgroups_y_shift
) + 1,
981 bits(p
->invocation_count
, p
->workgroups_y_shift
,
982 p
->workgroups_z_shift
) + 1,
983 bits(p
->invocation_count
, p
->workgroups_z_shift
,
987 pandecode_prop("unknown_draw = 0x%" PRIx32
, p
->unknown_draw
);
988 pandecode_prop("workgroups_x_shift_3 = 0x%" PRIx32
, p
->workgroups_x_shift_3
);
990 pandecode_prop("draw_mode = %s", pandecode_draw_mode_name(p
->draw_mode
));
992 /* Index count only exists for tiler jobs anyway */
995 pandecode_prop("index_count = MALI_POSITIVE(%" PRId32
")", p
->index_count
+ 1);
997 pandecode_prop("negative_start = %d", p
->negative_start
);
999 DYN_MEMORY_PROP(p
, job_no
, indices
);
1002 pandecode_msg("Zero tripped\n");
1003 pandecode_prop("zero1 = 0x%" PRIx32
, p
->zero1
);
1007 pandecode_log("},\n");
1011 pandecode_replay_uniform_buffers(mali_ptr pubufs
, int ubufs_count
, int job_no
)
1013 struct pandecode_mapped_memory
*umem
= pandecode_find_mapped_gpu_mem_containing(pubufs
);
1015 struct mali_uniform_buffer_meta
*PANDECODE_PTR_VAR(ubufs
, umem
, pubufs
);
1017 for (int i
= 0; i
< ubufs_count
; i
++) {
1018 mali_ptr ptr
= ubufs
[i
].ptr
<< 2;
1019 struct pandecode_mapped_memory
*umem2
= pandecode_find_mapped_gpu_mem_containing(ptr
);
1020 uint32_t *PANDECODE_PTR_VAR(ubuf
, umem2
, ptr
);
1022 snprintf(name
, sizeof(name
), "ubuf_%d", i
);
1023 /* The blob uses ubuf 0 to upload internal stuff and
1024 * uniforms that won't fit/are accessed indirectly, so
1025 * it puts it in the batchbuffer.
1027 pandecode_log("uint32_t %s_%d[] = {\n", name
, job_no
);
1030 for (int j
= 0; j
<= ubufs
[i
].size
; j
++) {
1031 for (int k
= 0; k
< 4; k
++) {
1033 pandecode_log("0x%"PRIx32
", ", ubuf
[4 * j
+ k
]);
1035 pandecode_log_cont("0x%"PRIx32
", ", ubuf
[4 * j
+ k
]);
1039 pandecode_log_cont("\n");
1043 pandecode_log("};\n");
1046 pandecode_log("struct mali_uniform_buffer_meta uniform_buffers_%d[] = {\n",
1050 for (int i
= 0; i
< ubufs_count
; i
++) {
1051 pandecode_log("{\n");
1053 pandecode_prop("size = MALI_POSITIVE(%d)", ubufs
[i
].size
+ 1);
1054 pandecode_prop("ptr = ubuf_%d_%d_p >> 2", i
, job_no
);
1056 pandecode_log("},\n");
1060 pandecode_log("};\n");
1064 pandecode_replay_scratchpad(uintptr_t pscratchpad
, int job_no
, char *suffix
)
1067 struct pandecode_mapped_memory
*mem
= pandecode_find_mapped_gpu_mem_containing(pscratchpad
);
1069 struct bifrost_scratchpad
*PANDECODE_PTR_VAR(scratchpad
, mem
, pscratchpad
);
1071 if (scratchpad
->zero
)
1072 pandecode_msg("XXX scratchpad zero tripped");
1074 pandecode_log("struct bifrost_scratchpad scratchpad_%d%s = {\n", job_no
, suffix
);
1077 pandecode_prop("flags = 0x%x", scratchpad
->flags
);
1078 MEMORY_PROP(scratchpad
, gpu_scratchpad
);
1081 pandecode_log("};\n");
1085 pandecode_shader_disassemble(mali_ptr shader_ptr
, int shader_no
, int type
,
1088 struct pandecode_mapped_memory
*mem
= pandecode_find_mapped_gpu_mem_containing(shader_ptr
);
1089 uint8_t *PANDECODE_PTR_VAR(code
, mem
, shader_ptr
);
1091 /* Compute maximum possible size */
1092 size_t sz
= mem
->length
- (shader_ptr
- mem
->gpu_va
);
1094 /* TODO: When Bifrost is upstreamed, disassemble that too */
1096 pandecode_msg("Bifrost disassembler not yet upstreamed");
1100 /* Print some boilerplate to clearly denote the assembly (which doesn't
1101 * obey indentation rules), and actually do the disassembly! */
1104 disassemble_midgard(code
, sz
);
1109 pandecode_replay_vertex_tiler_postfix_pre(const struct mali_vertex_tiler_postfix
*p
,
1110 int job_no
, enum mali_job_type job_type
,
1111 char *suffix
, bool is_bifrost
)
1113 mali_ptr shader_meta_ptr
= (u64
) (uintptr_t) (p
->_shader_upper
<< 4);
1114 struct pandecode_mapped_memory
*attr_mem
;
1116 /* On Bifrost, since the tiler heap (for tiler jobs) and the scratchpad
1117 * are the only things actually needed from the FBD, vertex/tiler jobs
1118 * no longer reference the FBD -- instead, this field points to some
1119 * info about the scratchpad.
1122 pandecode_replay_scratchpad(p
->framebuffer
& ~FBD_TYPE
, job_no
, suffix
);
1123 else if (p
->framebuffer
& MALI_MFBD
)
1124 pandecode_replay_mfbd_bfr((u64
) ((uintptr_t) p
->framebuffer
) & FBD_MASK
, job_no
);
1126 pandecode_replay_sfbd((u64
) (uintptr_t) p
->framebuffer
, job_no
);
1128 int varying_count
= 0, attribute_count
= 0, uniform_count
= 0, uniform_buffer_count
= 0;
1129 int texture_count
= 0, sampler_count
= 0;
1131 if (shader_meta_ptr
) {
1132 struct pandecode_mapped_memory
*smem
= pandecode_find_mapped_gpu_mem_containing(shader_meta_ptr
);
1133 struct mali_shader_meta
*PANDECODE_PTR_VAR(s
, smem
, shader_meta_ptr
);
1135 pandecode_log("struct mali_shader_meta shader_meta_%d%s = {\n", job_no
, suffix
);
1138 /* Save for dumps */
1139 attribute_count
= s
->attribute_count
;
1140 varying_count
= s
->varying_count
;
1141 texture_count
= s
->texture_count
;
1142 sampler_count
= s
->sampler_count
;
1145 uniform_count
= s
->bifrost2
.uniform_count
;
1146 uniform_buffer_count
= s
->bifrost1
.uniform_buffer_count
;
1148 uniform_count
= s
->midgard1
.uniform_count
;
1149 /* TODO figure this out */
1150 uniform_buffer_count
= 1;
1153 mali_ptr shader_ptr
= pandecode_replay_shader_address("shader", s
->shader
);
1155 pandecode_prop("texture_count = %" PRId16
, s
->texture_count
);
1156 pandecode_prop("sampler_count = %" PRId16
, s
->sampler_count
);
1157 pandecode_prop("attribute_count = %" PRId16
, s
->attribute_count
);
1158 pandecode_prop("varying_count = %" PRId16
, s
->varying_count
);
1161 pandecode_log(".bifrost1 = {\n");
1164 pandecode_prop("uniform_buffer_count = %" PRId32
, s
->bifrost1
.uniform_buffer_count
);
1165 pandecode_prop("unk1 = 0x%" PRIx32
, s
->bifrost1
.unk1
);
1168 pandecode_log("},\n");
1170 pandecode_log(".midgard1 = {\n");
1173 pandecode_prop("uniform_count = %" PRId16
, s
->midgard1
.uniform_count
);
1174 pandecode_prop("work_count = %" PRId16
, s
->midgard1
.work_count
);
1176 pandecode_log(".unknown1 = ");
1177 pandecode_log_decoded_flags(shader_unknown1_flag_info
, s
->midgard1
.unknown1
);
1178 pandecode_log_cont(",\n");
1180 pandecode_prop("unknown2 = 0x%" PRIx32
, s
->midgard1
.unknown2
);
1183 pandecode_log("},\n");
1186 if (s
->depth_units
|| s
->depth_factor
) {
1188 pandecode_prop("depth_units = %f", s
->depth_units
);
1190 pandecode_prop("depth_units = MALI_NEGATIVE(%f)", s
->depth_units
- 1.0f
);
1192 pandecode_prop("depth_factor = %f", s
->depth_factor
);
1195 bool invert_alpha_coverage
= s
->alpha_coverage
& 0xFFF0;
1196 uint16_t inverted_coverage
= invert_alpha_coverage
? ~s
->alpha_coverage
: s
->alpha_coverage
;
1198 pandecode_prop("alpha_coverage = %sMALI_ALPHA_COVERAGE(%f)",
1199 invert_alpha_coverage
? "~" : "",
1200 MALI_GET_ALPHA_COVERAGE(inverted_coverage
));
1202 pandecode_log(".unknown2_3 = ");
1204 int unknown2_3
= s
->unknown2_3
;
1205 int unknown2_4
= s
->unknown2_4
;
1207 /* We're not quite sure what these flags mean without the depth test, if anything */
1209 if (unknown2_3
& (MALI_DEPTH_TEST
| MALI_DEPTH_FUNC_MASK
)) {
1210 const char *func
= pandecode_func_name(MALI_GET_DEPTH_FUNC(unknown2_3
));
1211 unknown2_3
&= ~MALI_DEPTH_FUNC_MASK
;
1213 pandecode_log_cont("MALI_DEPTH_FUNC(%s) | ", func
);
1216 pandecode_log_decoded_flags(u3_flag_info
, unknown2_3
);
1217 pandecode_log_cont(",\n");
1219 pandecode_prop("stencil_mask_front = 0x%02X", s
->stencil_mask_front
);
1220 pandecode_prop("stencil_mask_back = 0x%02X", s
->stencil_mask_back
);
1222 pandecode_log(".unknown2_4 = ");
1223 pandecode_log_decoded_flags(u4_flag_info
, unknown2_4
);
1224 pandecode_log_cont(",\n");
1226 pandecode_replay_stencil("front", &s
->stencil_front
);
1227 pandecode_replay_stencil("back", &s
->stencil_back
);
1230 pandecode_log(".bifrost2 = {\n");
1233 pandecode_prop("unk3 = 0x%" PRIx32
, s
->bifrost2
.unk3
);
1234 pandecode_prop("preload_regs = 0x%" PRIx32
, s
->bifrost2
.preload_regs
);
1235 pandecode_prop("uniform_count = %" PRId32
, s
->bifrost2
.uniform_count
);
1236 pandecode_prop("unk4 = 0x%" PRIx32
, s
->bifrost2
.unk4
);
1239 pandecode_log("},\n");
1241 pandecode_log(".midgard2 = {\n");
1244 pandecode_prop("unknown2_7 = 0x%" PRIx32
, s
->midgard2
.unknown2_7
);
1246 pandecode_log("},\n");
1249 pandecode_prop("unknown2_8 = 0x%" PRIx32
, s
->unknown2_8
);
1251 bool blend_shader
= false;
1254 if (s
->unknown2_3
& MALI_HAS_BLEND_SHADER
) {
1255 blend_shader
= true;
1256 pandecode_replay_shader_address("blend_shader", s
->blend_shader
);
1258 pandecode_replay_blend_equation(&s
->blend_equation
, "");
1263 pandecode_log("};\n");
1265 /* MRT blend fields are used whenever MFBD is used */
1267 if (job_type
== JOB_TYPE_TILER
) {
1268 pandecode_log("struct mali_blend_meta blend_meta_%d[] = {\n",
1274 for (i
= 0; i
< 4; i
++) {
1275 const struct mali_blend_meta
*b
= &s
->blend_meta
[i
];
1276 pandecode_log("{\n");
1280 pandecode_prop("unk1 = 0x%" PRIx64
, b
->unk1
);
1282 /* Depending on unk1, we determine if there's a
1285 if ((b
->unk1
& 0xF) >= 0x2) {
1286 blend_shader
= true;
1287 pandecode_replay_shader_address("blend_shader", b
->blend_shader
);
1289 pandecode_replay_blend_equation(&b
->blend_equation_1
, "_1");
1292 /* This is always an equation, I think. If
1293 * there's a shader, it just defaults to
1294 * REPLACE (0x122) */
1295 pandecode_replay_blend_equation(&b
->blend_equation_2
, "_2");
1298 pandecode_msg("blend zero tripped\n");
1299 pandecode_prop("zero2 = 0x%x", b
->zero2
);
1304 pandecode_prop("unk1 = 0x%" PRIx32
, b
->unk1
);
1305 /* TODO figure out blend shader enable bit */
1306 pandecode_replay_blend_equation(&b
->blend_equation
);
1307 pandecode_prop("unk2 = 0x%" PRIx16
, b
->unk2
);
1308 pandecode_prop("index = 0x%" PRIx16
, b
->index
);
1309 pandecode_prop("unk3 = 0x%" PRIx32
, b
->unk3
);
1313 pandecode_log("},\n");
1319 /* TODO: What's this supposed to be? */
1320 if (b
->unk1
& 0x200)
1327 pandecode_log("};\n");
1329 /* This needs to be uploaded right after the
1330 * shader_meta since it's technically part of the same
1331 * (variable-size) structure.
1335 pandecode_shader_disassemble(shader_ptr
, job_no
, job_type
, is_bifrost
);
1337 if (!is_bifrost
&& blend_shader
)
1338 pandecode_shader_disassemble(s
->blend_shader
& ~0xF, job_no
, job_type
, false);
1341 pandecode_msg("<no shader>\n");
1344 struct pandecode_mapped_memory
*fmem
= pandecode_find_mapped_gpu_mem_containing(p
->viewport
);
1345 struct mali_viewport
*PANDECODE_PTR_VAR(f
, fmem
, p
->viewport
);
1347 pandecode_log("struct mali_viewport viewport_%d%s = {\n", job_no
, suffix
);
1350 pandecode_prop("clip_minx = %f", f
->clip_minx
);
1351 pandecode_prop("clip_miny = %f", f
->clip_miny
);
1352 pandecode_prop("clip_minz = %f", f
->clip_minz
);
1353 pandecode_prop("clip_maxx = %f", f
->clip_maxx
);
1354 pandecode_prop("clip_maxy = %f", f
->clip_maxy
);
1355 pandecode_prop("clip_maxz = %f", f
->clip_maxz
);
1357 /* Only the higher coordinates are MALI_POSITIVE scaled */
1359 pandecode_prop("viewport0 = { %d, %d }",
1360 f
->viewport0
[0], f
->viewport0
[1]);
1362 pandecode_prop("viewport1 = { MALI_POSITIVE(%d), MALI_POSITIVE(%d) }",
1363 f
->viewport1
[0] + 1, f
->viewport1
[1] + 1);
1366 pandecode_log("};\n");
1369 if (p
->attribute_meta
) {
1370 unsigned max_attr_index
= pandecode_replay_attribute_meta(job_no
, attribute_count
, p
, false, suffix
);
1372 attr_mem
= pandecode_find_mapped_gpu_mem_containing(p
->attributes
);
1373 pandecode_replay_attributes(attr_mem
, p
->attributes
, job_no
, suffix
, max_attr_index
+ 1, false);
1376 /* Varyings are encoded like attributes but not actually sent; we just
1377 * pass a zero buffer with the right stride/size set, (or whatever)
1378 * since the GPU will write to it itself */
1381 attr_mem
= pandecode_find_mapped_gpu_mem_containing(p
->varyings
);
1383 /* Number of descriptors depends on whether there are
1384 * non-internal varyings */
1386 pandecode_replay_attributes(attr_mem
, p
->varyings
, job_no
, suffix
, varying_count
> 1 ? 4 : 1, true);
1389 if (p
->varying_meta
) {
1390 pandecode_replay_attribute_meta(job_no
, varying_count
, p
, true, suffix
);
1394 int rows
= uniform_count
, width
= 4;
1395 size_t sz
= rows
* width
* sizeof(float);
1397 struct pandecode_mapped_memory
*uniform_mem
= pandecode_find_mapped_gpu_mem_containing(p
->uniforms
);
1398 pandecode_fetch_gpu_mem(uniform_mem
, p
->uniforms
, sz
);
1399 float *PANDECODE_PTR_VAR(uniforms
, uniform_mem
, p
->uniforms
);
1401 pandecode_log("float uniforms_%d%s[] = {\n", job_no
, suffix
);
1405 for (int row
= 0; row
< rows
; row
++) {
1406 for (int i
= 0; i
< width
; i
++)
1407 pandecode_log_cont("%ff, ", uniforms
[i
]);
1409 pandecode_log_cont("\n");
1415 pandecode_log("};\n");
1418 if (p
->uniform_buffers
) {
1419 pandecode_replay_uniform_buffers(p
->uniform_buffers
, uniform_buffer_count
, job_no
);
1422 if (p
->texture_trampoline
) {
1423 struct pandecode_mapped_memory
*mmem
= pandecode_find_mapped_gpu_mem_containing(p
->texture_trampoline
);
1426 mali_ptr
*PANDECODE_PTR_VAR(u
, mmem
, p
->texture_trampoline
);
1428 pandecode_log("uint64_t texture_trampoline_%d[] = {\n", job_no
);
1431 for (int tex
= 0; tex
< texture_count
; ++tex
) {
1432 mali_ptr
*PANDECODE_PTR_VAR(u
, mmem
, p
->texture_trampoline
+ tex
* sizeof(mali_ptr
));
1433 char *a
= pointer_as_memory_reference(*u
);
1434 pandecode_log("%s,\n", a
);
1439 pandecode_log("};\n");
1441 /* Now, finally, descend down into the texture descriptor */
1442 for (int tex
= 0; tex
< texture_count
; ++tex
) {
1443 mali_ptr
*PANDECODE_PTR_VAR(u
, mmem
, p
->texture_trampoline
+ tex
* sizeof(mali_ptr
));
1444 struct pandecode_mapped_memory
*tmem
= pandecode_find_mapped_gpu_mem_containing(*u
);
1447 struct mali_texture_descriptor
*PANDECODE_PTR_VAR(t
, tmem
, *u
);
1449 pandecode_log("struct mali_texture_descriptor texture_descriptor_%d_%d = {\n", job_no
, tex
);
1452 pandecode_prop("width = MALI_POSITIVE(%" PRId16
")", t
->width
+ 1);
1453 pandecode_prop("height = MALI_POSITIVE(%" PRId16
")", t
->height
+ 1);
1454 pandecode_prop("depth = MALI_POSITIVE(%" PRId16
")", t
->depth
+ 1);
1456 pandecode_prop("unknown3 = %" PRId16
, t
->unknown3
);
1457 pandecode_prop("unknown3A = %" PRId8
, t
->unknown3A
);
1458 pandecode_prop("nr_mipmap_levels = %" PRId8
, t
->nr_mipmap_levels
);
1460 struct mali_texture_format f
= t
->format
;
1462 pandecode_log(".format = {\n");
1465 pandecode_replay_swizzle(f
.swizzle
);
1466 pandecode_prop("format = %s", pandecode_format_name(f
.format
));
1468 pandecode_prop("usage1 = 0x%" PRIx32
, f
.usage1
);
1469 pandecode_prop("is_not_cubemap = %" PRId32
, f
.is_not_cubemap
);
1470 pandecode_prop("usage2 = 0x%" PRIx32
, f
.usage2
);
1473 pandecode_log("},\n");
1475 pandecode_replay_swizzle(t
->swizzle
);
1477 if (t
->swizzle_zero
) {
1478 /* Shouldn't happen */
1479 pandecode_msg("Swizzle zero tripped but replay will be fine anyway");
1480 pandecode_prop("swizzle_zero = %d", t
->swizzle_zero
);
1483 pandecode_prop("unknown3 = 0x%" PRIx32
, t
->unknown3
);
1485 pandecode_prop("unknown5 = 0x%" PRIx32
, t
->unknown5
);
1486 pandecode_prop("unknown6 = 0x%" PRIx32
, t
->unknown6
);
1487 pandecode_prop("unknown7 = 0x%" PRIx32
, t
->unknown7
);
1489 pandecode_log(".swizzled_bitmaps = {\n");
1492 int bitmap_count
= MALI_NEGATIVE(t
->nr_mipmap_levels
);
1494 if (!f
.is_not_cubemap
) {
1495 /* Miptree for each face */
1499 int max_count
= sizeof(t
->swizzled_bitmaps
) / sizeof(t
->swizzled_bitmaps
[0]);
1501 if (bitmap_count
> max_count
) {
1502 pandecode_msg("XXX: bitmap count tripped");
1503 bitmap_count
= max_count
;
1506 for (int i
= 0; i
< bitmap_count
; ++i
) {
1507 char *a
= pointer_as_memory_reference(t
->swizzled_bitmaps
[i
]);
1508 pandecode_log("%s, \n", a
);
1513 pandecode_log("},\n");
1516 pandecode_log("};\n");
1522 if (p
->sampler_descriptor
) {
1523 struct pandecode_mapped_memory
*smem
= pandecode_find_mapped_gpu_mem_containing(p
->sampler_descriptor
);
1526 struct mali_sampler_descriptor
*s
;
1528 mali_ptr d
= p
->sampler_descriptor
;
1530 for (int i
= 0; i
< sampler_count
; ++i
) {
1531 s
= pandecode_fetch_gpu_mem(smem
, d
+ sizeof(*s
) * i
, sizeof(*s
));
1533 pandecode_log("struct mali_sampler_descriptor sampler_descriptor_%d_%d = {\n", job_no
, i
);
1536 /* Only the lower two bits are understood right now; the rest we display as hex */
1537 pandecode_log(".filter_mode = MALI_TEX_MIN(%s) | MALI_TEX_MAG(%s) | 0x%" PRIx32
",\n",
1538 MALI_FILTER_NAME(s
->filter_mode
& MALI_TEX_MIN_MASK
),
1539 MALI_FILTER_NAME(s
->filter_mode
& MALI_TEX_MAG_MASK
),
1540 s
->filter_mode
& ~3);
1542 pandecode_prop("min_lod = FIXED_16(%f)", DECODE_FIXED_16(s
->min_lod
));
1543 pandecode_prop("max_lod = FIXED_16(%f)", DECODE_FIXED_16(s
->max_lod
));
1545 pandecode_prop("wrap_s = %s", pandecode_wrap_mode_name(s
->wrap_s
));
1546 pandecode_prop("wrap_t = %s", pandecode_wrap_mode_name(s
->wrap_t
));
1547 pandecode_prop("wrap_r = %s", pandecode_wrap_mode_name(s
->wrap_r
));
1549 pandecode_prop("compare_func = %s", pandecode_alt_func_name(s
->compare_func
));
1551 if (s
->zero
|| s
->zero2
) {
1552 pandecode_msg("Zero tripped\n");
1553 pandecode_prop("zero = 0x%X, 0x%X\n", s
->zero
, s
->zero2
);
1556 pandecode_prop("unknown2 = %d", s
->unknown2
);
1558 pandecode_prop("border_color = { %f, %f, %f, %f }",
1562 s
->border_color
[3]);
1565 pandecode_log("};\n");
1572 pandecode_replay_vertex_tiler_postfix(const struct mali_vertex_tiler_postfix
*p
, int job_no
, bool is_bifrost
)
1574 pandecode_log_cont("{\n");
1577 MEMORY_PROP(p
, position_varying
);
1578 MEMORY_COMMENT(p
, position_varying
);
1579 DYN_MEMORY_PROP(p
, job_no
, uniform_buffers
);
1580 MEMORY_COMMENT(p
, uniform_buffers
);
1581 DYN_MEMORY_PROP(p
, job_no
, texture_trampoline
);
1582 MEMORY_COMMENT(p
, texture_trampoline
);
1583 DYN_MEMORY_PROP(p
, job_no
, sampler_descriptor
);
1584 MEMORY_COMMENT(p
, sampler_descriptor
);
1585 DYN_MEMORY_PROP(p
, job_no
, uniforms
);
1586 MEMORY_COMMENT(p
, uniforms
);
1587 DYN_MEMORY_PROP(p
, job_no
, attributes
);
1588 MEMORY_COMMENT(p
, attributes
);
1589 DYN_MEMORY_PROP(p
, job_no
, attribute_meta
);
1590 MEMORY_COMMENT(p
, attribute_meta
);
1591 DYN_MEMORY_PROP(p
, job_no
, varyings
);
1592 MEMORY_COMMENT(p
, varyings
);
1593 DYN_MEMORY_PROP(p
, job_no
, varying_meta
);
1594 MEMORY_COMMENT(p
, varying_meta
);
1595 DYN_MEMORY_PROP(p
, job_no
, viewport
);
1596 MEMORY_COMMENT(p
, viewport
);
1597 DYN_MEMORY_PROP(p
, job_no
, occlusion_counter
);
1598 MEMORY_COMMENT(p
, occlusion_counter
);
1599 MEMORY_COMMENT(p
, framebuffer
& ~1);
1600 pandecode_msg("%" PRIx64
"\n", p
->viewport
);
1601 pandecode_msg("%" PRIx64
"\n", p
->framebuffer
);
1604 pandecode_prop("framebuffer = scratchpad_%d_p", job_no
);
1606 pandecode_prop("framebuffer = framebuffer_%d_p | %s", job_no
, p
->framebuffer
& MALI_MFBD
? "MALI_MFBD" : "0");
1608 pandecode_prop("_shader_upper = (shader_meta_%d_p) >> 4", job_no
);
1609 pandecode_prop("flags = %d", p
->flags
);
1612 pandecode_log("},\n");
1616 pandecode_replay_vertex_only_bfr(struct bifrost_vertex_only
*v
)
1618 pandecode_log_cont("{\n");
1621 pandecode_prop("unk2 = 0x%x", v
->unk2
);
1623 if (v
->zero0
|| v
->zero1
) {
1624 pandecode_msg("vertex only zero tripped");
1625 pandecode_prop("zero0 = 0x%" PRIx32
, v
->zero0
);
1626 pandecode_prop("zero1 = 0x%" PRIx64
, v
->zero1
);
1630 pandecode_log("}\n");
1634 pandecode_replay_tiler_heap_meta(mali_ptr gpu_va
, int job_no
)
1637 struct pandecode_mapped_memory
*mem
= pandecode_find_mapped_gpu_mem_containing(gpu_va
);
1638 const struct bifrost_tiler_heap_meta
*PANDECODE_PTR_VAR(h
, mem
, gpu_va
);
1640 pandecode_log("struct mali_tiler_heap_meta tiler_heap_meta_%d = {\n", job_no
);
1644 pandecode_msg("tiler heap zero tripped\n");
1645 pandecode_prop("zero = 0x%x", h
->zero
);
1648 for (int i
= 0; i
< 12; i
++) {
1649 if (h
->zeros
[i
] != 0) {
1650 pandecode_msg("tiler heap zero %d tripped, value %x\n",
1655 pandecode_prop("heap_size = 0x%x", h
->heap_size
);
1656 MEMORY_PROP(h
, tiler_heap_start
);
1657 MEMORY_PROP(h
, tiler_heap_free
);
1659 /* this might point to the beginning of another buffer, when it's
1660 * really the end of the tiler heap buffer, so we have to be careful
1663 char *a
= pointer_as_memory_reference(h
->tiler_heap_end
- 1);
1664 pandecode_prop("tiler_heap_end = %s + 1", a
);
1668 pandecode_log("};\n");
1672 pandecode_replay_tiler_meta(mali_ptr gpu_va
, int job_no
)
1674 struct pandecode_mapped_memory
*mem
= pandecode_find_mapped_gpu_mem_containing(gpu_va
);
1675 const struct bifrost_tiler_meta
*PANDECODE_PTR_VAR(t
, mem
, gpu_va
);
1677 pandecode_replay_tiler_heap_meta(t
->tiler_heap_meta
, job_no
);
1679 pandecode_log("struct mali_tiler_meta tiler_meta_%d = {\n", job_no
);
1682 if (t
->zero0
|| t
->zero1
) {
1683 pandecode_msg("tiler meta zero tripped");
1684 pandecode_prop("zero0 = 0x%" PRIx64
, t
->zero0
);
1685 pandecode_prop("zero1 = 0x%" PRIx64
, t
->zero1
);
1688 pandecode_prop("unk = 0x%x", t
->unk
);
1689 pandecode_prop("width = MALI_POSITIVE(%d)", t
->width
+ 1);
1690 pandecode_prop("height = MALI_POSITIVE(%d)", t
->height
+ 1);
1691 DYN_MEMORY_PROP(t
, job_no
, tiler_heap_meta
);
1693 for (int i
= 0; i
< 12; i
++) {
1694 if (t
->zeros
[i
] != 0) {
1695 pandecode_msg("tiler heap zero %d tripped, value %" PRIx64
"\n",
1701 pandecode_log("};\n");
1705 pandecode_replay_gl_enables(uint32_t gl_enables
, int job_type
)
1707 pandecode_log(".gl_enables = ");
1709 if (job_type
== JOB_TYPE_TILER
) {
1710 pandecode_log_cont("MALI_FRONT_FACE(MALI_%s) | ",
1711 gl_enables
& MALI_FRONT_FACE(MALI_CW
) ? "CW" : "CCW");
1713 gl_enables
&= ~(MALI_FRONT_FACE(1));
1716 pandecode_log_decoded_flags(gl_enable_flag_info
, gl_enables
);
1718 pandecode_log_cont(",\n");
1722 pandecode_replay_primitive_size(union midgard_primitive_size u
, bool constant
)
1724 pandecode_log(".primitive_size = {\n");
1728 pandecode_prop("constant = %f", u
.constant
);
1730 MEMORY_PROP((&u
), pointer
);
1734 pandecode_log("},\n");
1738 pandecode_replay_tiler_only_bfr(const struct bifrost_tiler_only
*t
, int job_no
)
1740 pandecode_log_cont("{\n");
1743 /* TODO: gl_PointSize on Bifrost */
1744 pandecode_replay_primitive_size(t
->primitive_size
, true);
1746 DYN_MEMORY_PROP(t
, job_no
, tiler_meta
);
1747 pandecode_replay_gl_enables(t
->gl_enables
, JOB_TYPE_TILER
);
1749 if (t
->zero1
|| t
->zero2
|| t
->zero3
|| t
->zero4
|| t
->zero5
1750 || t
->zero6
|| t
->zero7
|| t
->zero8
) {
1751 pandecode_msg("tiler only zero tripped");
1752 pandecode_prop("zero1 = 0x%" PRIx64
, t
->zero1
);
1753 pandecode_prop("zero2 = 0x%" PRIx64
, t
->zero2
);
1754 pandecode_prop("zero3 = 0x%" PRIx64
, t
->zero3
);
1755 pandecode_prop("zero4 = 0x%" PRIx64
, t
->zero4
);
1756 pandecode_prop("zero5 = 0x%" PRIx64
, t
->zero5
);
1757 pandecode_prop("zero6 = 0x%" PRIx64
, t
->zero6
);
1758 pandecode_prop("zero7 = 0x%" PRIx32
, t
->zero7
);
1759 pandecode_prop("zero8 = 0x%" PRIx64
, t
->zero8
);
1763 pandecode_log("},\n");
1767 pandecode_replay_vertex_job_bfr(const struct mali_job_descriptor_header
*h
,
1768 const struct pandecode_mapped_memory
*mem
,
1769 mali_ptr payload
, int job_no
)
1771 struct bifrost_payload_vertex
*PANDECODE_PTR_VAR(v
, mem
, payload
);
1773 pandecode_replay_vertex_tiler_postfix_pre(&v
->postfix
, job_no
, h
->job_type
, "", true);
1775 pandecode_log("struct bifrost_payload_vertex payload_%d = {\n", job_no
);
1778 pandecode_log(".prefix = ");
1779 pandecode_replay_vertex_tiler_prefix(&v
->prefix
, job_no
);
1781 pandecode_log(".vertex = ");
1782 pandecode_replay_vertex_only_bfr(&v
->vertex
);
1784 pandecode_log(".postfix = ");
1785 pandecode_replay_vertex_tiler_postfix(&v
->postfix
, job_no
, true);
1788 pandecode_log("};\n");
1794 pandecode_replay_tiler_job_bfr(const struct mali_job_descriptor_header
*h
,
1795 const struct pandecode_mapped_memory
*mem
,
1796 mali_ptr payload
, int job_no
)
1798 struct bifrost_payload_tiler
*PANDECODE_PTR_VAR(t
, mem
, payload
);
1800 pandecode_replay_vertex_tiler_postfix_pre(&t
->postfix
, job_no
, h
->job_type
, "", true);
1802 pandecode_replay_indices(t
->prefix
.indices
, t
->prefix
.index_count
, job_no
);
1803 pandecode_replay_tiler_meta(t
->tiler
.tiler_meta
, job_no
);
1805 pandecode_log("struct bifrost_payload_tiler payload_%d = {\n", job_no
);
1808 pandecode_log(".prefix = ");
1809 pandecode_replay_vertex_tiler_prefix(&t
->prefix
, job_no
);
1811 pandecode_log(".tiler = ");
1812 pandecode_replay_tiler_only_bfr(&t
->tiler
, job_no
);
1814 pandecode_log(".postfix = ");
1815 pandecode_replay_vertex_tiler_postfix(&t
->postfix
, job_no
, true);
1818 pandecode_log("};\n");
1824 pandecode_replay_vertex_or_tiler_job_mdg(const struct mali_job_descriptor_header
*h
,
1825 const struct pandecode_mapped_memory
*mem
,
1826 mali_ptr payload
, int job_no
)
1828 struct midgard_payload_vertex_tiler
*PANDECODE_PTR_VAR(v
, mem
, payload
);
1830 char *a
= pointer_as_memory_reference(payload
);
1831 pandecode_msg("vt payload: %s\n", a
);
1834 pandecode_replay_vertex_tiler_postfix_pre(&v
->postfix
, job_no
, h
->job_type
, "", false);
1836 pandecode_replay_indices(v
->prefix
.indices
, v
->prefix
.index_count
, job_no
);
1838 pandecode_log("struct midgard_payload_vertex_tiler payload_%d = {\n", job_no
);
1841 bool has_primitive_pointer
= v
->prefix
.unknown_draw
& MALI_DRAW_VARYING_SIZE
;
1842 pandecode_replay_primitive_size(v
->primitive_size
, !has_primitive_pointer
);
1844 pandecode_log(".prefix = ");
1845 pandecode_replay_vertex_tiler_prefix(&v
->prefix
, job_no
);
1847 pandecode_replay_gl_enables(v
->gl_enables
, h
->job_type
);
1848 pandecode_prop("draw_start = %d", v
->draw_start
);
1853 pandecode_msg("Zero tripped\n");
1854 pandecode_prop("zero3 = 0x%" PRIx32
, v
->zero3
);
1860 pandecode_msg("Zero tripped\n");
1861 pandecode_prop("zero5 = 0x%" PRIx64
, v
->zero5
);
1864 pandecode_log(".postfix = ");
1865 pandecode_replay_vertex_tiler_postfix(&v
->postfix
, job_no
, false);
1868 pandecode_log("};\n");
1874 pandecode_replay_fragment_job(const struct pandecode_mapped_memory
*mem
,
1875 mali_ptr payload
, int job_no
,
1878 const struct mali_payload_fragment
*PANDECODE_PTR_VAR(s
, mem
, payload
);
1880 bool fbd_dumped
= false;
1882 if (!is_bifrost
&& (s
->framebuffer
& FBD_TYPE
) == MALI_SFBD
) {
1883 /* Only SFBDs are understood, not MFBDs. We're speculating,
1884 * based on the versioning, kernel code, etc, that the
1885 * difference is between Single FrameBuffer Descriptor and
1886 * Multiple FrmaeBuffer Descriptor; the change apparently lines
1887 * up with multi-framebuffer support being added (T7xx onwards,
1888 * including Gxx). In any event, there's some field shuffling
1889 * that we haven't looked into yet. */
1891 pandecode_replay_sfbd(s
->framebuffer
& FBD_MASK
, job_no
);
1893 } else if ((s
->framebuffer
& FBD_TYPE
) == MALI_MFBD
) {
1894 /* We don't know if Bifrost supports SFBD's at all, since the
1895 * driver never uses them. And the format is different from
1896 * Midgard anyways, due to the tiler heap and scratchpad being
1897 * moved out into separate structures, so it's not clear what a
1898 * Bifrost SFBD would even look like without getting an actual
1899 * trace, which appears impossible.
1902 pandecode_replay_mfbd_bfr(s
->framebuffer
& FBD_MASK
, job_no
);
1906 uintptr_t p
= (uintptr_t) s
->framebuffer
& FBD_MASK
;
1908 pandecode_log("struct mali_payload_fragment payload_%d = {\n", job_no
);
1911 /* See the comments by the macro definitions for mathematical context
1912 * on why this is so weird */
1914 if (MALI_TILE_COORD_FLAGS(s
->max_tile_coord
) || MALI_TILE_COORD_FLAGS(s
->min_tile_coord
))
1915 pandecode_msg("Tile coordinate flag missed, replay wrong\n");
1917 pandecode_prop("min_tile_coord = MALI_COORDINATE_TO_TILE_MIN(%d, %d)",
1918 MALI_TILE_COORD_X(s
->min_tile_coord
) << MALI_TILE_SHIFT
,
1919 MALI_TILE_COORD_Y(s
->min_tile_coord
) << MALI_TILE_SHIFT
);
1921 pandecode_prop("max_tile_coord = MALI_COORDINATE_TO_TILE_MAX(%d, %d)",
1922 (MALI_TILE_COORD_X(s
->max_tile_coord
) + 1) << MALI_TILE_SHIFT
,
1923 (MALI_TILE_COORD_Y(s
->max_tile_coord
) + 1) << MALI_TILE_SHIFT
);
1925 /* If the FBD was just decoded, we can refer to it by pointer. If not,
1926 * we have to fallback on offsets. */
1928 const char *fbd_type
= s
->framebuffer
& MALI_MFBD
? "MALI_MFBD" : "MALI_SFBD";
1931 pandecode_prop("framebuffer = framebuffer_%d_p | %s", job_no
, fbd_type
);
1933 pandecode_prop("framebuffer = %s | %s", pointer_as_memory_reference(p
), fbd_type
);
1936 pandecode_log("};\n");
1941 static int job_descriptor_number
= 0;
1944 pandecode_replay_jc(mali_ptr jc_gpu_va
, bool bifrost
)
1946 struct mali_job_descriptor_header
*h
;
1948 int start_number
= 0;
1954 struct pandecode_mapped_memory
*mem
=
1955 pandecode_find_mapped_gpu_mem_containing(jc_gpu_va
);
1959 h
= PANDECODE_PTR(mem
, jc_gpu_va
, struct mali_job_descriptor_header
);
1961 /* On Midgard, for 32-bit jobs except for fragment jobs, the
1962 * high 32-bits of the 64-bit pointer are reused to store
1965 int offset
= h
->job_descriptor_size
== MALI_JOB_32
&&
1966 h
->job_type
!= JOB_TYPE_FRAGMENT
? 4 : 0;
1967 mali_ptr payload_ptr
= jc_gpu_va
+ sizeof(*h
) - offset
;
1969 payload
= pandecode_fetch_gpu_mem(mem
, payload_ptr
,
1972 int job_no
= job_descriptor_number
++;
1975 start_number
= job_no
;
1977 pandecode_log("struct mali_job_descriptor_header job_%d = {\n", job_no
);
1980 pandecode_prop("job_type = %s", pandecode_job_type_name(h
->job_type
));
1982 /* Save for next job fixing */
1983 last_size
= h
->job_descriptor_size
;
1985 if (h
->job_descriptor_size
)
1986 pandecode_prop("job_descriptor_size = %d", h
->job_descriptor_size
);
1988 if (h
->exception_status
)
1989 pandecode_prop("exception_status = %d", h
->exception_status
);
1991 if (h
->first_incomplete_task
)
1992 pandecode_prop("first_incomplete_task = %d", h
->first_incomplete_task
);
1994 if (h
->fault_pointer
)
1995 pandecode_prop("fault_pointer = 0x%" PRIx64
, h
->fault_pointer
);
1998 pandecode_prop("job_barrier = %d", h
->job_barrier
);
2000 pandecode_prop("job_index = %d", h
->job_index
);
2002 if (h
->unknown_flags
)
2003 pandecode_prop("unknown_flags = %d", h
->unknown_flags
);
2005 if (h
->job_dependency_index_1
)
2006 pandecode_prop("job_dependency_index_1 = %d", h
->job_dependency_index_1
);
2008 if (h
->job_dependency_index_2
)
2009 pandecode_prop("job_dependency_index_2 = %d", h
->job_dependency_index_2
);
2012 pandecode_log("};\n");
2014 /* Do not touch the field yet -- decode the payload first, and
2015 * don't touch that either. This is essential for the uploads
2016 * to occur in sequence and therefore be dynamically allocated
2017 * correctly. Do note the size, however, for that related
2020 switch (h
->job_type
) {
2021 case JOB_TYPE_SET_VALUE
: {
2022 struct mali_payload_set_value
*s
= payload
;
2024 pandecode_log("struct mali_payload_set_value payload_%d = {\n", job_no
);
2026 MEMORY_PROP(s
, out
);
2027 pandecode_prop("unknown = 0x%" PRIX64
, s
->unknown
);
2029 pandecode_log("};\n");
2034 case JOB_TYPE_TILER
:
2035 case JOB_TYPE_VERTEX
:
2036 case JOB_TYPE_COMPUTE
:
2038 if (h
->job_type
== JOB_TYPE_TILER
)
2039 pandecode_replay_tiler_job_bfr(h
, mem
, payload_ptr
, job_no
);
2041 pandecode_replay_vertex_job_bfr(h
, mem
, payload_ptr
, job_no
);
2043 pandecode_replay_vertex_or_tiler_job_mdg(h
, mem
, payload_ptr
, job_no
);
2047 case JOB_TYPE_FRAGMENT
:
2048 pandecode_replay_fragment_job(mem
, payload_ptr
, job_no
, bifrost
);
2055 /* Handle linkage */
2058 pandecode_log("((struct mali_job_descriptor_header *) (uintptr_t) job_%d_p)->", job_no
- 1);
2061 pandecode_log_cont("next_job_64 = job_%d_p;\n\n", job_no
);
2063 pandecode_log_cont("next_job_32 = (u32) (uintptr_t) job_%d_p;\n\n", job_no
);
2068 } while ((jc_gpu_va
= h
->job_descriptor_size
? h
->next_job_64
: h
->next_job_32
));
2070 return start_number
;