From 0a0b670d633b007e0d6394919fa0afa261614d32 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 9 Apr 2020 09:39:17 +0200 Subject: [PATCH] panfrost: Clean up a bit the tiler structs for Bifrost And set a fixed hierarchy mask for now that seems to generally work. Signed-off-by: Tomeu Vizoso Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_job.c | 8 +++---- src/panfrost/include/panfrost-job.h | 6 +++-- src/panfrost/pandecode/decode.c | 32 ++++++++++++++++++++------ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 3efacac9435..461d29aeaa0 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -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), diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 2f330d3e547..6bf0b7caf1c 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -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; diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index a5d58be96a1..9d1afcfefc1 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -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); -- 2.30.2