From 2c8a722b85eaf13d2ac9d722fd5be053cb69903b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 13 Aug 2020 13:27:16 -0400 Subject: [PATCH] panfrost: XMLify attributes To keep review manageable, this only ports over pandecode and blitting. The main uses for vertex data and varying linkage will come next, as they touch considerably more code. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/lib/decode.c | 37 ++++--------------------------- src/panfrost/lib/midgard.xml | 7 ++++++ src/panfrost/lib/pan_attributes.c | 2 +- src/panfrost/lib/pan_blit.c | 12 +++++----- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c index be18f2d0d95..95fe70cad7a 100644 --- a/src/panfrost/lib/decode.c +++ b/src/panfrost/lib/decode.c @@ -1311,7 +1311,6 @@ pandecode_attributes(const struct pandecode_mapped_memory *mem, if (mode != MALI_ATTR_LINEAR) pandecode_log_cont("%s ", pandecode_attr_mode_short(mode)); - /* Print the name to link with attr_meta */ pandecode_log_cont("%s_%d", prefix, i); /* Print the stride and size */ @@ -1537,41 +1536,13 @@ pandecode_midgard_blend_mrt(void *descs, int job_no, int rt_no) static int pandecode_attribute_meta(int job_no, int count, const struct mali_vertex_tiler_postfix *v, bool varying, char *suffix) { - char base[128]; - char *prefix = varying ? "varying" : "attribute"; - unsigned max_index = 0; - snprintf(base, sizeof(base), "%s_meta", prefix); - - struct mali_attr_meta *attr_meta; + const char *prefix = varying ? "Varying" : "Attribute"; mali_ptr p = varying ? v->varying_meta : v->attribute_meta; - struct pandecode_mapped_memory *attr_mem = pandecode_find_mapped_gpu_mem_containing(p); - - for (int i = 0; i < count; ++i, p += sizeof(struct mali_attr_meta)) { - attr_meta = pandecode_fetch_gpu_mem(attr_mem, p, - sizeof(*attr_mem)); - - if (attr_meta->index > max_index) - max_index = attr_meta->index; - - if (attr_meta->unknown1 != 0x2) { - pandecode_msg("XXX: expected unknown1 = 0x2\n"); - pandecode_prop("unknown1 = 0x%" PRIx64, (u64) attr_meta->unknown1); - } - - pandecode_log_cont("%s %s_%u", mali_format_as_str(attr_meta->format >> 12), prefix, attr_meta->index); - - if (attr_meta->src_offset) - pandecode_log_cont("[%u]", attr_meta->src_offset); - - pandecode_swizzle(attr_meta->format & ((1 << 12) - 1), attr_meta->format >> 12); - - pandecode_log_cont(";\n"); - } - - pandecode_log("\n"); + for (int i = 0; i < count; ++i, p += MALI_ATTRIBUTE_LENGTH) + DUMP_ADDR(prefix, ATTRIBUTE, p, 1); - return count ? (max_index + 1) : 0; + return count; } /* return bits [lo, hi) of word */ diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml index 8a6692f02ce..a5290b3c6ca 100644 --- a/src/panfrost/lib/midgard.xml +++ b/src/panfrost/lib/midgard.xml @@ -215,6 +215,13 @@ + + + + + + + diff --git a/src/panfrost/lib/pan_attributes.c b/src/panfrost/lib/pan_attributes.c index f12ff159645..1d9e7d3019d 100644 --- a/src/panfrost/lib/pan_attributes.c +++ b/src/panfrost/lib/pan_attributes.c @@ -26,7 +26,7 @@ #include "midgard_pack.h" #include "pan_encoder.h" -/* This file handles attribute descriptors (mali_attr_meta). The +/* This file handles attribute descriptors. The * bulk of the complexity is from instancing. See mali_job for * notes on how this works. But basically, for small vertex * counts, we have a lookup table, and for large vertex counts, diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c index 9aee7d81910..271d159441c 100644 --- a/src/panfrost/lib/pan_blit.c +++ b/src/panfrost/lib/pan_blit.c @@ -188,6 +188,7 @@ panfrost_load_midg( struct panfrost_transfer viewport = panfrost_pool_alloc(pool, MALI_VIEWPORT_LENGTH); struct panfrost_transfer sampler = panfrost_pool_alloc(pool, MALI_MIDGARD_SAMPLER_LENGTH); + struct panfrost_transfer varying_buf = panfrost_pool_alloc(pool, MALI_ATTRIBUTE_LENGTH); pan_pack(viewport.cpu, VIEWPORT, cfg) { cfg.scissor_maximum_x = width - 1; /* Inclusive */ @@ -200,11 +201,10 @@ panfrost_load_midg( .size = 4 * sizeof(float) * vertex_count, }; - struct mali_attr_meta varying_meta = { - .index = 0, - .unknown1 = 2, - .format = (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | (MALI_RGBA32F << 12) - }; + pan_pack(varying_buf.cpu, ATTRIBUTE, cfg) { + cfg.buffer_index = 0; + cfg.format = (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | (MALI_RGBA32F << 12); + } struct mali_stencil_packed stencil; pan_pack(&stencil, STENCIL, cfg) { @@ -348,7 +348,7 @@ panfrost_load_midg( .sampler_descriptor = sampler.gpu, .shader = shader_meta_t.gpu, .varyings = panfrost_pool_upload(pool, &varying, sizeof(varying)), - .varying_meta = panfrost_pool_upload(pool, &varying_meta, sizeof(varying_meta)), + .varying_meta = varying_buf.gpu, .viewport = viewport.gpu, .shared_memory = fbd } -- 2.30.2