panfrost: Rename tiler fields per tiler research
[mesa.git] / src / gallium / drivers / panfrost / pandecode / cmdline.c
index b2ba21cfe414300ba19b97b370d9bae5305271da..38053aa1072b113ea4e2398ed302e731562ae478 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Copyright (C) 2019 Alyssa Rosenzweig
- * Copyright (C) 2017-2018 Lyude Paul
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
 #include <stdint.h>
 #include <string.h>
 
-#include "mmap.h"
-int pandecode_replay_jc(mali_ptr jc_gpu_va, bool bifrost);
-
-/* Memory handling */
-
-static struct pandecode_mapped_memory mmaps;
-
-struct pandecode_mapped_memory *
-pandecode_find_mapped_gpu_mem_containing(mali_ptr addr)
-{
-        list_for_each_entry(struct pandecode_mapped_memory, pos, &mmaps.node, node) {
-                if (addr >= pos->gpu_va && addr < pos->gpu_va + pos->length)
-                        return pos;
-        }
-
-        return NULL;
-}
-
-char *
-pointer_as_memory_reference(mali_ptr ptr)
-{
-        struct pandecode_mapped_memory *mapped;
-        char *out = malloc(128);
-
-        /* Try to find the corresponding mapped zone */
-
-        mapped = pandecode_find_mapped_gpu_mem_containing(ptr);
-
-        if (mapped) {
-                snprintf(out, 128, "%s + %d", mapped->name, (int) (ptr - mapped->gpu_va));
-                return out;
-        }
-
-        /* Just use the raw address if other options are exhausted */
-
-        snprintf(out, 128, MALI_PTR_FMT, ptr);
-        return out;
-
-}
+#include "decode.h"
 
 /* Parsing */
 
@@ -101,21 +62,7 @@ pandecode_read_memory(const char *base, const char *name, mali_ptr gpu_va)
         fread(buf, 1, sz, fp);
         fclose(fp);
 
-        /* Now that we have the memory loaded in, create a mmap entry for it so
-         * we remember it later */
-
-        struct pandecode_mapped_memory *mapped_mem = NULL;
-
-        mapped_mem = malloc(sizeof(*mapped_mem));
-        list_inithead(&mapped_mem->node);
-
-        mapped_mem->gpu_va = gpu_va;
-        mapped_mem->length = sz;
-        mapped_mem->addr = buf;
-
-        memcpy(mapped_mem->name, name, strlen(name));
-
-        list_add(&mapped_mem->node, &mmaps.node);
+        pandecode_inject_mmap(gpu_va, buf, sz, name);
 }
 
 static void
@@ -126,7 +73,7 @@ pandecode_read_mmap(const char *base, const char *line)
         mali_ptr addr;
         char name[512];
 
-        sscanf(line, "MMAP %lx %s", &addr, name);
+        sscanf(line, "MMAP %" PRIx64 " %s", &addr, name);
         pandecode_read_memory(base, name, addr);
 }
 
@@ -137,10 +84,12 @@ pandecode_read_job_submit(const char *base, const char *line)
         unsigned core_req;
         unsigned is_bifrost;
 
-        sscanf(line, "JS %lx %x %x", &addr, &core_req, &is_bifrost);
+        sscanf(line, "JS %" PRIx64 " %x %x", &addr, &core_req, &is_bifrost);
         pandecode_replay_jc(addr, is_bifrost);
 }
 
+
+
 /* Reads the control file, processing as it goes. */
 
 static void
@@ -180,10 +129,7 @@ main(int argc, char **argv)
                 fprintf(stderr, "Usage: pandecode [directory]\n");
                 exit(1);
         }
-        
-        /* Initialize */
-        list_inithead(&mmaps.node);
 
-        /* Let's go! */
+        pandecode_initialize();
         pandecode_read_control(argv[1]);
 }