intel/tools/aub_dump: fix crash when using the default legacy context
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sat, 11 Jan 2020 15:05:46 +0000 (17:05 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 25 Feb 2020 18:56:45 +0000 (20:56 +0200)
When execbuffer->rsvd1 == 0, the legacy context is used. Ensure we
have context created for this.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3705>

src/intel/tools/aub_write.c

index b6d96fc88a33ce48b2dd95bb53a8b49fa5a743cb..70ec195a7cba77ad2f85343b56c3aa4bf5a767c2 100644 (file)
          _a > _b ? _a : _b;                     \
       })
 
-static void
-mem_trace_memory_write_header_out(struct aub_file *aub, uint64_t addr,
-                                  uint32_t len, uint32_t addr_space,
-                                  const char *desc);
+static struct aub_context *aub_context_new(struct aub_file *aub, uint32_t new_id);
+static void mem_trace_memory_write_header_out(struct aub_file *aub, uint64_t addr,
+                                              uint32_t len, uint32_t addr_space,
+                                              const char *desc);
 
 static void __attribute__ ((format(__printf__, 2, 3)))
 fail_if(int cond, const char *format, ...)
@@ -190,6 +190,7 @@ aub_file_init(struct aub_file *aub, FILE *file, FILE *debug, uint16_t pci_id, co
    dword_out(aub, 0);
 
    aub->next_context_handle = 1;
+   aub_context_new(aub, 0); /* Default context */
 }
 
 void