blob: f0da3fb656155840eee75023ad359931c4a704ad [file] [log] [blame]
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001/*
2 * Copyright (C) 2017-2019 Alyssa Rosenzweig
3 * Copyright (C) 2017-2019 Connor Abbott
Alyssa Rosenzweigd4575c32019-06-25 13:30:17 -07004 * Copyright (C) 2019 Collabora, Ltd.
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00005 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
Alyssa Rosenzweig88dc4c22020-08-05 18:13:11 -040026#include <midgard_pack.h>
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +000027#include <stdio.h>
28#include <stdlib.h>
29#include <memory.h>
30#include <stdbool.h>
31#include <stdarg.h>
Alyssa Rosenzweige09392f2019-08-20 14:34:09 -070032#include <ctype.h>
Alyssa Rosenzweigfc7bcee2019-06-11 12:25:35 -070033#include "decode.h"
Lionel Landwerlin66373952019-08-09 16:39:58 +030034#include "util/macros.h"
Alyssa Rosenzweigd699ffb2019-05-14 22:21:39 +000035#include "util/u_math.h"
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +000036
Alyssa Rosenzweigec2a59c2019-07-10 10:33:24 -070037#include "midgard/disassemble.h"
38#include "bifrost/disassemble.h"
39
Alyssa Rosenzweig25ed9302019-08-16 16:22:38 -070040#include "pan_encoder.h"
41
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +000042#define MEMORY_PROP(obj, p) {\
Alyssa Rosenzweig2608da12019-06-19 09:35:57 -070043 if (obj->p) { \
44 char *a = pointer_as_memory_reference(obj->p); \
45 pandecode_prop("%s = %s", #p, a); \
46 free(a); \
47 } \
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +000048}
49
Alyssa Rosenzweig0c1874a2019-07-12 08:47:35 -070050#define MEMORY_PROP_DIR(obj, p) {\
51 if (obj.p) { \
52 char *a = pointer_as_memory_reference(obj.p); \
53 pandecode_prop("%s = %s", #p, a); \
54 free(a); \
55 } \
56}
57
Boris Brezillonaa2670c2020-09-05 18:14:17 +020058#define DUMP_UNPACKED(T, var, ...) { \
Boris Brezillon670e8182020-09-09 17:56:53 +020059 pandecode_log(__VA_ARGS__); \
Boris Brezillonaa2670c2020-09-05 18:14:17 +020060 pan_print(pandecode_dump_stream, T, var, (pandecode_indent + 1) * 2); \
61}
62
63#define DUMP_CL(T, cl, ...) {\
Boris Brezillon62c0ef02020-09-05 18:04:43 +020064 pan_unpack(cl, T, temp); \
Boris Brezillonaa2670c2020-09-05 18:14:17 +020065 DUMP_UNPACKED(T, temp, __VA_ARGS__); \
Alyssa Rosenzweigd2ddd4d2020-08-05 19:43:58 -040066}
67
Boris Brezillon95eb7d92020-09-06 11:01:09 +020068#define DUMP_SECTION(A, S, cl, ...) { \
69 pan_section_unpack(cl, A, S, temp); \
70 pandecode_log(__VA_ARGS__); \
71 pan_section_print(pandecode_dump_stream, A, S, temp, (pandecode_indent + 1) * 2); \
72}
73
Alyssa Rosenzweig4e3fe542020-08-14 16:03:12 -040074#define MAP_ADDR(T, addr, cl) \
75 const uint8_t *cl = 0; \
76 { \
77 struct pandecode_mapped_memory *mapped_mem = pandecode_find_mapped_gpu_mem_containing(addr); \
78 cl = pandecode_fetch_gpu_mem(mapped_mem, addr, MALI_ ## T ## _LENGTH); \
79 }
80
Boris Brezillon670e8182020-09-09 17:56:53 +020081#define DUMP_ADDR(T, addr, ...) {\
Alyssa Rosenzweig4e3fe542020-08-14 16:03:12 -040082 MAP_ADDR(T, addr, cl) \
Boris Brezillon670e8182020-09-09 17:56:53 +020083 DUMP_CL(T, cl, __VA_ARGS__); \
Alyssa Rosenzweigd2ddd4d2020-08-05 19:43:58 -040084}
85
Icecream95be22c072020-01-23 10:14:35 +130086FILE *pandecode_dump_stream;
87
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +000088/* Semantic logging type.
89 *
90 * Raw: for raw messages to be printed as is.
91 * Message: for helpful information to be commented out in replays.
92 * Property: for properties of a struct
93 *
94 * Use one of pandecode_log, pandecode_msg, or pandecode_prop as syntax sugar.
95 */
96
97enum pandecode_log_type {
98 PANDECODE_RAW,
99 PANDECODE_MESSAGE,
100 PANDECODE_PROPERTY
101};
102
103#define pandecode_log(...) pandecode_log_typed(PANDECODE_RAW, __VA_ARGS__)
104#define pandecode_msg(...) pandecode_log_typed(PANDECODE_MESSAGE, __VA_ARGS__)
105#define pandecode_prop(...) pandecode_log_typed(PANDECODE_PROPERTY, __VA_ARGS__)
106
107unsigned pandecode_indent = 0;
108
109static void
110pandecode_make_indent(void)
111{
112 for (unsigned i = 0; i < pandecode_indent; ++i)
Boris Brezillon6249ae72020-09-09 17:52:23 +0200113 fprintf(pandecode_dump_stream, " ");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000114}
115
Boris Brezillonf9977f82020-09-29 10:25:56 +0200116static void PRINTFLIKE(2, 3)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000117pandecode_log_typed(enum pandecode_log_type type, const char *format, ...)
118{
119 va_list ap;
120
121 pandecode_make_indent();
122
123 if (type == PANDECODE_MESSAGE)
Icecream95be22c072020-01-23 10:14:35 +1300124 fprintf(pandecode_dump_stream, "// ");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000125 else if (type == PANDECODE_PROPERTY)
Icecream95be22c072020-01-23 10:14:35 +1300126 fprintf(pandecode_dump_stream, ".");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000127
128 va_start(ap, format);
Icecream95be22c072020-01-23 10:14:35 +1300129 vfprintf(pandecode_dump_stream, format, ap);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000130 va_end(ap);
131
132 if (type == PANDECODE_PROPERTY)
Icecream95be22c072020-01-23 10:14:35 +1300133 fprintf(pandecode_dump_stream, ",\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000134}
135
136static void
137pandecode_log_cont(const char *format, ...)
138{
139 va_list ap;
140
141 va_start(ap, format);
Icecream95be22c072020-01-23 10:14:35 +1300142 vfprintf(pandecode_dump_stream, format, ap);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000143 va_end(ap);
144}
145
Alyssa Rosenzweig4391c652019-08-19 15:14:48 -0700146/* To check for memory safety issues, validates that the given pointer in GPU
147 * memory is valid, containing at least sz bytes. The goal is to eliminate
148 * GPU-side memory bugs (NULL pointer dereferences, buffer overflows, or buffer
149 * overruns) by statically validating pointers.
150 */
151
152static void
153pandecode_validate_buffer(mali_ptr addr, size_t sz)
154{
155 if (!addr) {
156 pandecode_msg("XXX: null pointer deref");
157 return;
158 }
159
160 /* Find a BO */
161
162 struct pandecode_mapped_memory *bo =
163 pandecode_find_mapped_gpu_mem_containing(addr);
164
165 if (!bo) {
166 pandecode_msg("XXX: invalid memory dereference\n");
167 return;
168 }
169
170 /* Bounds check */
171
172 unsigned offset = addr - bo->gpu_va;
173 unsigned total = offset + sz;
174
175 if (total > bo->length) {
Alyssa Rosenzweigf38ce6e2019-08-21 16:06:23 -0700176 pandecode_msg("XXX: buffer overrun. "
Alyssa Rosenzweigbcfcb7e2019-08-30 17:02:43 -0700177 "Chunk of size %zu at offset %d in buffer of size %zu. "
178 "Overrun by %zu bytes. \n",
Alyssa Rosenzweig4391c652019-08-19 15:14:48 -0700179 sz, offset, bo->length, total - bo->length);
180 return;
181 }
182}
183
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700184/* Midgard's tiler descriptor is embedded within the
185 * larger FBD */
186
187static void
Alyssa Rosenzweiga8bd3ad2019-08-19 11:48:32 -0700188pandecode_midgard_tiler_descriptor(
Boris Brezillone8556982020-09-05 18:16:37 +0200189 const struct mali_midgard_tiler_packed *tp,
190 const struct mali_midgard_tiler_weights_packed *wp,
Alyssa Rosenzweiga8bd3ad2019-08-19 11:48:32 -0700191 unsigned width,
Alyssa Rosenzweig897110a2019-08-19 14:47:50 -0700192 unsigned height,
Alyssa Rosenzweig9fb09042019-11-27 08:31:16 -0500193 bool is_fragment,
194 bool has_hierarchy)
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700195{
Boris Brezillone8556982020-09-05 18:16:37 +0200196 pan_unpack(tp, MIDGARD_TILER, t);
197 DUMP_UNPACKED(MIDGARD_TILER, t, "Tiler:\n");
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700198
Boris Brezillone8556982020-09-05 18:16:37 +0200199 MEMORY_PROP_DIR(t, polygon_list);
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700200
Alyssa Rosenzweig52101e42019-08-19 10:38:25 -0700201 /* The body is offset from the base of the polygon list */
Alyssa Rosenzweigb010a6d2020-04-06 20:31:32 -0400202 //assert(t->polygon_list_body > t->polygon_list);
Boris Brezillone8556982020-09-05 18:16:37 +0200203 unsigned body_offset = t.polygon_list_body - t.polygon_list;
Alyssa Rosenzweig52101e42019-08-19 10:38:25 -0700204
205 /* It needs to fit inside the reported size */
Alyssa Rosenzweigb010a6d2020-04-06 20:31:32 -0400206 //assert(t->polygon_list_size >= body_offset);
Alyssa Rosenzweig52101e42019-08-19 10:38:25 -0700207
Alyssa Rosenzweiga8bd3ad2019-08-19 11:48:32 -0700208 /* Now that we've sanity checked, we'll try to calculate the sizes
209 * ourselves for comparison */
210
Boris Brezillone8556982020-09-05 18:16:37 +0200211 unsigned ref_header = panfrost_tiler_header_size(width, height, t.hierarchy_mask, has_hierarchy);
212 unsigned ref_size = panfrost_tiler_full_size(width, height, t.hierarchy_mask, has_hierarchy);
Alyssa Rosenzweiga8bd3ad2019-08-19 11:48:32 -0700213
Boris Brezillone8556982020-09-05 18:16:37 +0200214 if (!((ref_header == body_offset) && (ref_size == t.polygon_list_size))) {
Alyssa Rosenzweiga8bd3ad2019-08-19 11:48:32 -0700215 pandecode_msg("XXX: bad polygon list size (expected %d / 0x%x)\n",
216 ref_header, ref_size);
Boris Brezillone8556982020-09-05 18:16:37 +0200217 pandecode_prop("polygon_list_size = 0x%x", t.polygon_list_size);
Alyssa Rosenzweiga8bd3ad2019-08-19 11:48:32 -0700218 pandecode_msg("body offset %d\n", body_offset);
219 }
Alyssa Rosenzweig52101e42019-08-19 10:38:25 -0700220
Alyssa Rosenzweig897110a2019-08-19 14:47:50 -0700221 /* The tiler heap has a start and end specified -- it should be
222 * identical to what we have in the BO. The exception is if tiling is
223 * disabled. */
Alyssa Rosenzweig13d07972019-08-19 10:56:23 -0700224
Boris Brezillone8556982020-09-05 18:16:37 +0200225 MEMORY_PROP_DIR(t, heap_start);
226 assert(t.heap_end >= t.heap_start);
Alyssa Rosenzweig13d07972019-08-19 10:56:23 -0700227
Boris Brezillone8556982020-09-05 18:16:37 +0200228 unsigned heap_size = t.heap_end - t.heap_start;
Alyssa Rosenzweig13d07972019-08-19 10:56:23 -0700229
Alyssa Rosenzweig897110a2019-08-19 14:47:50 -0700230 /* Tiling is enabled with a special flag */
Boris Brezillone8556982020-09-05 18:16:37 +0200231 unsigned hierarchy_mask = t.hierarchy_mask & MALI_MIDGARD_TILER_HIERARCHY_MASK;
232 unsigned tiler_flags = t.hierarchy_mask ^ hierarchy_mask;
Alyssa Rosenzweig897110a2019-08-19 14:47:50 -0700233
234 bool tiling_enabled = hierarchy_mask;
235
236 if (tiling_enabled) {
Alyssa Rosenzweig897110a2019-08-19 14:47:50 -0700237 /* We should also have no other flags */
238 if (tiler_flags)
239 pandecode_msg("XXX: unexpected tiler %X\n", tiler_flags);
240 } else {
241 /* When tiling is disabled, we should have that flag and no others */
242
Boris Brezillone8556982020-09-05 18:16:37 +0200243 if (tiler_flags != MALI_MIDGARD_TILER_DISABLED) {
244 pandecode_msg("XXX: unexpected tiler flag %X, expected MALI_MIDGARD_TILER_DISABLED\n",
Alyssa Rosenzweig897110a2019-08-19 14:47:50 -0700245 tiler_flags);
246 }
247
248 /* We should also have an empty heap */
249 if (heap_size) {
250 pandecode_msg("XXX: tiler heap size %d given, expected empty\n",
251 heap_size);
252 }
253
254 /* Disabled tiling is used only for clear-only jobs, which are
255 * purely FRAGMENT, so we should never see this for
256 * non-FRAGMENT descriptors. */
257
258 if (!is_fragment)
259 pandecode_msg("XXX: tiler disabled for non-FRAGMENT job\n");
260 }
261
262 /* We've never seen weights used in practice, but we know from the
263 * kernel these fields is there */
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700264
Boris Brezillone8556982020-09-05 18:16:37 +0200265 pan_unpack(wp, MIDGARD_TILER_WEIGHTS, w);
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700266 bool nonzero_weights = false;
267
Boris Brezillone8556982020-09-05 18:16:37 +0200268 nonzero_weights |= w.weight0 != 0x0;
269 nonzero_weights |= w.weight1 != 0x0;
270 nonzero_weights |= w.weight2 != 0x0;
271 nonzero_weights |= w.weight3 != 0x0;
272 nonzero_weights |= w.weight4 != 0x0;
273 nonzero_weights |= w.weight5 != 0x0;
274 nonzero_weights |= w.weight6 != 0x0;
275 nonzero_weights |= w.weight7 != 0x0;
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700276
Boris Brezillone8556982020-09-05 18:16:37 +0200277 if (nonzero_weights)
278 DUMP_UNPACKED(MIDGARD_TILER_WEIGHTS, w, "Tiler Weights:\n");
Alyssa Rosenzweig31fc52a2019-07-10 07:22:19 -0700279}
280
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700281/* Information about the framebuffer passed back for
282 * additional analysis */
283
284struct pandecode_fbd {
285 unsigned width;
286 unsigned height;
287 unsigned rt_count;
288 bool has_extra;
289};
290
291static struct pandecode_fbd
Tomeu Vizoso697f02c2019-11-12 12:15:02 +0100292pandecode_sfbd(uint64_t gpu_va, int job_no, bool is_fragment, unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000293{
294 struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
Boris Brezillon95eb7d92020-09-06 11:01:09 +0200295 const void *PANDECODE_PTR_VAR(s, mem, (mali_ptr) gpu_va);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000296
Alyssa Rosenzweigd6d6d632019-08-30 17:00:09 -0700297 struct pandecode_fbd info = {
298 .has_extra = false,
299 .rt_count = 1
300 };
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700301
Boris Brezillon95eb7d92020-09-06 11:01:09 +0200302 pandecode_log("Single-Target Framebuffer:\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000303 pandecode_indent++;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000304
Boris Brezillon95eb7d92020-09-06 11:01:09 +0200305 DUMP_SECTION(SINGLE_TARGET_FRAMEBUFFER, LOCAL_STORAGE, s, "Local Storage:\n");
306 pan_section_unpack(s, SINGLE_TARGET_FRAMEBUFFER, PARAMETERS, p);
307 DUMP_UNPACKED(SINGLE_TARGET_FRAMEBUFFER_PARAMETERS, p, "Parameters:\n");
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700308
Boris Brezillon95eb7d92020-09-06 11:01:09 +0200309 const void *t = pan_section_ptr(s, SINGLE_TARGET_FRAMEBUFFER, TILER);
310 const void *w = pan_section_ptr(s, SINGLE_TARGET_FRAMEBUFFER, TILER_WEIGHTS);
Alyssa Rosenzweig9fb09042019-11-27 08:31:16 -0500311
312 bool has_hierarchy = !(gpu_id == 0x0720 || gpu_id == 0x0820 || gpu_id == 0x0830);
Boris Brezillon95eb7d92020-09-06 11:01:09 +0200313 pandecode_midgard_tiler_descriptor(t, w, p.bound_max_x + 1, p.bound_max_y + 1, is_fragment, has_hierarchy);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000314
315 pandecode_indent--;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000316
Boris Brezillon95eb7d92020-09-06 11:01:09 +0200317 /* Dummy unpack of the padding section to make sure all words are 0.
318 * No need to call print here since the section is supposed to be empty.
319 */
320 pan_section_unpack(s, SINGLE_TARGET_FRAMEBUFFER, PADDING_1, padding1);
321 pan_section_unpack(s, SINGLE_TARGET_FRAMEBUFFER, PADDING_2, padding2);
322 pandecode_log("\n");
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700323
324 return info;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000325}
326
327static void
Alyssa Rosenzweig0aa5d892019-06-19 08:41:51 -0700328pandecode_compute_fbd(uint64_t gpu_va, int job_no)
329{
330 struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
Boris Brezillon3a06fc32020-09-03 09:18:09 +0200331 const struct mali_local_storage_packed *PANDECODE_PTR_VAR(s, mem, (mali_ptr) gpu_va);
332 DUMP_CL(LOCAL_STORAGE, s, "Local Storage:\n");
Alyssa Rosenzweig0aa5d892019-06-19 08:41:51 -0700333}
334
Alyssa Rosenzweigf9430472019-02-24 06:22:23 +0000335static void
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200336pandecode_render_target(uint64_t gpu_va, unsigned job_no, bool is_bifrost, unsigned gpu_id,
337 const struct MALI_MULTI_TARGET_FRAMEBUFFER_PARAMETERS *fb)
Alyssa Rosenzweigf9430472019-02-24 06:22:23 +0000338{
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200339 pandecode_log("Color Render Targets:\n");
Alyssa Rosenzweigf9430472019-02-24 06:22:23 +0000340 pandecode_indent++;
341
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200342 for (int i = 0; i < (fb->render_target_count); i++) {
343 mali_ptr rt_va = gpu_va + i * MALI_RENDER_TARGET_LENGTH;
344 struct pandecode_mapped_memory *mem =
345 pandecode_find_mapped_gpu_mem_containing(rt_va);
346 const struct mali_render_target_packed *PANDECODE_PTR_VAR(rtp, mem, (mali_ptr) rt_va);
347 DUMP_CL(RENDER_TARGET, rtp, "Color Render Target %d:\n", i);
Alyssa Rosenzweige49204c2019-08-20 11:11:46 -0700348 }
Alyssa Rosenzweigb78e04c2019-08-14 16:01:38 -0700349
Alyssa Rosenzweigf9430472019-02-24 06:22:23 +0000350 pandecode_indent--;
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200351 pandecode_log("\n");
Alyssa Rosenzweigf9430472019-02-24 06:22:23 +0000352}
353
354static void
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200355pandecode_mfbd_bifrost_deps(const void *fb, int job_no)
Alyssa Rosenzweig8c88bd02019-06-11 14:56:30 -0700356{
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200357 pan_section_unpack(fb, MULTI_TARGET_FRAMEBUFFER, BIFROST_PARAMETERS, params);
358
359 /* The blob stores all possible sample locations in a single buffer
360 * allocated on startup, and just switches the pointer when switching
361 * MSAA state. For now, we just put the data into the cmdstream, but we
362 * should do something like what the blob does with a real driver.
363 *
364 * There seem to be 32 slots for sample locations, followed by another
365 * 16. The second 16 is just the center location followed by 15 zeros
366 * in all the cases I've identified (maybe shader vs. depth/color
367 * samples?).
368 */
369
370 struct pandecode_mapped_memory *smem =
371 pandecode_find_mapped_gpu_mem_containing(params.sample_locations);
372
373 const u16 *PANDECODE_PTR_VAR(samples, smem, params.sample_locations);
374
375 pandecode_log("uint16_t sample_locations_%d[] = {\n", job_no);
Alyssa Rosenzweig8c88bd02019-06-11 14:56:30 -0700376 pandecode_indent++;
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200377 for (int i = 0; i < 32 + 16; i++) {
378 pandecode_log("%d, %d,\n", samples[2 * i], samples[2 * i + 1]);
Alyssa Rosenzweig8c88bd02019-06-11 14:56:30 -0700379 }
380
381 pandecode_indent--;
382 pandecode_log("};\n");
383}
384
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700385static struct pandecode_fbd
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200386pandecode_mfbd_bfr(uint64_t gpu_va, int job_no, bool is_fragment, bool is_compute, bool is_bifrost, unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000387{
388 struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200389 const void *PANDECODE_PTR_VAR(fb, mem, (mali_ptr) gpu_va);
390 pan_section_unpack(fb, MULTI_TARGET_FRAMEBUFFER, PARAMETERS, params);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000391
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700392 struct pandecode_fbd info;
Alyssa Rosenzweig3f5cd442020-02-28 07:17:53 -0500393
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200394 if (is_bifrost)
395 pandecode_mfbd_bifrost_deps(fb, job_no);
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700396
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200397 pandecode_log("Multi-Target Framebuffer:\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000398 pandecode_indent++;
399
Alyssa Rosenzweig3f5cd442020-02-28 07:17:53 -0500400 if (is_bifrost) {
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200401 DUMP_SECTION(MULTI_TARGET_FRAMEBUFFER, BIFROST_PARAMETERS, fb, "Bifrost Params:\n");
Alyssa Rosenzweig3f5cd442020-02-28 07:17:53 -0500402 } else {
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200403 DUMP_SECTION(MULTI_TARGET_FRAMEBUFFER, LOCAL_STORAGE, fb, "Local Storage:\n");
Alyssa Rosenzweig3f5cd442020-02-28 07:17:53 -0500404 }
Alyssa Rosenzweig85e745f2019-06-12 09:33:06 -0700405
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200406 info.width = params.width;
407 info.height = params.height;
408 info.rt_count = params.render_target_count;
409 DUMP_UNPACKED(MULTI_TARGET_FRAMEBUFFER_PARAMETERS, params, "Parameters:\n");
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700410
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200411 if (!is_compute) {
412 if (is_bifrost) {
413 DUMP_SECTION(MULTI_TARGET_FRAMEBUFFER, BIFROST_TILER_POINTER, fb, "Tiler Pointer");
414 } else {
415 const void *t = pan_section_ptr(fb, MULTI_TARGET_FRAMEBUFFER, TILER);
416 const void *w = pan_section_ptr(fb, MULTI_TARGET_FRAMEBUFFER, TILER_WEIGHTS);
417 pandecode_midgard_tiler_descriptor(t, w, params.width, params.height, is_fragment, true);
Alyssa Rosenzweigc2c8b1a2020-05-26 18:10:39 -0400418 }
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200419 } else {
Alyssa Rosenzweig39939692020-01-22 08:51:19 -0500420 pandecode_msg("XXX: skipping compute MFBD, fixme\n");
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200421 }
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000422
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200423 if (is_bifrost) {
424 pan_section_unpack(fb, MULTI_TARGET_FRAMEBUFFER, BIFROST_PADDING, padding);
Alyssa Rosenzweig85e745f2019-06-12 09:33:06 -0700425 }
426
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000427 pandecode_indent--;
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200428 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000429
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200430 gpu_va += MALI_MULTI_TARGET_FRAMEBUFFER_LENGTH;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000431
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200432 info.has_extra = params.has_zs_crc_extension;
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700433
434 if (info.has_extra) {
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200435 struct pandecode_mapped_memory *mem =
436 pandecode_find_mapped_gpu_mem_containing(gpu_va);
437 const struct mali_zs_crc_extension_packed *PANDECODE_PTR_VAR(zs_crc, mem, (mali_ptr)gpu_va);
438 DUMP_CL(ZS_CRC_EXTENSION, zs_crc, "ZS CRC Extension:\n");
439 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000440
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200441 gpu_va += MALI_ZS_CRC_EXTENSION_LENGTH;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000442 }
443
Alyssa Rosenzweig897110a2019-08-19 14:47:50 -0700444 if (is_fragment)
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200445 pandecode_render_target(gpu_va, job_no, is_bifrost, gpu_id, &params);
Alyssa Rosenzweiga9fc1c82019-06-23 11:29:46 -0700446
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700447 return info;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000448}
449
450static void
Alyssa Rosenzweig7103baf2019-07-12 08:57:10 -0700451pandecode_attributes(const struct pandecode_mapped_memory *mem,
Alyssa Rosenzweig7318b522019-07-10 10:36:16 -0700452 mali_ptr addr, int job_no, char *suffix,
Alyssa Rosenzweigf4678f32019-08-22 13:27:38 -0700453 int count, bool varying, enum mali_job_type job_type)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000454{
Alyssa Rosenzweig4e3fe542020-08-14 16:03:12 -0400455 char *prefix = varying ? "Varying" : "Attribute";
Alyssa Rosenzweiged464e02019-08-22 13:07:01 -0700456 assert(addr);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000457
Alyssa Rosenzweiged464e02019-08-22 13:07:01 -0700458 if (!count) {
459 pandecode_msg("warn: No %s records\n", prefix);
Alyssa Rosenzweig5ad83012019-08-08 09:23:29 -0700460 return;
461 }
462
Alyssa Rosenzweig4e3fe542020-08-14 16:03:12 -0400463 MAP_ADDR(ATTRIBUTE_BUFFER, addr, cl);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000464
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000465 for (int i = 0; i < count; ++i) {
Boris Brezillon706974c2020-09-15 09:25:18 +0200466 pan_unpack(cl + i * MALI_ATTRIBUTE_BUFFER_LENGTH, ATTRIBUTE_BUFFER, temp);
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200467 DUMP_UNPACKED(ATTRIBUTE_BUFFER, temp, "%s:\n", prefix);
Alyssa Rosenzweigf4678f32019-08-22 13:27:38 -0700468
Boris Brezillon706974c2020-09-15 09:25:18 +0200469 if (temp.type != MALI_ATTRIBUTE_TYPE_1D_NPOT_DIVISOR)
470 continue;
471
472 pan_unpack(cl + (i + 1) * MALI_ATTRIBUTE_BUFFER_LENGTH,
473 ATTRIBUTE_BUFFER_CONTINUATION_NPOT, temp2);
474 pan_print(pandecode_dump_stream, ATTRIBUTE_BUFFER_CONTINUATION_NPOT,
475 temp2, (pandecode_indent + 1) * 2);
Alyssa Rosenzweig3b3d9652019-12-19 12:28:42 -0500476 }
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200477 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000478}
479
480static mali_ptr
Alyssa Rosenzweig7103baf2019-07-12 08:57:10 -0700481pandecode_shader_address(const char *name, mali_ptr ptr)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000482{
483 /* TODO: Decode flags */
484 mali_ptr shader_ptr = ptr & ~15;
485
486 char *a = pointer_as_memory_reference(shader_ptr);
487 pandecode_prop("%s = (%s) | %d", name, a, (int) (ptr & 15));
488 free(a);
489
490 return shader_ptr;
491}
492
Alyssa Rosenzweigae705382019-05-18 20:48:43 +0000493/* Decodes a Bifrost blend constant. See the notes in bifrost_blend_rt */
494
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +0000495static mali_ptr
Boris Brezillon83899762020-09-16 13:31:37 +0200496pandecode_bifrost_blend(void *descs, int job_no, int rt_no, mali_ptr frag_shader)
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +0000497{
Boris Brezillon83899762020-09-16 13:31:37 +0200498 pan_unpack(descs + (rt_no * MALI_BLEND_LENGTH), BLEND, b);
499 DUMP_UNPACKED(BLEND, b, "Blend RT %d:\n", rt_no);
Boris Brezillon8d707cd2020-10-12 14:16:53 +0200500 if (b.bifrost.internal.mode != MALI_BIFROST_BLEND_MODE_SHADER)
Alyssa Rosenzweigb6d46d02019-06-19 09:31:16 -0700501 return 0;
502
Boris Brezillon8d707cd2020-10-12 14:16:53 +0200503 return (frag_shader & 0xFFFFFFFF00000000ULL) | b.bifrost.internal.shader.pc;
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +0000504}
505
506static mali_ptr
507pandecode_midgard_blend_mrt(void *descs, int job_no, int rt_no)
508{
Boris Brezillon83899762020-09-16 13:31:37 +0200509 pan_unpack(descs + (rt_no * MALI_BLEND_LENGTH), BLEND, b);
510 DUMP_UNPACKED(BLEND, b, "Blend RT %d:\n", rt_no);
511 return b.midgard.blend_shader ? (b.midgard.shader_pc & ~0xf) : 0;
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +0000512}
513
Alyssa Rosenzweig2208eb92019-08-20 13:59:26 -0700514/* Attributes and varyings have descriptor records, which contain information
515 * about their format and ordering with the attribute/varying buffers. We'll
516 * want to validate that the combinations specified are self-consistent.
517 */
518
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000519static int
Alyssa Rosenzweig68552282020-08-26 16:50:16 -0400520pandecode_attribute_meta(int count, mali_ptr attribute, bool varying, char *suffix)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000521{
Alyssa Rosenzweig68552282020-08-26 16:50:16 -0400522 for (int i = 0; i < count; ++i, attribute += MALI_ATTRIBUTE_LENGTH)
Boris Brezillon670e8182020-09-09 17:56:53 +0200523 DUMP_ADDR(ATTRIBUTE, attribute, "%s:\n", varying ? "Varying" : "Attribute");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000524
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200525 pandecode_log("\n");
Alyssa Rosenzweig2c8a7222020-08-13 13:27:16 -0400526 return count;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000527}
528
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000529/* return bits [lo, hi) of word */
530static u32
531bits(u32 word, u32 lo, u32 hi)
532{
533 if (hi - lo >= 32)
534 return word; // avoid undefined behavior with the shift
535
536 return (word >> lo) & ((1 << (hi - lo)) - 1);
537}
538
539static void
Boris Brezillond2892092020-09-08 19:41:51 +0200540pandecode_invocation(const void *i, bool graphics)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000541{
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000542 /* Decode invocation_count. See the comment before the definition of
543 * invocation_count for an explanation.
544 */
Boris Brezillond2892092020-09-08 19:41:51 +0200545 pan_unpack(i, INVOCATION, invocation);
Alyssa Rosenzweig25ed9302019-08-16 16:22:38 -0700546
Alyssa Rosenzweig02e768e2020-08-26 13:04:17 -0400547 unsigned size_x = bits(invocation.invocations, 0, invocation.size_y_shift) + 1;
548 unsigned size_y = bits(invocation.invocations, invocation.size_y_shift, invocation.size_z_shift) + 1;
549 unsigned size_z = bits(invocation.invocations, invocation.size_z_shift, invocation.workgroups_x_shift) + 1;
Alyssa Rosenzweig25ed9302019-08-16 16:22:38 -0700550
Alyssa Rosenzweig02e768e2020-08-26 13:04:17 -0400551 unsigned groups_x = bits(invocation.invocations, invocation.workgroups_x_shift, invocation.workgroups_y_shift) + 1;
552 unsigned groups_y = bits(invocation.invocations, invocation.workgroups_y_shift, invocation.workgroups_z_shift) + 1;
553 unsigned groups_z = bits(invocation.invocations, invocation.workgroups_z_shift, 32) + 1;
Alyssa Rosenzweig25ed9302019-08-16 16:22:38 -0700554
555 /* Even though we have this decoded, we want to ensure that the
556 * representation is "unique" so we don't lose anything by printing only
557 * the final result. More specifically, we need to check that we were
558 * passed something in canonical form, since the definition per the
559 * hardware is inherently not unique. How? Well, take the resulting
560 * decode and pack it ourselves! If it is bit exact with what we
561 * decoded, we're good to go. */
562
Alyssa Rosenzweig02e768e2020-08-26 13:04:17 -0400563 struct mali_invocation_packed ref;
Alyssa Rosenzweig385a4f72019-12-24 22:33:47 -0500564 panfrost_pack_work_groups_compute(&ref, groups_x, groups_y, groups_z, size_x, size_y, size_z, graphics);
Alyssa Rosenzweig25ed9302019-08-16 16:22:38 -0700565
Boris Brezillond2892092020-09-08 19:41:51 +0200566 if (memcmp(&ref, i, sizeof(ref))) {
Alyssa Rosenzweig25ed9302019-08-16 16:22:38 -0700567 pandecode_msg("XXX: non-canonical workgroups packing\n");
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200568 DUMP_UNPACKED(INVOCATION, invocation, "Invocation:\n")
Alyssa Rosenzweig25ed9302019-08-16 16:22:38 -0700569 }
570
571 /* Regardless, print the decode */
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200572 pandecode_log("Invocation (%d, %d, %d) x (%d, %d, %d)\n",
573 size_x, size_y, size_z,
574 groups_x, groups_y, groups_z);
Boris Brezillond2892092020-09-08 19:41:51 +0200575}
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000576
Boris Brezillond2892092020-09-08 19:41:51 +0200577static void
578pandecode_primitive(const void *p)
579{
580 pan_unpack(p, PRIMITIVE, primitive);
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200581 DUMP_UNPACKED(PRIMITIVE, primitive, "Primitive:\n");
Alyssa Rosenzweigf38ce6e2019-08-21 16:06:23 -0700582
583 /* Validate an index buffer is present if we need one. TODO: verify
584 * relationship between invocation_count and index_count */
585
Alyssa Rosenzweigb60d5672020-08-25 16:59:14 -0400586 if (primitive.indices) {
Alyssa Rosenzweigf38ce6e2019-08-21 16:06:23 -0700587 /* Grab the size */
Alyssa Rosenzweigb60d5672020-08-25 16:59:14 -0400588 unsigned size = (primitive.index_type == MALI_INDEX_TYPE_UINT32) ?
589 sizeof(uint32_t) : primitive.index_type;
Alyssa Rosenzweigf38ce6e2019-08-21 16:06:23 -0700590
591 /* Ensure we got a size, and if so, validate the index buffer
592 * is large enough to hold a full set of indices of the given
593 * size */
594
Alyssa Rosenzweigb60d5672020-08-25 16:59:14 -0400595 if (!size)
Alyssa Rosenzweigf38ce6e2019-08-21 16:06:23 -0700596 pandecode_msg("XXX: index size missing\n");
597 else
Alyssa Rosenzweigb60d5672020-08-25 16:59:14 -0400598 pandecode_validate_buffer(primitive.indices, primitive.index_count * size);
599 } else if (primitive.index_type)
600 pandecode_msg("XXX: unexpected index size\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000601}
602
603static void
Alyssa Rosenzweig7103baf2019-07-12 08:57:10 -0700604pandecode_uniform_buffers(mali_ptr pubufs, int ubufs_count, int job_no)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000605{
606 struct pandecode_mapped_memory *umem = pandecode_find_mapped_gpu_mem_containing(pubufs);
Alyssa Rosenzweig7d3c48f2020-02-16 17:01:02 -0500607 uint64_t *PANDECODE_PTR_VAR(ubufs, umem, pubufs);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000608
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000609 for (int i = 0; i < ubufs_count; i++) {
Alyssa Rosenzweig7d3c48f2020-02-16 17:01:02 -0500610 unsigned size = (ubufs[i] & ((1 << 10) - 1)) * 16;
611 mali_ptr addr = (ubufs[i] >> 10) << 2;
Alyssa Rosenzweig4aeb6942019-08-19 15:16:01 -0700612
613 pandecode_validate_buffer(addr, size);
614
Alyssa Rosenzweig7d3c48f2020-02-16 17:01:02 -0500615 char *ptr = pointer_as_memory_reference(addr);
Alyssa Rosenzweig6ec33b42019-08-21 11:46:06 -0700616 pandecode_log("ubuf_%d[%u] = %s;\n", i, size, ptr);
Alyssa Rosenzweig4aeb6942019-08-19 15:16:01 -0700617 free(ptr);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000618 }
619
Alyssa Rosenzweig6ec33b42019-08-21 11:46:06 -0700620 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000621}
622
623static void
Alyssa Rosenzweigae84f162019-08-22 11:30:13 -0700624pandecode_uniforms(mali_ptr uniforms, unsigned uniform_count)
625{
626 pandecode_validate_buffer(uniforms, uniform_count * 16);
627
628 char *ptr = pointer_as_memory_reference(uniforms);
629 pandecode_log("vec4 uniforms[%u] = %s;\n", uniform_count, ptr);
630 free(ptr);
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200631 pandecode_log("\n");
Alyssa Rosenzweigae84f162019-08-22 11:30:13 -0700632}
633
Alyssa Rosenzweig09671c82019-12-23 11:40:40 -0500634static const char *
635shader_type_for_job(unsigned type)
636{
637 switch (type) {
Alyssa Rosenzweig4b7056b2020-08-05 18:40:44 -0400638 case MALI_JOB_TYPE_VERTEX: return "VERTEX";
639 case MALI_JOB_TYPE_TILER: return "FRAGMENT";
640 case MALI_JOB_TYPE_COMPUTE: return "COMPUTE";
Alyssa Rosenzweig80049062020-08-26 16:52:53 -0400641 default: return "UNKNOWN";
Alyssa Rosenzweig09671c82019-12-23 11:40:40 -0500642 }
643}
644
Alyssa Rosenzweigc4a4f3d2019-08-14 09:19:54 -0700645static unsigned shader_id = 0;
646
Alyssa Rosenzweig58fc2602019-08-21 14:00:46 -0700647static struct midgard_disasm_stats
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000648pandecode_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type,
Tomeu Vizoso072207b2019-11-07 08:27:53 +0100649 bool is_bifrost, unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000650{
651 struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(shader_ptr);
652 uint8_t *PANDECODE_PTR_VAR(code, mem, shader_ptr);
653
654 /* Compute maximum possible size */
655 size_t sz = mem->length - (shader_ptr - mem->gpu_va);
656
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000657 /* Print some boilerplate to clearly denote the assembly (which doesn't
658 * obey indentation rules), and actually do the disassembly! */
659
Icecream95be22c072020-01-23 10:14:35 +1300660 pandecode_log_cont("\n\n");
Alyssa Rosenzweig50382df2019-05-18 18:58:56 +0000661
Alyssa Rosenzweig58fc2602019-08-21 14:00:46 -0700662 struct midgard_disasm_stats stats;
Alyssa Rosenzweigc4a4f3d2019-08-14 09:19:54 -0700663
Alyssa Rosenzweig50382df2019-05-18 18:58:56 +0000664 if (is_bifrost) {
Alyssa Rosenzweigc88f8162020-03-27 22:34:15 -0400665 disassemble_bifrost(pandecode_dump_stream, code, sz, true);
Alyssa Rosenzweig58fc2602019-08-21 14:00:46 -0700666
667 /* TODO: Extend stats to Bifrost */
Alyssa Rosenzweigcbbf7542019-08-21 14:57:23 -0700668 stats.texture_count = -128;
669 stats.sampler_count = -128;
670 stats.attribute_count = -128;
671 stats.varying_count = -128;
672 stats.uniform_count = -128;
673 stats.uniform_buffer_count = -128;
674 stats.work_count = -128;
Alyssa Rosenzweig58fc2602019-08-21 14:00:46 -0700675
676 stats.instruction_count = 0;
677 stats.bundle_count = 0;
678 stats.quadword_count = 0;
Alyssa Rosenzweigd6d6d632019-08-30 17:00:09 -0700679 stats.helper_invocations = false;
Alyssa Rosenzweig50382df2019-05-18 18:58:56 +0000680 } else {
Icecream95be22c072020-01-23 10:14:35 +1300681 stats = disassemble_midgard(pandecode_dump_stream,
682 code, sz, gpu_id,
Alyssa Rosenzweig4b7056b2020-08-05 18:40:44 -0400683 type == MALI_JOB_TYPE_TILER ?
Alyssa Rosenzweigac14fac2019-11-07 09:31:02 -0500684 MESA_SHADER_FRAGMENT : MESA_SHADER_VERTEX);
Alyssa Rosenzweig50382df2019-05-18 18:58:56 +0000685 }
686
Alyssa Rosenzweigc088a3b2020-08-26 16:52:23 -0400687 unsigned nr_threads =
688 (stats.work_count <= 4) ? 4 :
689 (stats.work_count <= 8) ? 2 :
690 1;
Alyssa Rosenzweig58fc2602019-08-21 14:00:46 -0700691
Alyssa Rosenzweigc088a3b2020-08-26 16:52:23 -0400692 pandecode_log_cont("shader%d - MESA_SHADER_%s shader: "
693 "%u inst, %u bundles, %u quadwords, "
694 "%u registers, %u threads, 0 loops, 0:0 spills:fills\n\n\n",
695 shader_id++,
696 shader_type_for_job(type),
697 stats.instruction_count, stats.bundle_count, stats.quadword_count,
698 stats.work_count, nr_threads);
Alyssa Rosenzweig58fc2602019-08-21 14:00:46 -0700699
700 return stats;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000701}
702
703static void
Alyssa Rosenzweiga3d29362020-04-21 16:08:07 -0400704pandecode_texture_payload(mali_ptr payload,
Alyssa Rosenzweigf008a632020-08-11 17:27:36 -0400705 enum mali_texture_dimension dim,
Alyssa Rosenzweiga3d29362020-04-21 16:08:07 -0400706 enum mali_texture_layout layout,
707 bool manual_stride,
708 uint8_t levels,
709 uint16_t depth,
710 uint16_t array_size,
711 struct pandecode_mapped_memory *tmem)
712{
713 pandecode_log(".payload = {\n");
714 pandecode_indent++;
715
716 /* A bunch of bitmap pointers follow.
717 * We work out the correct number,
718 * based on the mipmap/cubemap
719 * properties, but dump extra
720 * possibilities to futureproof */
721
722 int bitmap_count = levels + 1;
723
724 /* Miptree for each face */
Alyssa Rosenzweigf008a632020-08-11 17:27:36 -0400725 if (dim == MALI_TEXTURE_DIMENSION_CUBE)
Alyssa Rosenzweiga3d29362020-04-21 16:08:07 -0400726 bitmap_count *= 6;
Alyssa Rosenzweigeba9bcd2020-06-30 16:21:30 -0400727
728 /* Array of layers */
Alyssa Rosenzweigf008a632020-08-11 17:27:36 -0400729 bitmap_count *= depth;
Alyssa Rosenzweiga3d29362020-04-21 16:08:07 -0400730
731 /* Array of textures */
Alyssa Rosenzweigf008a632020-08-11 17:27:36 -0400732 bitmap_count *= array_size;
Alyssa Rosenzweiga3d29362020-04-21 16:08:07 -0400733
734 /* Stride for each element */
735 if (manual_stride)
736 bitmap_count *= 2;
737
738 mali_ptr *pointers_and_strides = pandecode_fetch_gpu_mem(tmem,
739 payload, sizeof(mali_ptr) * bitmap_count);
740 for (int i = 0; i < bitmap_count; ++i) {
741 /* How we dump depends if this is a stride or a pointer */
742
743 if (manual_stride && (i & 1)) {
744 /* signed 32-bit snuck in as a 64-bit pointer */
745 uint64_t stride_set = pointers_and_strides[i];
746 uint32_t clamped_stride = stride_set;
747 int32_t stride = clamped_stride;
748 assert(stride_set == clamped_stride);
749 pandecode_log("(mali_ptr) %d /* stride */, \n", stride);
750 } else {
751 char *a = pointer_as_memory_reference(pointers_and_strides[i]);
752 pandecode_log("%s, \n", a);
753 free(a);
754 }
755 }
756
757 pandecode_indent--;
758 pandecode_log("},\n");
759}
760
761static void
Alyssa Rosenzweig8fc4ca82019-08-20 14:48:55 -0700762pandecode_texture(mali_ptr u,
763 struct pandecode_mapped_memory *tmem,
764 unsigned job_no, unsigned tex)
765{
Alyssa Rosenzweigf008a632020-08-11 17:27:36 -0400766 struct pandecode_mapped_memory *mapped_mem = pandecode_find_mapped_gpu_mem_containing(u);
767 const uint8_t *cl = pandecode_fetch_gpu_mem(mapped_mem, u, MALI_MIDGARD_TEXTURE_LENGTH);
Alyssa Rosenzweig8fc4ca82019-08-20 14:48:55 -0700768
Boris Brezillon706974c2020-09-15 09:25:18 +0200769 pan_unpack(cl, MIDGARD_TEXTURE, temp);
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200770 DUMP_UNPACKED(MIDGARD_TEXTURE, temp, "Texture:\n")
Alyssa Rosenzweig8fc4ca82019-08-20 14:48:55 -0700771
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200772 pandecode_indent++;
Alyssa Rosenzweigf008a632020-08-11 17:27:36 -0400773 pandecode_texture_payload(u + MALI_MIDGARD_TEXTURE_LENGTH,
774 temp.dimension, temp.texel_ordering, temp.manual_stride,
775 temp.levels, temp.depth, temp.array_size, mapped_mem);
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200776 pandecode_indent--;
Alyssa Rosenzweig8fc4ca82019-08-20 14:48:55 -0700777}
778
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400779static void
Alyssa Rosenzweiga3d29362020-04-21 16:08:07 -0400780pandecode_bifrost_texture(
Alyssa Rosenzweigad0b32c2020-08-06 18:12:28 -0400781 const void *cl,
Alyssa Rosenzweiga3d29362020-04-21 16:08:07 -0400782 unsigned job_no,
783 unsigned tex)
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400784{
Boris Brezillon706974c2020-09-15 09:25:18 +0200785 pan_unpack(cl, BIFROST_TEXTURE, temp);
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200786 DUMP_UNPACKED(BIFROST_TEXTURE, temp, "Texture:\n")
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400787
Alyssa Rosenzweigad0b32c2020-08-06 18:12:28 -0400788 struct pandecode_mapped_memory *tmem = pandecode_find_mapped_gpu_mem_containing(temp.surfaces);
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200789 pandecode_indent++;
Alyssa Rosenzweigad0b32c2020-08-06 18:12:28 -0400790 pandecode_texture_payload(temp.surfaces, temp.dimension, temp.texel_ordering,
791 true, temp.levels, 1, 1, tmem);
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200792 pandecode_indent--;
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400793}
794
Alyssa Rosenzweigcbbf7542019-08-21 14:57:23 -0700795/* For shader properties like texture_count, we have a claimed property in the shader_meta, and the actual Truth from static analysis (this may just be an upper limit). We validate accordingly */
796
797static void
798pandecode_shader_prop(const char *name, unsigned claim, signed truth, bool fuzzy)
799{
800 /* Nothing to do */
801 if (claim == truth)
802 return;
803
Alyssa Rosenzweig5815f332020-02-25 17:29:55 -0500804 if (fuzzy && (truth < 0))
805 pandecode_msg("XXX: fuzzy %s, claimed %d, expected %d\n", name, claim, truth);
Alyssa Rosenzweigcbbf7542019-08-21 14:57:23 -0700806
807 if ((truth >= 0) && !fuzzy) {
Alyssa Rosenzweigf48136e2019-08-22 09:02:48 -0700808 pandecode_msg("%s: expected %s = %d, claimed %u\n",
809 (truth < claim) ? "warn" : "XXX",
Alyssa Rosenzweigcbbf7542019-08-21 14:57:23 -0700810 name, truth, claim);
811 } else if ((claim > -truth) && !fuzzy) {
812 pandecode_msg("XXX: expected %s <= %u, claimed %u\n",
813 name, -truth, claim);
814 } else if (fuzzy && (claim < truth))
815 pandecode_msg("XXX: expected %s >= %u, claimed %u\n",
816 name, truth, claim);
817
818 pandecode_log(".%s = %" PRId16, name, claim);
819
820 if (fuzzy)
821 pandecode_log_cont(" /* %u used */", truth);
822
823 pandecode_log_cont(",\n");
824}
825
Alyssa Rosenzweig8fc4ca82019-08-20 14:48:55 -0700826static void
Tomeu Vizoso8e1ae5f2019-11-05 15:31:42 +0100827pandecode_blend_shader_disassemble(mali_ptr shader, int job_no, int job_type,
Tomeu Vizoso072207b2019-11-07 08:27:53 +0100828 bool is_bifrost, unsigned gpu_id)
Tomeu Vizoso8e1ae5f2019-11-05 15:31:42 +0100829{
830 struct midgard_disasm_stats stats =
Tomeu Vizoso072207b2019-11-07 08:27:53 +0100831 pandecode_shader_disassemble(shader, job_no, job_type, is_bifrost, gpu_id);
Tomeu Vizoso8e1ae5f2019-11-05 15:31:42 +0100832
833 bool has_texture = (stats.texture_count > 0);
834 bool has_sampler = (stats.sampler_count > 0);
835 bool has_attribute = (stats.attribute_count > 0);
836 bool has_varying = (stats.varying_count > 0);
837 bool has_uniform = (stats.uniform_count > 0);
838 bool has_ubo = (stats.uniform_buffer_count > 0);
839
840 if (has_texture || has_sampler)
841 pandecode_msg("XXX: blend shader accessing textures\n");
842
843 if (has_attribute || has_varying)
844 pandecode_msg("XXX: blend shader accessing interstage\n");
845
846 if (has_uniform || has_ubo)
847 pandecode_msg("XXX: blend shader accessing uniforms\n");
848}
849
850static void
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400851pandecode_textures(mali_ptr textures, unsigned texture_count, int job_no, bool is_bifrost)
852{
853 struct pandecode_mapped_memory *mmem = pandecode_find_mapped_gpu_mem_containing(textures);
854
855 if (!mmem)
856 return;
857
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200858 pandecode_log("Textures %"PRIx64"_%d:\n", textures, job_no);
859 pandecode_indent++;
Alyssa Rosenzweigad0b32c2020-08-06 18:12:28 -0400860
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400861 if (is_bifrost) {
Alyssa Rosenzweigad0b32c2020-08-06 18:12:28 -0400862 const void *cl = pandecode_fetch_gpu_mem(mmem,
863 textures, MALI_BIFROST_TEXTURE_LENGTH *
864 texture_count);
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400865
Alyssa Rosenzweigad0b32c2020-08-06 18:12:28 -0400866 for (unsigned tex = 0; tex < texture_count; ++tex) {
867 pandecode_bifrost_texture(cl +
868 MALI_BIFROST_TEXTURE_LENGTH * tex,
869 job_no, tex);
870 }
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400871 } else {
872 mali_ptr *PANDECODE_PTR_VAR(u, mmem, textures);
873
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400874 for (int tex = 0; tex < texture_count; ++tex) {
875 mali_ptr *PANDECODE_PTR_VAR(u, mmem, textures + tex * sizeof(mali_ptr));
876 char *a = pointer_as_memory_reference(*u);
877 pandecode_log("%s,\n", a);
878 free(a);
879 }
880
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400881 /* Now, finally, descend down into the texture descriptor */
882 for (unsigned tex = 0; tex < texture_count; ++tex) {
883 mali_ptr *PANDECODE_PTR_VAR(u, mmem, textures + tex * sizeof(mali_ptr));
884 struct pandecode_mapped_memory *tmem = pandecode_find_mapped_gpu_mem_containing(*u);
885 if (tmem)
886 pandecode_texture(*u, tmem, job_no, tex);
887 }
888 }
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200889 pandecode_indent--;
890 pandecode_log("\n");
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400891}
892
893static void
894pandecode_samplers(mali_ptr samplers, unsigned sampler_count, int job_no, bool is_bifrost)
895{
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200896 pandecode_log("Samplers %"PRIx64"_%d:\n", samplers, job_no);
897 pandecode_indent++;
898
Alyssa Rosenzweigb10c3c82020-08-11 18:25:03 -0400899 for (int i = 0; i < sampler_count; ++i) {
900 if (is_bifrost) {
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200901 DUMP_ADDR(BIFROST_SAMPLER, samplers + (MALI_BIFROST_SAMPLER_LENGTH * i), "Sampler %d:\n", i);
Alyssa Rosenzweigb10c3c82020-08-11 18:25:03 -0400902 } else {
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200903 DUMP_ADDR(MIDGARD_SAMPLER, samplers + (MALI_MIDGARD_SAMPLER_LENGTH * i), "Sampler %d:\n", i);
Alyssa Rosenzweigb10c3c82020-08-11 18:25:03 -0400904 }
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400905 }
Boris Brezillonb1c3f632020-09-10 12:46:33 +0200906
907 pandecode_indent--;
908 pandecode_log("\n");
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -0400909}
910
911static void
Alyssa Rosenzweig8fc4ca82019-08-20 14:48:55 -0700912pandecode_vertex_tiler_postfix_pre(
Alyssa Rosenzweig76028912020-08-26 17:05:41 -0400913 const struct MALI_DRAW *p,
Alyssa Rosenzweig7318b522019-07-10 10:36:16 -0700914 int job_no, enum mali_job_type job_type,
Tomeu Vizoso072207b2019-11-07 08:27:53 +0100915 char *suffix, bool is_bifrost, unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000916{
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000917 struct pandecode_mapped_memory *attr_mem;
918
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -0700919 struct pandecode_fbd fbd_info = {
920 /* Default for Bifrost */
921 .rt_count = 1
922 };
923
Alyssa Rosenzweig76028912020-08-26 17:05:41 -0400924 if (is_bifrost)
Boris Brezillond343f232020-09-29 10:45:23 +0200925 pandecode_compute_fbd(p->fbd & ~1, job_no);
926 else if (p->fbd & MALI_FBD_TAG_IS_MFBD)
927 fbd_info = pandecode_mfbd_bfr((u64) ((uintptr_t) p->fbd) & ~MALI_FBD_TAG_MASK,
Boris Brezillon5d5f7552020-09-08 10:17:40 +0200928 job_no, false, job_type == MALI_JOB_TYPE_COMPUTE, is_bifrost, gpu_id);
Alyssa Rosenzweig4b7056b2020-08-05 18:40:44 -0400929 else if (job_type == MALI_JOB_TYPE_COMPUTE)
Boris Brezillond343f232020-09-29 10:45:23 +0200930 pandecode_compute_fbd((u64) (uintptr_t) p->fbd, job_no);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000931 else
Boris Brezillond343f232020-09-29 10:45:23 +0200932 fbd_info = pandecode_sfbd((u64) (uintptr_t) p->fbd, job_no, false, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000933
934 int varying_count = 0, attribute_count = 0, uniform_count = 0, uniform_buffer_count = 0;
935 int texture_count = 0, sampler_count = 0;
936
Alyssa Rosenzweig76028912020-08-26 17:05:41 -0400937 if (p->state) {
938 struct pandecode_mapped_memory *smem = pandecode_find_mapped_gpu_mem_containing(p->state);
Boris Brezillonf734e672020-09-29 15:47:04 +0200939 uint32_t *cl = pandecode_fetch_gpu_mem(smem, p->state, MALI_RENDERER_STATE_LENGTH);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000940
Alyssa Rosenzweigcbbf7542019-08-21 14:57:23 -0700941 /* Disassemble ahead-of-time to get stats. Initialize with
942 * stats for the missing-shader case so we get validation
943 * there, too */
944
945 struct midgard_disasm_stats info = {
946 .texture_count = 0,
947 .sampler_count = 0,
948 .attribute_count = 0,
949 .varying_count = 0,
950 .work_count = 1,
951
952 .uniform_count = -128,
953 .uniform_buffer_count = 0
954 };
Alyssa Rosenzweig9b067d92019-08-21 14:28:36 -0700955
Boris Brezillonf734e672020-09-29 15:47:04 +0200956 pan_unpack(cl, RENDERER_STATE, state);
Alyssa Rosenzweig661b4692020-08-21 10:34:06 -0400957
Alyssa Rosenzweig3d7ce132020-08-21 19:59:22 -0400958 if (state.shader.shader & ~0xF)
959 info = pandecode_shader_disassemble(state.shader.shader & ~0xF, job_no, job_type, is_bifrost, gpu_id);
Alyssa Rosenzweig661b4692020-08-21 10:34:06 -0400960
Boris Brezillonf734e672020-09-29 15:47:04 +0200961 DUMP_UNPACKED(RENDERER_STATE, state, "State:\n");
Boris Brezillonaa2670c2020-09-05 18:14:17 +0200962 pandecode_indent++;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000963
964 /* Save for dumps */
Alyssa Rosenzweig3d7ce132020-08-21 19:59:22 -0400965 attribute_count = state.shader.attribute_count;
966 varying_count = state.shader.varying_count;
967 texture_count = state.shader.texture_count;
968 sampler_count = state.shader.sampler_count;
Boris Brezillon7bb85ea2020-09-15 17:03:28 +0200969 uniform_buffer_count = state.properties.uniform_buffer_count;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000970
Boris Brezillon7bb85ea2020-09-15 17:03:28 +0200971 if (is_bifrost)
Alyssa Rosenzweig3d7ce132020-08-21 19:59:22 -0400972 uniform_count = state.preload.uniform_count;
Boris Brezillon7bb85ea2020-09-15 17:03:28 +0200973 else
Boris Brezillon519643b2020-10-13 18:32:14 +0200974 uniform_count = state.properties.midgard.uniform_count;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000975
Alyssa Rosenzweig661b4692020-08-21 10:34:06 -0400976 pandecode_shader_prop("texture_count", texture_count, info.texture_count, false);
977 pandecode_shader_prop("sampler_count", sampler_count, info.sampler_count, false);
978 pandecode_shader_prop("attribute_count", attribute_count, info.attribute_count, false);
979 pandecode_shader_prop("varying_count", varying_count, info.varying_count, false);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000980
Boris Brezillon7bb85ea2020-09-15 17:03:28 +0200981 if (is_bifrost)
982 DUMP_UNPACKED(PRELOAD, state.preload, "Preload:\n");
Alyssa Rosenzweig7a95ed22020-08-20 20:42:32 -0400983
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +0000984 if (!is_bifrost) {
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +0000985 /* TODO: Blend shaders routing/disasm */
Boris Brezillon713419e2020-09-16 10:26:06 +0200986 pandecode_log("SFBD Blend:\n");
987 pandecode_indent++;
Boris Brezillon7bb85ea2020-09-15 17:03:28 +0200988 if (state.multisample_misc.sfbd_blend_shader) {
Boris Brezillon713419e2020-09-16 10:26:06 +0200989 pandecode_shader_address("Shader", state.sfbd_blend_shader);
Boris Brezillon7bb85ea2020-09-15 17:03:28 +0200990 } else {
Boris Brezillon713419e2020-09-16 10:26:06 +0200991 DUMP_UNPACKED(BLEND_EQUATION, state.sfbd_blend_equation, "Equation:\n");
992 pandecode_prop("Constant = %f", state.sfbd_blend_constant);
Boris Brezillon7bb85ea2020-09-15 17:03:28 +0200993 }
Boris Brezillon713419e2020-09-16 10:26:06 +0200994 pandecode_indent--;
995 pandecode_log("\n");
996
997 mali_ptr shader = state.sfbd_blend_shader & ~0xF;
998 if (state.multisample_misc.sfbd_blend_shader && shader)
Tomeu Vizoso072207b2019-11-07 08:27:53 +0100999 pandecode_blend_shader_disassemble(shader, job_no, job_type, false, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001000 }
Boris Brezillonaa2670c2020-09-05 18:14:17 +02001001 pandecode_indent--;
Boris Brezillonb1c3f632020-09-10 12:46:33 +02001002 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001003
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +00001004 /* MRT blend fields are used whenever MFBD is used, with
1005 * per-RT descriptors */
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001006
Boris Brezillon5d5f7552020-09-08 10:17:40 +02001007 if (job_type == MALI_JOB_TYPE_TILER &&
Boris Brezillond343f232020-09-29 10:45:23 +02001008 (is_bifrost || p->fbd & MALI_FBD_TAG_IS_MFBD)) {
Boris Brezillonf734e672020-09-29 15:47:04 +02001009 void* blend_base = ((void *) cl) + MALI_RENDERER_STATE_LENGTH;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001010
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001011 for (unsigned i = 0; i < fbd_info.rt_count; i++) {
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +00001012 mali_ptr shader = 0;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001013
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +00001014 if (is_bifrost)
Boris Brezillon83899762020-09-16 13:31:37 +02001015 shader = pandecode_bifrost_blend(blend_base, job_no, i,
1016 state.shader.shader);
1017 else
Alyssa Rosenzweig050b9342019-05-04 21:57:01 +00001018 shader = pandecode_midgard_blend_mrt(blend_base, job_no, i);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001019
Tomeu Vizoso8e1ae5f2019-11-05 15:31:42 +01001020 if (shader & ~0xF)
Boris Brezillon83899762020-09-16 13:31:37 +02001021 pandecode_blend_shader_disassemble(shader, job_no, job_type,
1022 is_bifrost, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001023 }
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001024 }
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001025 } else
Alyssa Rosenzweig5f9a1c72019-08-21 14:16:32 -07001026 pandecode_msg("XXX: missing shader descriptor\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001027
Boris Brezillonb1c3f632020-09-10 12:46:33 +02001028 if (p->viewport) {
Boris Brezillon670e8182020-09-09 17:56:53 +02001029 DUMP_ADDR(VIEWPORT, p->viewport, "Viewport:\n");
Boris Brezillonb1c3f632020-09-10 12:46:33 +02001030 pandecode_log("\n");
1031 }
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001032
Alyssa Rosenzweiged464e02019-08-22 13:07:01 -07001033 unsigned max_attr_index = 0;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001034
Alyssa Rosenzweig76028912020-08-26 17:05:41 -04001035 if (p->attributes)
1036 max_attr_index = pandecode_attribute_meta(attribute_count, p->attributes, false, suffix);
Alyssa Rosenzweiged464e02019-08-22 13:07:01 -07001037
Alyssa Rosenzweig76028912020-08-26 17:05:41 -04001038 if (p->attribute_buffers) {
1039 attr_mem = pandecode_find_mapped_gpu_mem_containing(p->attribute_buffers);
1040 pandecode_attributes(attr_mem, p->attribute_buffers, job_no, suffix, max_attr_index, false, job_type);
Alyssa Rosenzweig9e66ff32019-07-31 11:52:52 -07001041 }
1042
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001043 if (p->varyings) {
Alyssa Rosenzweig76028912020-08-26 17:05:41 -04001044 varying_count = pandecode_attribute_meta(varying_count, p->varyings, true, suffix);
1045 }
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001046
Alyssa Rosenzweig76028912020-08-26 17:05:41 -04001047 if (p->varying_buffers) {
1048 attr_mem = pandecode_find_mapped_gpu_mem_containing(p->varying_buffers);
1049 pandecode_attributes(attr_mem, p->varying_buffers, job_no, suffix, varying_count, true, job_type);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001050 }
1051
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001052 if (p->uniform_buffers) {
Alyssa Rosenzweig4aeb6942019-08-19 15:16:01 -07001053 if (uniform_buffer_count)
1054 pandecode_uniform_buffers(p->uniform_buffers, uniform_buffer_count, job_no);
1055 else
Alyssa Rosenzweigcbbf7542019-08-21 14:57:23 -07001056 pandecode_msg("warn: UBOs specified but not referenced\n");
Alyssa Rosenzweig4aeb6942019-08-19 15:16:01 -07001057 } else if (uniform_buffer_count)
1058 pandecode_msg("XXX: UBOs referenced but not specified\n");
1059
1060 /* We don't want to actually dump uniforms, but we do need to validate
1061 * that the counts we were given are sane */
1062
Alyssa Rosenzweig76028912020-08-26 17:05:41 -04001063 if (p->push_uniforms) {
Alyssa Rosenzweig4aeb6942019-08-19 15:16:01 -07001064 if (uniform_count)
Alyssa Rosenzweig76028912020-08-26 17:05:41 -04001065 pandecode_uniforms(p->push_uniforms, uniform_count);
Alyssa Rosenzweig4aeb6942019-08-19 15:16:01 -07001066 else
Alyssa Rosenzweigcbbf7542019-08-21 14:57:23 -07001067 pandecode_msg("warn: Uniforms specified but not referenced\n");
Alyssa Rosenzweig4aeb6942019-08-19 15:16:01 -07001068 } else if (uniform_count)
Alyssa Rosenzweigd7473e22019-08-21 14:15:05 -07001069 pandecode_msg("XXX: Uniforms referenced but not specified\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001070
Alyssa Rosenzweig497977b2020-03-09 13:51:39 -04001071 if (p->textures)
1072 pandecode_textures(p->textures, texture_count, job_no, is_bifrost);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001073
Alyssa Rosenzweig76028912020-08-26 17:05:41 -04001074 if (p->samplers)
1075 pandecode_samplers(p->samplers, sampler_count, job_no, is_bifrost);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001076}
1077
1078static void
Boris Brezillonefce73d2020-09-08 10:11:26 +02001079pandecode_bifrost_tiler_heap(mali_ptr gpu_va, int job_no)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001080{
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001081 struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
Boris Brezillonefce73d2020-09-08 10:11:26 +02001082 pan_unpack(PANDECODE_PTR(mem, gpu_va, void), BIFROST_TILER_HEAP, h);
1083 DUMP_UNPACKED(BIFROST_TILER_HEAP, h, "Bifrost Tiler Heap:\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001084}
1085
1086static void
Boris Brezillonefce73d2020-09-08 10:11:26 +02001087pandecode_bifrost_tiler(mali_ptr gpu_va, int job_no)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001088{
1089 struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
Boris Brezillonefce73d2020-09-08 10:11:26 +02001090 pan_unpack(PANDECODE_PTR(mem, gpu_va, void), BIFROST_TILER, t);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001091
Boris Brezillonefce73d2020-09-08 10:11:26 +02001092 pandecode_bifrost_tiler_heap(t.heap, job_no);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001093
Boris Brezillonefce73d2020-09-08 10:11:26 +02001094 DUMP_UNPACKED(BIFROST_TILER, t, "Bifrost Tiler:\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001095 pandecode_indent++;
Boris Brezillonefce73d2020-09-08 10:11:26 +02001096 if (t.hierarchy_mask != 0xa &&
1097 t.hierarchy_mask != 0x14 &&
1098 t.hierarchy_mask != 0x28 &&
1099 t.hierarchy_mask != 0x50 &&
1100 t.hierarchy_mask != 0xa0)
Tomeu Vizoso0a0b6702020-04-09 09:39:17 +02001101 pandecode_prop("XXX: Unexpected hierarchy_mask (not 0xa, 0x14, 0x28, 0x50 or 0xa0)!");
1102
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001103 pandecode_indent--;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001104}
1105
1106static void
Boris Brezillond2892092020-09-08 19:41:51 +02001107pandecode_primitive_size(const void *s, bool constant)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001108{
Boris Brezillond2892092020-09-08 19:41:51 +02001109 pan_unpack(s, PRIMITIVE_SIZE, ps);
1110 if (ps.size_array == 0x0)
Alyssa Rosenzweig2608da12019-06-19 09:35:57 -07001111 return;
1112
Boris Brezillond2892092020-09-08 19:41:51 +02001113 DUMP_UNPACKED(PRIMITIVE_SIZE, ps, "Primitive Size:\n")
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001114}
1115
Boris Brezillond2892092020-09-08 19:41:51 +02001116static void
1117pandecode_vertex_compute_geometry_job(const struct MALI_JOB_HEADER *h,
1118 const struct pandecode_mapped_memory *mem,
1119 mali_ptr job, int job_no, bool is_bifrost,
1120 unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001121{
Boris Brezillond2892092020-09-08 19:41:51 +02001122 struct mali_compute_job_packed *PANDECODE_PTR_VAR(p, mem, job);
1123 pan_section_unpack(p, COMPUTE_JOB, DRAW, draw);
1124 pandecode_vertex_tiler_postfix_pre(&draw, job_no, h->type, "", is_bifrost, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001125
Boris Brezillond2892092020-09-08 19:41:51 +02001126 pandecode_log("Vertex Job Payload:\n");
1127 pandecode_indent++;
1128 pandecode_invocation(pan_section_ptr(p, COMPUTE_JOB, INVOCATION),
1129 h->type != MALI_JOB_TYPE_COMPUTE);
1130 DUMP_SECTION(COMPUTE_JOB, PARAMETERS, p, "Vertex Job Parameters:\n");
1131 DUMP_UNPACKED(DRAW, draw, "Draw:\n");
1132 pandecode_indent--;
1133 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001134}
1135
Boris Brezillond2892092020-09-08 19:41:51 +02001136static void
Boris Brezilloneb923542020-09-08 07:07:41 +02001137pandecode_tiler_job_bfr(const struct MALI_JOB_HEADER *h,
1138 const struct pandecode_mapped_memory *mem,
Boris Brezillond2892092020-09-08 19:41:51 +02001139 mali_ptr job, int job_no, unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001140{
Boris Brezillond2892092020-09-08 19:41:51 +02001141 struct mali_bifrost_tiler_job_packed *PANDECODE_PTR_VAR(p, mem, job);
1142 pan_section_unpack(p, BIFROST_TILER_JOB, DRAW, draw);
1143 pan_section_unpack(p, BIFROST_TILER_JOB, TILER, tiler_ptr);
Boris Brezilloneb923542020-09-08 07:07:41 +02001144 pandecode_vertex_tiler_postfix_pre(&draw, job_no, h->type, "", true, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001145
Boris Brezillond2892092020-09-08 19:41:51 +02001146 pandecode_log("Tiler Job Payload:\n");
1147 pandecode_indent++;
1148 pandecode_bifrost_tiler(tiler_ptr.address, job_no);
1149
1150 pandecode_invocation(pan_section_ptr(p, BIFROST_TILER_JOB, INVOCATION), true);
1151 pandecode_primitive(pan_section_ptr(p, BIFROST_TILER_JOB, PRIMITIVE));
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001152
Alyssa Rosenzweig4467e792020-08-26 13:21:06 -04001153 /* TODO: gl_PointSize on Bifrost */
Boris Brezillond2892092020-09-08 19:41:51 +02001154 pandecode_primitive_size(pan_section_ptr(p, BIFROST_TILER_JOB, PRIMITIVE_SIZE), true);
1155 pan_section_unpack(p, BIFROST_TILER_JOB, PADDING, padding);
1156 DUMP_UNPACKED(DRAW, draw, "Draw:\n");
1157 pandecode_indent--;
1158 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001159}
1160
Boris Brezillond2892092020-09-08 19:41:51 +02001161static void
1162pandecode_tiler_job_mdg(const struct MALI_JOB_HEADER *h,
1163 const struct pandecode_mapped_memory *mem,
1164 mali_ptr job, int job_no, unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001165{
Boris Brezillond2892092020-09-08 19:41:51 +02001166 struct mali_midgard_tiler_job_packed *PANDECODE_PTR_VAR(p, mem, job);
1167 pan_section_unpack(p, MIDGARD_TILER_JOB, DRAW, draw);
Boris Brezilloneb923542020-09-08 07:07:41 +02001168 pandecode_vertex_tiler_postfix_pre(&draw, job_no, h->type, "", false, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001169
Vinson Leed9c4ec92020-09-22 17:22:12 -07001170 pandecode_log("Tiler Job Payload:\n");
Boris Brezillond2892092020-09-08 19:41:51 +02001171 pandecode_indent++;
1172 pandecode_invocation(pan_section_ptr(p, MIDGARD_TILER_JOB, INVOCATION), true);
1173 pandecode_primitive(pan_section_ptr(p, MIDGARD_TILER_JOB, PRIMITIVE));
1174 DUMP_UNPACKED(DRAW, draw, "Draw:\n");
Alyssa Rosenzweigb010a6d2020-04-06 20:31:32 -04001175
Boris Brezillond2892092020-09-08 19:41:51 +02001176 pan_section_unpack(p, MIDGARD_TILER_JOB, PRIMITIVE, primitive);
1177 pandecode_primitive_size(pan_section_ptr(p, MIDGARD_TILER_JOB, PRIMITIVE_SIZE),
Boris Brezillon51331d62020-09-29 11:21:33 +02001178 primitive.point_size_array_format == MALI_POINT_SIZE_ARRAY_FORMAT_NONE);
Boris Brezillond2892092020-09-08 19:41:51 +02001179 pandecode_indent--;
1180 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001181}
1182
Boris Brezillon89fafe92020-09-08 12:43:48 +02001183static void
Alyssa Rosenzweig7103baf2019-07-12 08:57:10 -07001184pandecode_fragment_job(const struct pandecode_mapped_memory *mem,
Boris Brezillon89fafe92020-09-08 12:43:48 +02001185 mali_ptr job, int job_no,
1186 bool is_bifrost, unsigned gpu_id)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001187{
Boris Brezillon89fafe92020-09-08 12:43:48 +02001188 struct mali_fragment_job_packed *PANDECODE_PTR_VAR(p, mem, job);
1189 pan_section_unpack(p, FRAGMENT_JOB, PAYLOAD, s);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001190
Boris Brezillon89fafe92020-09-08 12:43:48 +02001191 bool is_mfbd = s.framebuffer & MALI_FBD_TAG_IS_MFBD;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001192
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001193 if (!is_mfbd && is_bifrost)
1194 pandecode_msg("XXX: Bifrost fragment must use MFBD\n");
1195
1196 struct pandecode_fbd info;
1197
1198 if (is_mfbd)
Boris Brezillon89fafe92020-09-08 12:43:48 +02001199 info = pandecode_mfbd_bfr(s.framebuffer & ~MALI_FBD_TAG_MASK, job_no,
Boris Brezillon5d5f7552020-09-08 10:17:40 +02001200 true, false, is_bifrost, gpu_id);
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001201 else
Boris Brezillon89fafe92020-09-08 12:43:48 +02001202 info = pandecode_sfbd(s.framebuffer & ~MALI_FBD_TAG_MASK, job_no,
Boris Brezillon5d5f7552020-09-08 10:17:40 +02001203 true, gpu_id);
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001204
1205 /* Compute the tag for the tagged pointer. This contains the type of
1206 * FBD (MFBD/SFBD), and in the case of an MFBD, information about which
1207 * additional structures follow the MFBD header (an extra payload or
1208 * not, as well as a count of render targets) */
1209
Boris Brezillon5d5f7552020-09-08 10:17:40 +02001210 unsigned expected_tag = is_mfbd ? MALI_FBD_TAG_IS_MFBD : 0;
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001211
1212 if (is_mfbd) {
1213 if (info.has_extra)
Boris Brezillon5d5f7552020-09-08 10:17:40 +02001214 expected_tag |= MALI_FBD_TAG_HAS_ZS_RT;
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001215
1216 expected_tag |= (MALI_POSITIVE(info.rt_count) << 2);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001217 }
1218
Alyssa Rosenzweigded9a682019-08-21 12:29:47 -07001219 /* Extract tile coordinates */
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001220
Boris Brezillon89fafe92020-09-08 12:43:48 +02001221 unsigned min_x = s.bound_min_x << MALI_TILE_SHIFT;
1222 unsigned min_y = s.bound_min_y << MALI_TILE_SHIFT;
1223 unsigned max_x = s.bound_max_x << MALI_TILE_SHIFT;
1224 unsigned max_y = s.bound_max_y << MALI_TILE_SHIFT;
Alyssa Rosenzweigded9a682019-08-21 12:29:47 -07001225
1226 /* Validate the coordinates are well-ordered */
1227
Boris Brezillon89fafe92020-09-08 12:43:48 +02001228 if (min_x > max_x)
Alyssa Rosenzweigded9a682019-08-21 12:29:47 -07001229 pandecode_msg("XXX: misordered X coordinates (%u > %u)\n", min_x, max_x);
1230
Boris Brezillon89fafe92020-09-08 12:43:48 +02001231 if (min_y > max_y)
Alyssa Rosenzweigded9a682019-08-21 12:29:47 -07001232 pandecode_msg("XXX: misordered X coordinates (%u > %u)\n", min_x, max_x);
1233
1234 /* Validate the coordinates fit inside the framebuffer. We use floor,
1235 * rather than ceil, for the max coordinates, since the tile
1236 * coordinates for something like an 800x600 framebuffer will actually
1237 * resolve to 800x608, which would otherwise trigger a Y-overflow */
1238
Boris Brezillon89fafe92020-09-08 12:43:48 +02001239 if (max_x + 1 > info.width)
Alyssa Rosenzweigded9a682019-08-21 12:29:47 -07001240 pandecode_msg("XXX: tile coordinates overflow in X direction\n");
1241
Boris Brezillon89fafe92020-09-08 12:43:48 +02001242 if (max_y + 1 > info.height)
Alyssa Rosenzweigded9a682019-08-21 12:29:47 -07001243 pandecode_msg("XXX: tile coordinates overflow in Y direction\n");
1244
1245 /* After validation, we print */
Vinson Leed9c4ec92020-09-22 17:22:12 -07001246 DUMP_UNPACKED(FRAGMENT_JOB_PAYLOAD, s, "Fragment Job Payload:\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001247
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001248 /* The FBD is a tagged pointer */
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001249
Boris Brezillon89fafe92020-09-08 12:43:48 +02001250 unsigned tag = (s.framebuffer & MALI_FBD_TAG_MASK);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001251
Alyssa Rosenzweigf06e8f72019-08-21 12:06:50 -07001252 if (tag != expected_tag)
1253 pandecode_msg("XXX: expected FBD tag %X but got %X\n", expected_tag, tag);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001254
Boris Brezillon89fafe92020-09-08 12:43:48 +02001255 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001256}
1257
Boris Brezillon9121e7d2020-09-08 10:39:23 +02001258static void
1259pandecode_write_value_job(const struct pandecode_mapped_memory *mem,
1260 mali_ptr job, int job_no)
1261{
1262 struct mali_write_value_job_packed *PANDECODE_PTR_VAR(p, mem, job);
1263 pan_section_unpack(p, WRITE_VALUE_JOB, PAYLOAD, u);
1264 DUMP_SECTION(WRITE_VALUE_JOB, PAYLOAD, p, "Write Value Payload:\n");
1265 pandecode_log("\n");
1266}
1267
Alyssa Rosenzweig4122f742020-02-18 07:43:51 -05001268/* Entrypoint to start tracing. jc_gpu_va is the GPU address for the first job
1269 * in the chain; later jobs are found by walking the chain. Bifrost is, well,
1270 * if it's bifrost or not. GPU ID is the more finegrained ID (at some point, we
1271 * might wish to combine this with the bifrost parameter) because some details
1272 * are model-specific even within a particular architecture. Minimal traces
1273 * *only* examine the job descriptors, skipping printing entirely if there is
1274 * no faults, and only descends into the payload if there are faults. This is
1275 * useful for looking for faults without the overhead of invasive traces. */
1276
Alyssa Rosenzweig59986462020-02-18 07:46:03 -05001277void
Alyssa Rosenzweig4122f742020-02-18 07:43:51 -05001278pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal)
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001279{
Icecream9501d60d32020-07-16 16:12:13 +12001280 pandecode_dump_file_open();
1281
Alyssa Rosenzweig59986462020-02-18 07:46:03 -05001282 unsigned job_descriptor_number = 0;
Boris Brezilloneb923542020-09-08 07:07:41 +02001283 mali_ptr next_job = 0;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001284
1285 do {
1286 struct pandecode_mapped_memory *mem =
1287 pandecode_find_mapped_gpu_mem_containing(jc_gpu_va);
Boris Brezillond2892092020-09-08 19:41:51 +02001288
Boris Brezilloneb923542020-09-08 07:07:41 +02001289 pan_unpack(PANDECODE_PTR(mem, jc_gpu_va, struct mali_job_header_packed),
1290 JOB_HEADER, h);
1291 next_job = h.next;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001292
1293 int job_no = job_descriptor_number++;
1294
Alyssa Rosenzweig4122f742020-02-18 07:43:51 -05001295 /* If the job is good to go, skip it in minimal mode */
Boris Brezilloneb923542020-09-08 07:07:41 +02001296 if (minimal && (h.exception_status == 0x0 || h.exception_status == 0x1))
Alyssa Rosenzweig4122f742020-02-18 07:43:51 -05001297 continue;
1298
Boris Brezilloneb923542020-09-08 07:07:41 +02001299 DUMP_UNPACKED(JOB_HEADER, h, "Job Header:\n");
1300 pandecode_log("\n");
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001301
Boris Brezilloneb923542020-09-08 07:07:41 +02001302 switch (h.type) {
Boris Brezillon9121e7d2020-09-08 10:39:23 +02001303 case MALI_JOB_TYPE_WRITE_VALUE:
1304 pandecode_write_value_job(mem, jc_gpu_va, job_no);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001305 break;
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001306
Alyssa Rosenzweig4b7056b2020-08-05 18:40:44 -04001307 case MALI_JOB_TYPE_TILER:
Boris Brezillond2892092020-09-08 19:41:51 +02001308 if (bifrost)
1309 pandecode_tiler_job_bfr(&h, mem, jc_gpu_va, job_no, gpu_id);
1310 else
1311 pandecode_tiler_job_mdg(&h, mem, jc_gpu_va, job_no, gpu_id);
1312 break;
1313
Alyssa Rosenzweig4b7056b2020-08-05 18:40:44 -04001314 case MALI_JOB_TYPE_VERTEX:
1315 case MALI_JOB_TYPE_COMPUTE:
Boris Brezillond2892092020-09-08 19:41:51 +02001316 pandecode_vertex_compute_geometry_job(&h, mem, jc_gpu_va, job_no,
1317 bifrost, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001318 break;
1319
Alyssa Rosenzweig4b7056b2020-08-05 18:40:44 -04001320 case MALI_JOB_TYPE_FRAGMENT:
Boris Brezillon89fafe92020-09-08 12:43:48 +02001321 pandecode_fragment_job(mem, jc_gpu_va, job_no, bifrost, gpu_id);
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001322 break;
1323
1324 default:
1325 break;
1326 }
Boris Brezilloneb923542020-09-08 07:07:41 +02001327 } while ((jc_gpu_va = next_job));
Icecream95ef672182020-06-22 22:49:53 +12001328
1329 pandecode_map_read_write();
Alyssa Rosenzweigf6117822019-02-19 05:50:14 +00001330}