pan/decode: Add `minimal` mode
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 18 Feb 2020 12:43:51 +0000 (07:43 -0500)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 18 Feb 2020 13:44:59 +0000 (08:44 -0500)
We would like a mode to skip decoding job payloads so we can just
inspect for faults.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3836>

src/gallium/drivers/panfrost/pan_job.c
src/panfrost/pandecode/decode.c
src/panfrost/pandecode/public.h

index fb9812d29fdf1a7f15364df54ca2e2f4770eeb57..8502f24e5660dee593b6f74fa16e96aefd474211 100644 (file)
@@ -942,7 +942,7 @@ panfrost_batch_submit_ioctl(struct panfrost_batch *batch,
                 /* Wait so we can get errors reported back */
                 drmSyncobjWait(screen->fd, &batch->out_sync->syncobj, 1,
                                INT64_MAX, 0, NULL);
-                pandecode_jc(submit.jc, FALSE, screen->gpu_id);
+                pandecode_jc(submit.jc, FALSE, screen->gpu_id, false);
         }
 
         return 0;
index 4cf7df2c74ab5ac18228d059be8358502bce33a3..7e46014f3fa0c52382ee640a5041a75c93a46000 100644 (file)
@@ -2821,8 +2821,17 @@ pandecode_fragment_job(const struct pandecode_mapped_memory *mem,
 
 static int job_descriptor_number = 0;
 
+/* Entrypoint to start tracing. jc_gpu_va is the GPU address for the first job
+ * in the chain; later jobs are found by walking the chain. Bifrost is, well,
+ * if it's bifrost or not. GPU ID is the more finegrained ID (at some point, we
+ * might wish to combine this with the bifrost parameter) because some details
+ * are model-specific even within a particular architecture. Minimal traces
+ * *only* examine the job descriptors, skipping printing entirely if there is
+ * no faults, and only descends into the payload if there are faults. This is
+ * useful for looking for faults without the overhead of invasive traces. */
+
 int
-pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id)
+pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal)
 {
         struct mali_job_descriptor_header *h;
 
@@ -2853,6 +2862,10 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id)
                 if (first)
                         start_number = job_no;
 
+                /* If the job is good to go, skip it in minimal mode */
+                if (minimal && (h->exception_status == 0x0 || h->exception_status == 0x1))
+                        continue;
+
                 pandecode_log("struct mali_job_descriptor_header job_%"PRIx64"_%d = {\n", jc_gpu_va, job_no);
                 pandecode_indent++;
 
@@ -2891,12 +2904,6 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id)
                 pandecode_indent--;
                 pandecode_log("};\n");
 
-                /* Do not touch the field yet -- decode the payload first, and
-                 * don't touch that either. This is essential for the uploads
-                 * to occur in sequence and therefore be dynamically allocated
-                 * correctly. Do note the size, however, for that related
-                 * reason. */
-
                 switch (h->job_type) {
                 case JOB_TYPE_WRITE_VALUE: {
                         struct mali_payload_write_value *s = payload;
index 9144ea1b60d3b38a086b38ebb9d6659c7d38edab..4e460d4f4f335a56bb91768784a4ddaf0da86649 100644 (file)
@@ -51,7 +51,7 @@ void pandecode_close(void);
 void
 pandecode_inject_mmap(uint64_t gpu_va, void *cpu, unsigned sz, const char *name);
 
-int pandecode_jc(uint64_t jc_gpu_va, bool bifrost, unsigned gpu_id);
+int pandecode_jc(uint64_t jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal);
 
 char *
 pandecode_exception_access(unsigned access);