panfrost: Clean up a bit the tiler structs for Bifrost
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 9 Apr 2020 07:39:17 +0000 (09:39 +0200)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Fri, 24 Apr 2020 04:53:21 +0000 (06:53 +0200)
And set a fixed hierarchy mask for now that seems to generally work.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4680>

src/gallium/drivers/panfrost/pan_job.c
src/panfrost/include/panfrost-job.h
src/panfrost/pandecode/decode.c

index 3efacac943541cc0927ce25bd843fc9a9aab505c..461d29aeaa07b3b59f8214b34ecb8514422fd844 100644 (file)
@@ -699,7 +699,6 @@ panfrost_batch_get_tiler_heap(struct panfrost_batch *batch)
         return batch->tiler_heap;
 }
 
-/* TODO: Figure out how to remove the hardcoded values */
 mali_ptr
 panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_count)
 {
@@ -717,13 +716,12 @@ panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_coun
             .tiler_heap_start = tiler_heap->gpu,
             .tiler_heap_free = tiler_heap->gpu,
             .tiler_heap_end = tiler_heap->gpu + tiler_heap->size,
+            .unk1 = 0x1,
+            .unk7e007e = 0x7e007e,
         };
 
-        tiler_heap_meta.zeros[10] = 0x1;
-        tiler_heap_meta.zeros[11] = 0x7e007e;
-
         struct bifrost_tiler_meta tiler_meta = {
-            .hierarchy_mask = 0xf0,
+            .hierarchy_mask = 0x28,
             .flags = 0x0,
             .width = MALI_POSITIVE(batch->key.width),
             .height = MALI_POSITIVE(batch->key.height),
index 2f330d3e5470a53c78f62965bdd2f2fd6afd7b62..6bf0b7caf1c4356a17dc3338187a8b2dc5d6d59c 100644 (file)
@@ -1028,12 +1028,14 @@ struct bifrost_tiler_heap_meta {
         mali_ptr tiler_heap_end;
 
         /* hierarchy weights? but they're still 0 after the job has run... */
-        u32 zeros[12];
+        u32 zeros[10];
+        u32 unk1;
+        u32 unk7e007e;
 } __attribute__((packed));
 
 struct bifrost_tiler_meta {
         u64 zero0;
-        u16 hierarchy_mask;
+        u16 hierarchy_mask; /* Five values observed: 0xa, 0x14, 0x28, 0x50, 0xa0 */
         u16 flags;
         u16 width;
         u16 height;
index a5d58be96a1466642d6050d6c0385295c375b137..9d1afcfefc1289dc551c0232cbfaa63e6e47f413 100644 (file)
@@ -2596,13 +2596,6 @@ pandecode_tiler_heap_meta(mali_ptr gpu_va, int job_no)
                 pandecode_prop("zero = 0x%x", h->zero);
         }
 
-        for (int i = 0; i < 12; i++) {
-                if (h->zeros[i] != 0) {
-                        pandecode_msg("XXX: tiler heap zero %d tripped, value %x\n",
-                                      i, h->zeros[i]);
-                }
-        }
-
         pandecode_prop("heap_size = 0x%x", h->heap_size);
         MEMORY_PROP(h, tiler_heap_start);
         MEMORY_PROP(h, tiler_heap_free);
@@ -2620,6 +2613,23 @@ pandecode_tiler_heap_meta(mali_ptr gpu_va, int job_no)
                 free(a);
         }
 
+        for (int i = 0; i < 10; i++) {
+                if (h->zeros[i] != 0) {
+                        pandecode_msg("XXX: tiler heap zero %d tripped, value %x\n",
+                                      i, h->zeros[i]);
+                }
+        }
+
+        if (h->unk1 != 0x1) {
+                pandecode_msg("XXX: tiler heap unk1 tripped\n");
+                pandecode_prop("unk1 = 0x%x", h->unk1);
+        }
+
+        if (h->unk7e007e != 0x7e007e) {
+                pandecode_msg("XXX: tiler heap unk7e007e tripped\n");
+                pandecode_prop("unk7e007e = 0x%x", h->unk7e007e);
+        }
+
         pandecode_indent--;
         pandecode_log("};\n");
 }
@@ -2641,7 +2651,15 @@ pandecode_tiler_meta(mali_ptr gpu_va, int job_no)
                 pandecode_prop("zero1 = 0x%" PRIx64, t->zero1);
         }
 
+        if (t->hierarchy_mask != 0xa &&
+            t->hierarchy_mask != 0x14 &&
+            t->hierarchy_mask != 0x28 &&
+            t->hierarchy_mask != 0x50 &&
+            t->hierarchy_mask != 0xa0)
+                pandecode_prop("XXX: Unexpected hierarchy_mask (not 0xa, 0x14, 0x28, 0x50 or 0xa0)!");
+
         pandecode_prop("hierarchy_mask = 0x%" PRIx16, t->hierarchy_mask);
+
         pandecode_prop("flags = 0x%" PRIx16, t->flags);
 
         pandecode_prop("width = MALI_POSITIVE(%d)", t->width + 1);