Mesa (master): aubinator: extract aubinator_init() out of the header handler function

Jordan Justen jljusten at kemper.freedesktop.org
Tue Jan 9 06:09:53 UTC 2018


Module: Mesa
Branch: master
Commit: 8cdf5bd29215c82d48ea9d869afeb9eb93b6e1f6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cdf5bd29215c82d48ea9d869afeb9eb93b6e1f6

Author: Scott D Phillips <scott.d.phillips at intel.com>
Date:   Tue Nov 28 15:52:09 2017 -0800

aubinator: extract aubinator_init() out of the header handler function

A later patch will use the aubinator_init() function from the
memtrace aub header handler.

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

---

 src/intel/tools/aubinator.c | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 46b0a47bcd..fcb46073f3 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -161,20 +161,8 @@ get_gen_batch_bo(void *user_data, uint64_t address)
 }
 
 static void
-handle_trace_header(uint32_t *p)
+aubinator_init(uint16_t aub_pci_id, const char *app_name)
 {
-   /* The intel_aubdump tool from IGT is kind enough to put a PCI-ID= tag in
-    * the AUB header comment.  If the user hasn't specified a hardware
-    * generation, try to use the one from the AUB file.
-    */
-   uint32_t *end = p + (p[0] & 0xffff) + 2;
-   int aub_pci_id = 0;
-   if (end > &p[12] && p[12] > 0)
-      sscanf((char *)&p[13], "PCI-ID=%i", &aub_pci_id);
-
-   if (pci_id == 0)
-      pci_id = aub_pci_id;
-
    if (!gen_get_device_info(pci_id, &devinfo)) {
       fprintf(stderr, "can't find device information: pci_id=0x%x\n", pci_id);
       exit(EXIT_FAILURE);
@@ -205,9 +193,6 @@ handle_trace_header(uint32_t *p)
    if (aub_pci_id)
       fprintf(outfile, "PCI ID:           0x%x\n", aub_pci_id);
 
-   char app_name[33];
-   strncpy(app_name, (char *)&p[2], 32);
-   app_name[32] = 0;
    fprintf(outfile, "Application name: %s\n", app_name);
 
    fprintf(outfile, "Decoding as:      %s\n", gen_get_device_name(pci_id));
@@ -216,6 +201,28 @@ handle_trace_header(uint32_t *p)
    fprintf(outfile, "\n");
 }
 
+static void
+handle_trace_header(uint32_t *p)
+{
+   /* The intel_aubdump tool from IGT is kind enough to put a PCI-ID= tag in
+    * the AUB header comment.  If the user hasn't specified a hardware
+    * generation, try to use the one from the AUB file.
+    */
+   uint32_t *end = p + (p[0] & 0xffff) + 2;
+   int aub_pci_id = 0;
+   if (end > &p[12] && p[12] > 0)
+      sscanf((char *)&p[13], "PCI-ID=%i", &aub_pci_id);
+
+   if (pci_id == 0)
+      pci_id = aub_pci_id;
+
+   char app_name[33];
+   strncpy(app_name, (char *)&p[2], 32);
+   app_name[32] = 0;
+
+   aubinator_init(aub_pci_id, app_name);
+}
+
 struct aub_file {
    FILE *stream;
 




More information about the mesa-commit mailing list