[Mesa-dev] [PATCH 3/3] i965: Completely annotate the batch bo when aub dumping.

Eric Anholt eric at anholt.net
Thu May 10 10:50:26 PDT 2012


On Thu, 10 May 2012 06:56:49 -0700, Paul Berry <stereotype441 at gmail.com> wrote:
> On 9 May 2012 20:07, Eric Anholt <eric at anholt.net> wrote:
> 
> > On Mon,  7 May 2012 14:32:18 -0700, Paul Berry <stereotype441 at gmail.com>
> > wrote:
> > > +/**
> > > + * Generate a set of aub file annotations for the current batch buffer,
> > and
> > > + * deliver them to DRM.
> > > + *
> > > + * The "used" section of the batch buffer (the portion containing batch
> > > + * commands) is annotated with AUB_TRACE_TYPE_BATCH.  The remainder of
> > the
> > > + * batch buffer (which contains data structures pointed to by batch
> > commands)
> > > + * is annotated according to the type of each data structure.
> > > + */
> > > +void
> > > +brw_annotate_aub(struct intel_context *intel)
> > > +{
> > > +   struct brw_context *brw = brw_context(&intel->ctx);
> > > +
> > > +   unsigned annotation_count = 2 * brw->state_batch_count + 1;
> > > +   drm_intel_aub_annotation annotations[annotation_count];
> > > +   int a = 0;
> > > +   make_annotation(&annotations[a++], AUB_TRACE_TYPE_BATCH, 0,
> > > +                   4*intel->batch.used);
> > > +   for (int i = brw->state_batch_count; i-- > 0; ) {
> > > +      uint32_t type = brw->state_batch_list[i].type;
> >
> > Isn't the for loop start here off by one?
> >
> 
> I don't think so.  Note the postdecrement in the loop condition, so the
> first time through the loop i == brw->state_batch_count - 1.

That's clever.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120510/88e1d561/attachment.pgp>


More information about the mesa-dev mailing list