On 9 May 2012 20:07, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Mon,  7 May 2012 14:31:51 -0700, Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>> wrote:<br>
> This patch adds a new function,<br>
> drm_intel_bufmgr_gem_set_aub_annotations(), which can be used to<br>
> annotate the type and subtype of data stored in various sections of<br>
> each buffer.  This data is used to populate type and subtype fields<br>
> when generating the .aub file, which improves the ability of later<br>
> debugging tools to analyze the contents of the .aub file.<br>
><br>
> If drm_intel_bufmgr_gem_set_aub_annotations() is not called, then we<br>
> fall back to the old set of annotations (annotate the portion of the<br>
> batchbuffer that is executed as AUB_TRACE_TYPE_BATCH, and everything<br>
> else as AUB_TRACE_TYPE_NOTYPE).<br>
<br>
</div>This looks better than the interface I was thinking of.  Only real<br>
nitpick note is that the style in this file is tab indents, rather than<br>
8 spaces, same as linux kernel and 2d driver style.  (I have since been<br>
convinced that 8 spaces is superior, but a mix is worse).<br></blockquote><div><br>Ok.  Are there any plans to switch drm over to spaces or are we stuck with tabs forever?<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<div><br>
>  /*<br>
> @@ -1989,23 +2027,31 @@ aub_exec(drm_intel_bo *bo, int ring_flag, int used)<br>
>       drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;<br>
>       drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;<br>
>       int i;<br>
> +        bool batch_buffer_needs_annotations;<br>
><br>
>       if (!bufmgr_gem->aub_file)<br>
>               return;<br>
><br>
> -     /* Write out all but the batchbuffer to AUB memory */<br>
> -     for (i = 0; i < bufmgr_gem->exec_count - 1; i++) {<br>
> -             if (bufmgr_gem->exec_bos[i] != bo)<br>
> -                     aub_write_bo(bufmgr_gem->exec_bos[i]);<br>
> +        /* If batch buffer is not annotated, annotate it the best we<br>
> +         * can.<br>
> +         */<br>
> +        batch_buffer_needs_annotations = bo_gem->aub_annotation_count == 0;<br>
> +        if (batch_buffer_needs_annotations) {<br>
> +                drm_intel_aub_annotation annotations[2] = {<br>
> +                        { AUB_TRACE_TYPE_BATCH, 0, used },<br>
> +                        { AUB_TRACE_TYPE_NOTYPE, 0, bo->size }<br>
> +                };<br>
> +                drm_intel_bufmgr_gem_set_aub_annotations(bo, annotations, 2);<br>
<br>
</div>Looks like you don't actually need to be explicit about the range from<br>
used to bo->size given the "Write out any remaining unannotated data"<br>
code above, but either way.<br></blockquote><div><br>Fair point.  I think I will leave the code as is just to avoid having to do another round of testing :)<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<br>
Assuming tab replacement: Reviewed-by: Eric Anholt <<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>><br>
</blockquote></div><br>