[Mesa-dev] [PATCH 1/2] i965: Add debugging code to dump the validation list.

Kenneth Graunke kenneth at whitecape.org
Tue Feb 27 16:22:11 UTC 2018


On Tuesday, February 27, 2018 2:03:52 AM PST Chris Wilson wrote:
> Quoting Kenneth Graunke (2018-02-26 23:54:59)
> > When anything goes wrong with this code, dumping the validation list
> > is a useful way to figure out what's happening.
> > ---
> >  src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > I've now used this code on multiple occasions to debug issues.  Unless
> > someone NAKs it, I'm going to push it in the next few days.
> > 
> > diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > index d0999bb3caa..26718e0d1a2 100644
> > --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> > @@ -55,6 +55,26 @@
> >  static void
> >  intel_batchbuffer_reset(struct brw_context *brw);
> >  
> > +UNUSED static void
> > +dump_validation_list(struct intel_batchbuffer *batch)
> > +{
> > +   fprintf(stderr, "Validation list (length %d):\n", batch->exec_count);
> > +
> > +   for (int i = 0; i < batch->exec_count; i++) {
> > +      uint64_t flags = batch->validation_list[i].flags;
> > +      assert(batch->validation_list[i].handle ==
> > +             batch->exec_bos[i]->gem_handle);
> > +      fprintf(stderr, "[%2d] = %2d %-15s %p %s%-7s @ 0x%llu%s\n", i,
> > +              batch->validation_list[i].handle,
> > +              batch->exec_bos[i]->name,
> > +              batch->exec_bos[i],
> > +              (flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS) ? "(48b" : "(32b",
> > +              (flags & EXEC_OBJECT_WRITE) ? " write)" : ")",
> > +              batch->validation_list[i].offset,
> > +              (flags & EXEC_OBJECT_PINNED) ? " (pinned)" : "");
> 
> Would it not be useful to mention if the buffer contains any
> relocations? Just wondering if that helps.

I don't think so.  Only the batch and the statebuffer contain
relocations, so most of the entries here wouldn't have any useful info.
We probably just want a second function to dump out a brw_reloc_list.

> Follow offset with size.
> -Chris

Okay, I've changed it to:
"[%2d]: %2d %-14s %p %s%-7s @ 0x%016llu%s (%"PRIu64"B)\n"
and added batch->exec_bos[i]->size at the end.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180227/c2bdcd07/attachment.sig>


More information about the mesa-dev mailing list