panfrost: XMLify attributes
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 13 Aug 2020 17:27:16 +0000 (13:27 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 17 Aug 2020 11:43:52 +0000 (11:43 +0000)
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 <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6326>

src/panfrost/lib/decode.c
src/panfrost/lib/midgard.xml
src/panfrost/lib/pan_attributes.c
src/panfrost/lib/pan_blit.c

index be18f2d0d95f731dc6696d6f804ffe705b346642..95fe70cad7a202c4d8920fc2b4f77cbadfec168f 100644 (file)
@@ -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 */
index 8a6692f02cede300fe311652266a471433ae9699..a5290b3c6caa113a472d6989325489ee7a0fb643 100644 (file)
     <value name="Mirrored Clamp to Border" value="15"/>
   </enum>
 
+  <struct name="Attribute">
+    <field name="Buffer index" size="9" start="0" type="uint"/>
+    <field name="Unknown" size="1" start="9" type="bool" default="true"/>
+    <field name="Format" size="22" start="10" type="uint"/>
+    <field name="Offset" size="32" start="32" type="int"/>
+  </struct>
+
   <struct name="Midgard Sampler">
     <field name="Magnify Nearest" size="1" start="0" type="bool" default="true"/>
     <field name="Minify Nearest" size="1" start="1" type="bool" default="true"/>
index f12ff159645c308ec272e5cbfd1b458721ad94b0..1d9e7d3019d39c703b32c75e542e6d21cb209fab 100644 (file)
@@ -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,
index 9aee7d81910c0f309874773153f4d7cbdfa8a9f9..271d159441c49fb2f617bbad7a49c8a3c0b9b506 100644 (file)
@@ -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
                 }