panfrost: XML-ify the bifrost tiler descriptors
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6797>
This commit is contained in:

committed by
Alyssa Rosenzweig

parent
95eb7d9a34
commit
efce73d99d
@@ -1811,7 +1811,7 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
|
||||
|
||||
bifrost_tiler.prefix = *tiler_prefix;
|
||||
bifrost_tiler.primitive_size = *primitive_size;
|
||||
bifrost_tiler.tiler_meta = panfrost_batch_get_tiler_meta(batch, ~0);
|
||||
bifrost_tiler.tiler_meta = panfrost_batch_get_bifrost_tiler(batch, ~0);
|
||||
memcpy(&bifrost_tiler.postfix, tiler_draw, MALI_DRAW_LENGTH);
|
||||
tp = &bifrost_tiler;
|
||||
tp_size = sizeof(bifrost_tiler);
|
||||
|
@@ -678,7 +678,7 @@ panfrost_batch_get_shared_memory(struct panfrost_batch *batch,
|
||||
}
|
||||
|
||||
mali_ptr
|
||||
panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_count)
|
||||
panfrost_batch_get_bifrost_tiler(struct panfrost_batch *batch, unsigned vertex_count)
|
||||
{
|
||||
if (!vertex_count)
|
||||
return 0;
|
||||
@@ -687,25 +687,27 @@ panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_coun
|
||||
return batch->tiler_meta;
|
||||
|
||||
struct panfrost_device *dev = pan_device(batch->ctx->base.screen);
|
||||
struct panfrost_transfer t =
|
||||
panfrost_pool_alloc_aligned(&batch->pool, MALI_BIFROST_TILER_HEAP_LENGTH, 64);
|
||||
|
||||
struct bifrost_tiler_heap_meta tiler_heap_meta = {
|
||||
.heap_size = dev->tiler_heap->size,
|
||||
.tiler_heap_start = dev->tiler_heap->gpu,
|
||||
.tiler_heap_free = dev->tiler_heap->gpu,
|
||||
.tiler_heap_end = dev->tiler_heap->gpu + dev->tiler_heap->size,
|
||||
.unk1 = 0x1,
|
||||
.unk7e007e = 0x7e007e,
|
||||
};
|
||||
pan_pack(t.cpu, BIFROST_TILER_HEAP, heap) {
|
||||
heap.size = dev->tiler_heap->size;
|
||||
heap.base = dev->tiler_heap->gpu;
|
||||
heap.bottom = dev->tiler_heap->gpu;
|
||||
heap.top = dev->tiler_heap->gpu + dev->tiler_heap->size;
|
||||
}
|
||||
|
||||
struct bifrost_tiler_meta tiler_meta = {
|
||||
.hierarchy_mask = 0x28,
|
||||
.flags = 0x0,
|
||||
.width = MALI_POSITIVE(batch->key.width),
|
||||
.height = MALI_POSITIVE(batch->key.height),
|
||||
.tiler_heap_meta = panfrost_pool_upload_aligned(&batch->pool, &tiler_heap_meta, sizeof(tiler_heap_meta), 64)
|
||||
};
|
||||
mali_ptr heap = t.gpu;
|
||||
|
||||
batch->tiler_meta = panfrost_pool_upload_aligned(&batch->pool, &tiler_meta, sizeof(tiler_meta), 64);
|
||||
t = panfrost_pool_alloc_aligned(&batch->pool, MALI_BIFROST_TILER_LENGTH, 64);
|
||||
pan_pack(t.cpu, BIFROST_TILER, tiler) {
|
||||
tiler.hierarchy_mask = 0x28;
|
||||
tiler.fb_width = batch->key.width;
|
||||
tiler.fb_height = batch->key.height;
|
||||
tiler.heap = heap;
|
||||
}
|
||||
|
||||
batch->tiler_meta = t.gpu;
|
||||
return batch->tiler_meta;
|
||||
}
|
||||
|
||||
|
@@ -205,7 +205,7 @@ bool
|
||||
panfrost_batch_is_scanout(struct panfrost_batch *batch);
|
||||
|
||||
mali_ptr
|
||||
panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_count);
|
||||
panfrost_batch_get_bifrost_tiler(struct panfrost_batch *batch, unsigned vertex_count);
|
||||
|
||||
mali_ptr
|
||||
panfrost_batch_reserve_framebuffer(struct panfrost_batch *batch);
|
||||
|
@@ -496,7 +496,7 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
|
||||
|
||||
if (dev->quirks & IS_BIFROST) {
|
||||
mfbd.msaa.sample_locations = panfrost_emit_sample_locations(batch);
|
||||
mfbd.tiler_meta = panfrost_batch_get_tiler_meta(batch, vertex_count);
|
||||
mfbd.tiler_meta = panfrost_batch_get_bifrost_tiler(batch, vertex_count);
|
||||
} else {
|
||||
struct mali_local_storage_packed lsp;
|
||||
|
||||
|
@@ -422,33 +422,6 @@ union midgard_primitive_size {
|
||||
u64 pointer;
|
||||
};
|
||||
|
||||
struct bifrost_tiler_heap_meta {
|
||||
u32 zero;
|
||||
u32 heap_size;
|
||||
/* note: these are just guesses! */
|
||||
mali_ptr tiler_heap_start;
|
||||
mali_ptr tiler_heap_free;
|
||||
mali_ptr tiler_heap_end;
|
||||
|
||||
/* hierarchy weights? but they're still 0 after the job has run... */
|
||||
u32 zeros[10];
|
||||
u32 unk1;
|
||||
u32 unk7e007e;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bifrost_tiler_meta {
|
||||
u32 tiler_heap_next_start; /* To be written by the GPU */
|
||||
u32 used_hierarchy_mask; /* To be written by the GPU */
|
||||
u16 hierarchy_mask; /* Five values observed: 0xa, 0x14, 0x28, 0x50, 0xa0 */
|
||||
u16 flags;
|
||||
u16 width;
|
||||
u16 height;
|
||||
u64 zero0;
|
||||
mali_ptr tiler_heap_meta;
|
||||
/* TODO what is this used for? */
|
||||
u64 zeros[20];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct midgard_payload_vertex_tiler {
|
||||
struct mali_vertex_tiler_prefix prefix;
|
||||
struct mali_draw_packed postfix;
|
||||
|
@@ -1577,99 +1577,31 @@ pandecode_vertex_tiler_postfix_pre(
|
||||
}
|
||||
|
||||
static void
|
||||
pandecode_tiler_heap_meta(mali_ptr gpu_va, int job_no)
|
||||
pandecode_bifrost_tiler_heap(mali_ptr gpu_va, int job_no)
|
||||
{
|
||||
struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
|
||||
const struct bifrost_tiler_heap_meta *PANDECODE_PTR_VAR(h, mem, gpu_va);
|
||||
|
||||
pandecode_log("struct bifrost_tiler_heap_meta tiler_heap_meta_%"PRIx64"_%d = {\n", gpu_va, job_no);
|
||||
pandecode_indent++;
|
||||
|
||||
if (h->zero) {
|
||||
pandecode_msg("XXX: tiler heap zero tripped\n");
|
||||
pandecode_prop("zero = 0x%x", h->zero);
|
||||
}
|
||||
|
||||
pandecode_prop("heap_size = 0x%x", h->heap_size);
|
||||
MEMORY_PROP(h, tiler_heap_start);
|
||||
MEMORY_PROP(h, tiler_heap_free);
|
||||
|
||||
/* this might point to the beginning of another buffer, when it's
|
||||
* really the end of the tiler heap buffer, so we have to be careful
|
||||
* here. but for zero length, we need the same pointer.
|
||||
*/
|
||||
|
||||
if (h->tiler_heap_end == h->tiler_heap_start) {
|
||||
MEMORY_PROP(h, tiler_heap_start);
|
||||
} else {
|
||||
char *a = pointer_as_memory_reference(h->tiler_heap_end - 1);
|
||||
pandecode_prop("tiler_heap_end = %s + 1", a);
|
||||
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");
|
||||
pan_unpack(PANDECODE_PTR(mem, gpu_va, void), BIFROST_TILER_HEAP, h);
|
||||
DUMP_UNPACKED(BIFROST_TILER_HEAP, h, "Bifrost Tiler Heap:\n");
|
||||
}
|
||||
|
||||
static void
|
||||
pandecode_tiler_meta(mali_ptr gpu_va, int job_no)
|
||||
pandecode_bifrost_tiler(mali_ptr gpu_va, int job_no)
|
||||
{
|
||||
struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
|
||||
const struct bifrost_tiler_meta *PANDECODE_PTR_VAR(t, mem, gpu_va);
|
||||
pan_unpack(PANDECODE_PTR(mem, gpu_va, void), BIFROST_TILER, t);
|
||||
|
||||
pandecode_tiler_heap_meta(t->tiler_heap_meta, job_no);
|
||||
pandecode_bifrost_tiler_heap(t.heap, job_no);
|
||||
|
||||
pandecode_log("struct bifrost_tiler_meta tiler_meta_%"PRIx64"_%d = {\n", gpu_va, job_no);
|
||||
DUMP_UNPACKED(BIFROST_TILER, t, "Bifrost Tiler:\n");
|
||||
pandecode_indent++;
|
||||
|
||||
pandecode_prop("tiler_heap_next_start = 0x%" PRIx32, t->tiler_heap_next_start);
|
||||
pandecode_prop("used_hierarchy_mask = 0x%" PRIx32, t->used_hierarchy_mask);
|
||||
|
||||
if (t->hierarchy_mask != 0xa &&
|
||||
t->hierarchy_mask != 0x14 &&
|
||||
t->hierarchy_mask != 0x28 &&
|
||||
t->hierarchy_mask != 0x50 &&
|
||||
t->hierarchy_mask != 0xa0)
|
||||
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);
|
||||
pandecode_prop("height = MALI_POSITIVE(%d)", t->height + 1);
|
||||
|
||||
if (t->zero0) {
|
||||
pandecode_msg("XXX: tiler meta zero tripped\n");
|
||||
pandecode_prop("zero0 = 0x%" PRIx64, t->zero0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
if (t->zeros[i] != 0) {
|
||||
pandecode_msg("XXX: tiler heap zero %d tripped, value %" PRIx64 "\n",
|
||||
i, t->zeros[i]);
|
||||
}
|
||||
}
|
||||
|
||||
pandecode_indent--;
|
||||
pandecode_log("};\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1720,7 +1652,7 @@ pandecode_tiler_job_bfr(const struct mali_job_descriptor_header *h,
|
||||
memcpy(&draw_packed, &t->postfix, sizeof(draw_packed));
|
||||
pan_unpack(&draw_packed, DRAW, draw);
|
||||
pandecode_vertex_tiler_postfix_pre(&draw, job_no, h->job_type, "", true, gpu_id);
|
||||
pandecode_tiler_meta(t->tiler_meta, job_no);
|
||||
pandecode_bifrost_tiler(t->tiler_meta, job_no);
|
||||
|
||||
pandecode_vertex_tiler_prefix(&t->prefix, job_no, false);
|
||||
|
||||
|
@@ -751,4 +751,34 @@
|
||||
<section name="Tiler Weights" offset="256" type="Midgard Tiler Weights"/>
|
||||
<section name="Padding 2" offset="288" type="Single-Target Framebuffer Padding 2"/>
|
||||
</aggregate>
|
||||
|
||||
<enum name="Sample Pattern">
|
||||
<value name="Single-sampled" value="0"/>
|
||||
<value name="Ordered 4x Grid" value="1"/>
|
||||
<value name="Rotated 4x Grid" value="2"/>
|
||||
<value name="D3D 8x Grid" value="3"/>
|
||||
<value name="D3D 16x Grid" value="4"/>
|
||||
</enum>
|
||||
|
||||
<struct name="Bifrost Tiler Heap">
|
||||
<field name="Size" size="32" start="1:0" type="uint" modifier="align(4096)"/>
|
||||
<field name="Base" size="64" start="2:0" type="address"/>
|
||||
<field name="Bottom" size="64" start="4:0" type="address"/>
|
||||
<field name="Top" size="64" start="6:0" type="address"/>
|
||||
</struct>
|
||||
|
||||
<struct name="Bifrost Tiler Weights" size="1">
|
||||
<field name="Value" size="16" start="0:16" type="uint"/>
|
||||
</struct>
|
||||
|
||||
<struct name="Bifrost Tiler">
|
||||
<field name="Polygon List" size="64" start="0:0" type="address"/>
|
||||
<field name="Hierarchy Mask" size="13" start="2:0" type="uint"/>
|
||||
<field name="Sample Pattern" size="3" start="2:13" type="Sample Pattern"/>
|
||||
<field name="Update Cost Table" size="1" start="2:16" type="bool"/>
|
||||
<field name="FB Width" size="16" start="3:0" type="uint" modifier="minus(1)"/>
|
||||
<field name="FB Height" size="16" start="3:16" type="uint" modifier="minus(1)"/>
|
||||
<field name="Heap" size="64" start="6:0" type="address"/>
|
||||
<field name="Weights" size="32" start="8:0" type="Bifrost Tiler Weights" elements="8"/>
|
||||
</struct>
|
||||
</panxml>
|
||||
|
Reference in New Issue
Block a user