<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 28, 2016 at 3:46 PM, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2016-11-23 20:27:28, Jason Ekstrand wrote:<br>
> This commit does two things.  One is to pull useful and/or interesting<br>
> information from the AUB file header and display it as a header above your<br>
> decoded batches.  Second, it is now capable of pulling the PCI ID from the<br>
> AUB file comment left by intel_aubdump.  This removes the need to use the<br>
> --gen flag all the time.<br>
> ---<br>
>  src/intel/tools/aubinator.c | 37 ++++++++++++++++++++++++++++++<wbr>++++---<br>
>  1 file changed, 34 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c<br>
> index 60aead8..f9aa8ce 100644<br>
> --- a/src/intel/tools/aubinator.c<br>
> +++ b/src/intel/tools/aubinator.c<br>
> @@ -63,7 +63,7 @@ static enum { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER } option_color;<br>
>  /* state */<br>
><br>
>  uint16_t pci_id = 0;<br>
> -char *xml_path = NULL;<br>
> +char *input_file = NULL, *xml_path = NULL;<br>
>  struct gen_spec *spec;<br>
>  struct gen_disasm *disasm;<br>
><br>
> @@ -891,9 +891,23 @@ handle_trace_block(uint32_t *p)<br>
>     }<br>
>  }<br>
><br>
> +#define MAX(a, b) ((a) < (b) ? (b) : (a))<br>
> +<br>
<br>
</span>Why was this moved? Also, couldn't we use MAX2 from utils/macros.h?<br></blockquote><div><br></div><div>An earlier version of the patch needed it in handle_trace_header<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Series Reviewed-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
<div><div class="h5"><br>
>  static void<br>
>  handle_trace_header(uint32_t *p)<br>
>  {<br>
> +   /* The intel_aubdump tool from IGT is kind enough to put a PCI-ID= tag in<br>
> +    * the AUB header comment.  If the user hasn't specified a hardware<br>
> +    * generation, try to use the one from the AUB file.<br>
> +    */<br>
> +   uint32_t *end = p + (p[0] & 0xffff) + 2;<br>
> +   int aub_pci_id = 0;<br>
> +   if (end > &p[12] && p[12] > 0)<br>
> +      sscanf((char *)&p[13], "PCI-ID=%i", &aub_pci_id);<br>
> +<br>
> +   if (pci_id == 0)<br>
> +      pci_id = aub_pci_id;<br>
> +<br>
>     struct gen_device_info devinfo;<br>
>     if (!gen_get_device_info(pci_id, &devinfo)) {<br>
>        fprintf(stderr, "can't find device information: pci_id=0x%x\n", pci_id);<br>
> @@ -908,6 +922,25 @@ handle_trace_header(uint32_t *p)<br>
><br>
>     if (spec == NULL || disasm == NULL)<br>
>        exit(EXIT_FAILURE);<br>
> +<br>
> +   printf("%sAubinator: Intel AUB file decoder.%-80s%s\n",<br>
> +          GREEN_HEADER, "", NORMAL);<br>
> +<br>
> +   if (input_file)<br>
> +      printf("File name:        %s\n", input_file);<br>
> +<br>
> +   if (aub_pci_id)<br>
> +      printf("PCI ID:           0x%x\n", aub_pci_id);<br>
> +<br>
> +   char app_name[33];<br>
> +   strncpy(app_name, (char *)&p[2], 32);<br>
> +   app_name[32] = 0;<br>
> +   printf("Application name: %s\n", app_name);<br>
> +<br>
> +   printf("Decoding as:      %s\n", gen_get_device_name(pci_id));<br>
> +<br>
> +   /* Throw in a new line before the first batch */<br>
> +   printf("\n");<br>
>  }<br>
><br>
>  struct aub_file {<br>
> @@ -1094,7 +1127,6 @@ aub_file_more_stuff(struct aub_file *file)<br>
>  }<br>
><br>
>  #define AUB_READ_BUFFER_SIZE (4096)<br>
> -#define MAX(a, b) ((a) < (b) ? (b) : (a))<br>
><br>
>  static void<br>
>  aub_file_data_grow(struct aub_file *file)<br>
> @@ -1185,7 +1217,6 @@ int main(int argc, char *argv[])<br>
>     struct aub_file *file;<br>
>     int c, i;<br>
>     bool help = false, pager = true;<br>
> -   char *input_file = NULL;<br>
>     const struct {<br>
>        const char *name;<br>
>        int pci_id;<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>