broadcom/vc5: Fix CLIF dumping of lists that aren't capped by a HALT.
authorEric Anholt <eric@anholt.net>
Thu, 28 Sep 2017 20:36:54 +0000 (13:36 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 10 Oct 2017 18:42:05 +0000 (11:42 -0700)
The HW will halt when you hit a HALT packet, or when you hit the end
address.  Tell CLIF if there's an end address is so that it can stop
correctly.  (There was usually a 0 byte after the CL, so it would stop
anyway).

src/broadcom/clif/clif_dump.c
src/broadcom/clif/clif_dump.h
src/gallium/drivers/vc5/vc5_job.c

index 8e9e248c0e472b92288441daceac2a7fb0ab2c45..339fc3835b04537386dae2b6f28c5d21b3745d00 100644 (file)
@@ -245,21 +245,34 @@ clif_process_worklist(struct clif_dump *clif)
 }
 
 void
-clif_dump_add_cl(struct clif_dump *clif, uint32_t address)
+clif_dump_add_cl(struct clif_dump *clif, uint32_t start, uint32_t end)
 {
         uint32_t size;
 
-        void *vaddr;
-        if (!clif->lookup_vaddr(clif->data, address, &vaddr)) {
+        void *start_vaddr;
+        if (!clif->lookup_vaddr(clif->data, start, &start_vaddr)) {
                 out(clif, "Failed to look up address 0x%08x\n",
-                    address);
+                    start);
                 return;
         }
 
-        uint8_t *cl = vaddr;
-        while (clif_dump_packet(clif, address, cl, &size)) {
+        /* The end address is optional (for example, a BRANCH instruction
+         * won't set an end), but is used for BCL/RCL termination.
+         */
+        void *end_vaddr = NULL;
+        if (end && !clif->lookup_vaddr(clif->data, end, &end_vaddr)) {
+                out(clif, "Failed to look up address 0x%08x\n",
+                    end);
+                return;
+        }
+
+        uint8_t *cl = start_vaddr;
+        while (clif_dump_packet(clif, start, cl, &size)) {
                 cl += size;
-                address += size;
+                start += size;
+
+                if (cl == end_vaddr)
+                        break;
         }
 
         out(clif, "\n");
index 1201d83cb45a7044310adacfaa20a7277aa7eddc..d46cc84710e4df2e2fc4a6aacbabd8545eea1445 100644 (file)
@@ -37,6 +37,6 @@ struct clif_dump *clif_dump_init(const struct v3d_device_info *devinfo,
                                  void *data);
 void clif_dump_destroy(struct clif_dump *clif);
 
-void clif_dump_add_cl(struct clif_dump *clif, uint32_t offset);
+void clif_dump_add_cl(struct clif_dump *clif, uint32_t start, uint32_t end);
 
 #endif
index 57cf96725b9cd3055a0bbf1d07901de4f8c899f0..f90b449aca7c74fab84b0d5960f9419f3980a381 100644 (file)
@@ -329,11 +329,11 @@ vc5_clif_dump(struct vc5_context *vc5, struct vc5_job *job)
         fprintf(stderr, "BCL: 0x%08x..0x%08x\n",
                 job->submit.bcl_start, job->submit.bcl_end);
 
-        clif_dump_add_cl(clif, job->submit.bcl_start);
+        clif_dump_add_cl(clif, job->submit.bcl_start, job->submit.bcl_end);
 
         fprintf(stderr, "RCL: 0x%08x..0x%08x\n",
                 job->submit.rcl_start, job->submit.rcl_end);
-        clif_dump_add_cl(clif, job->submit.rcl_start);
+        clif_dump_add_cl(clif, job->submit.rcl_start, job->submit.rcl_end);
 }
 
 /**