panfrost: XML-ify the write value job descriptor
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 8 Sep 2020 08:39:23 +0000 (10:39 +0200)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 21 Sep 2020 11:35:45 +0000 (07:35 -0400)
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>

src/panfrost/bifrost/test/bi_submit.c
src/panfrost/include/panfrost-job.h
src/panfrost/lib/decode.c
src/panfrost/lib/midgard.xml
src/panfrost/lib/pan_scoreboard.c

index d131427..b0a33c0 100644 (file)
@@ -108,9 +108,11 @@ bit_sanity_check(struct panfrost_device *dev)
         struct panfrost_bo *scratch = bit_bo_create(dev, 65536);
         ((uint32_t *) scratch->cpu)[0] = 0xAA;
 
-        struct mali_payload_write_value payload = {
-                .address = scratch->gpu,
-                .value_descriptor = MALI_WRITE_VALUE_ZERO
+        struct mali_write_value_job_payload_packed payload;
+
+        pan_pack(&payload, WRITE_VALUE_JOB_PAYLOAD, cfg) {
+                cfg.address = scratch->gpu;
+                cfg.type = MALI_WRITE_VALUE_TYPE_ZERO;
         };
 
         struct panfrost_bo *bos[] = { scratch };
index 27bd04d..a002150 100644 (file)
@@ -238,18 +238,6 @@ struct bifrost_blend_rt {
         };
 } __attribute__((packed));
 
-/* Details about write_value from panfrost igt tests which use it as a generic
- * dword write primitive */
-
-#define MALI_WRITE_VALUE_ZERO 3
-
-struct mali_payload_write_value {
-        u64 address;
-        u32 value_descriptor;
-        u32 reserved;
-        u64 immediate;
-} __attribute__((packed));
-
 /*
  * Mali Attributes
  *
index ca6f044..c36c4a9 100644 (file)
@@ -1490,6 +1490,16 @@ pandecode_fragment_job(const struct pandecode_mapped_memory *mem,
         return sizeof(*s);
 }
 
+static void
+pandecode_write_value_job(const struct pandecode_mapped_memory *mem,
+                          mali_ptr job, int job_no)
+{
+        struct mali_write_value_job_packed *PANDECODE_PTR_VAR(p, mem, job);
+        pan_section_unpack(p, WRITE_VALUE_JOB, PAYLOAD, u);
+        DUMP_SECTION(WRITE_VALUE_JOB, PAYLOAD, p, "Write Value Payload:\n");
+        pandecode_log("\n");
+}
+
 /* Entrypoint to start tracing. jc_gpu_va is the GPU address for the first job
  * in the chain; later jobs are found by walking the chain. Bifrost is, well,
  * if it's bifrost or not. GPU ID is the more finegrained ID (at some point, we
@@ -1510,13 +1520,11 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal)
         do {
                 struct pandecode_mapped_memory *mem =
                         pandecode_find_mapped_gpu_mem_containing(jc_gpu_va);
-                void *payload;
-
                 pan_unpack(PANDECODE_PTR(mem, jc_gpu_va, struct mali_job_header_packed),
                            JOB_HEADER, h);
                 next_job = h.next;
                 mali_ptr payload_ptr = jc_gpu_va + MALI_JOB_HEADER_LENGTH;
-                payload = pandecode_fetch_gpu_mem(mem, payload_ptr, 64);
+                pandecode_fetch_gpu_mem(mem, payload_ptr, 64);
 
                 int job_no = job_descriptor_number++;
 
@@ -1528,28 +1536,9 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal)
                 pandecode_log("\n");
 
                 switch (h.type) {
-                case MALI_JOB_TYPE_WRITE_VALUE: {
-                        struct mali_payload_write_value *s = payload;
-                        pandecode_log("struct mali_payload_write_value payload_%"PRIx64"_%d = {\n", payload_ptr, job_no);
-                        pandecode_indent++;
-                        MEMORY_PROP(s, address);
-
-                        if (s->value_descriptor != MALI_WRITE_VALUE_ZERO) {
-                                pandecode_msg("XXX: unknown value descriptor\n");
-                                pandecode_prop("value_descriptor = 0x%" PRIX32, s->value_descriptor);
-                        }
-
-                        if (s->reserved) {
-                                pandecode_msg("XXX: set value tripped\n");
-                                pandecode_prop("reserved = 0x%" PRIX32, s->reserved);
-                        }
-
-                        pandecode_prop("immediate = 0x%" PRIX64, s->immediate);
-                        pandecode_indent--;
-                        pandecode_log("};\n");
-
+                case MALI_JOB_TYPE_WRITE_VALUE:
+                        pandecode_write_value_job(mem, jc_gpu_va, job_no);
                         break;
-                }
 
                 case MALI_JOB_TYPE_TILER:
                 case MALI_JOB_TYPE_VERTEX:
index 6f90e28..7154b85 100644 (file)
     <field name="Dependency 2" size="16" start="5:16" type="uint"/>
     <field name="Next" size="64" start="6:0" type="address"/>
   </struct>
+
+  <enum name="Write Value Type">
+    <value name="Cycle Counter" value="1"/>
+    <value name="System Timestamp" value="2"/>
+    <value name="Zero" value="3"/>
+    <value name="Immediate 8" value="4"/>
+    <value name="Immediate 16" value="5"/>
+    <value name="Immediate 32" value="6"/>
+    <value name="Immediate 64" value="7"/>
+  </enum>
+
+  <struct name="Write Value Job Payload">
+    <field name="Address" size="64" start="0:0" type="address"/>
+    <field name="Type" size="32" start="2:0" type="Write Value Type"/>
+    <field name="Immediate Value" size="64" start="4:0" type="uint"/>
+  </struct>
+
+  <aggregate name="Write Value Job">
+    <section name="Header" offset="0" type="Job Header"/>
+    <section name="Payload" offset="32" type="Write Value Job Payload"/>
+  </aggregate>
 </panxml>
index 6d564c9..22f3eaa 100644 (file)
@@ -189,23 +189,21 @@ panfrost_scoreboard_initialize_tiler(struct pan_pool *pool,
         /* Okay, we do. Let's generate it. We'll need the job's polygon list
          * regardless of size. */
 
-        struct mali_payload_write_value payload = {
-                .address = polygon_list,
-                .value_descriptor = MALI_WRITE_VALUE_ZERO,
-        };
-
         struct panfrost_transfer transfer =
                 panfrost_pool_alloc_aligned(pool,
-                                            MALI_JOB_HEADER_LENGTH + sizeof(payload),
+                                            MALI_WRITE_VALUE_JOB_LENGTH,
                                             64);
 
-        pan_pack(transfer.cpu, JOB_HEADER, job) {
-                job.type = MALI_JOB_TYPE_WRITE_VALUE;
-                job.index = scoreboard->write_value_index;
-                job.next = scoreboard->first_job;
+        pan_section_pack(transfer.cpu, WRITE_VALUE_JOB, HEADER, header) {
+                header.type = MALI_JOB_TYPE_WRITE_VALUE;
+                header.index = scoreboard->write_value_index;
+                header.next = scoreboard->first_job;
         }
 
-        memcpy(transfer.cpu + MALI_JOB_HEADER_LENGTH, &payload, sizeof(payload));
+        pan_section_pack(transfer.cpu, WRITE_VALUE_JOB, PAYLOAD, payload) {
+                payload.address = polygon_list;
+                payload.type = MALI_WRITE_VALUE_TYPE_ZERO;
+        }
 
         scoreboard->first_job = transfer.gpu;
 }