[Intel-gfx] [PATCH] drm/i915: Dump the contents of the GTT
Ben Widawsky
ben at bwidawsk.net
Sun Sep 1 20:31:53 CEST 2013
On Sun, Sep 01, 2013 at 03:59:00PM +0200, Sedat Dilek wrote:
> Hi Chris,
>
> is this going into any drm-intel GIT tree?
> I found it useful and saw it in your kernel-tree [1].
>
> - Sedat -
>
> [1] http://cgit.freedesktop.org/~ickle/linux-2.6/commit/?id=bf91098a1232db771feac66f88720c181ef61967
It can already be accomplished with the intel_gtt tool in the
intel-gpu-tools suite.
>
> On Wed, Aug 14, 2013 at 1:35 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > Chasing wild speculation that we may be writing the wrong addresses
> > into the GTT for stolen objects, I would like to inspect those values.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Sedat Dilek <sedat.dilek at gmail.com>
> > ---
> >
> > Sedak, can you please apply this patch and then attach the contents of
> > /sys/kernel/debug/dri/0/i915_gem_gtt with the broken display?
> >
> > ---
> > drivers/gpu/drm/i915/i915_debugfs.c | 47 ++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 46 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index 10d864c..4edf65a 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -390,6 +390,51 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
> > return 0;
> > }
> >
> > +static int i915_gem_gtt_contents(struct seq_file *m, struct drm_device *dev)
> > +{
> > + struct drm_i915_private *dev_priv = dev->dev_private;
> > + gen6_gtt_pte_t __iomem *gtt_entries;
> > + gen6_gtt_pte_t scratch_pte;
> > + gen6_gtt_pte_t zero[8] = {};
> > + int i, j, last_zero = 0;
> > + int ret;
> > +
> > + if (INTEL_INFO(dev)->gen < 6)
> > + return 0;
> > +
> > + ret = mutex_lock_interruptible(&dev->struct_mutex);
> > + if (ret)
> > + return ret;
> > +
> > + gtt_entries = (gen6_gtt_pte_t __iomem *)dev_priv->gtt.gsm;
> > + scratch_pte = dev_priv->gtt.base.pte_encode(dev_priv->gtt.base.scratch.addr, I915_CACHE_LLC);
> > + for (i = 0; i < gtt_total_entries(dev_priv->gtt); i += 8) {
> > + gen6_gtt_pte_t pte[8];
> > + int this_zero;
> > +
> > + for (j = 0; j < 8; j++) {
> > + pte[j] = ioread32(>t_entries[i+j]);
> > + if (pte[j] == scratch_pte)
> > + pte[j] = 0;
> > + }
> > +
> > + this_zero = memcmp(pte, zero, sizeof(pte)) == 0;
> > + if (last_zero && this_zero) {
> > + if (last_zero++ == 1)
> > + seq_puts(m, "...\n");
> > + continue;
> > + }
> > +
> > + seq_printf(m, "[%08x] %08x %08x %08x %08x %08x %08x %08x %08x\n",
> > + i, pte[0], pte[1], pte[2], pte[3], pte[4], pte[5], pte[6], pte[7]);
> > + last_zero = this_zero;
> > + }
> > +
> > + mutex_unlock(&dev->struct_mutex);
> > +
> > + return 0;
> > +}
> > +
> > static int i915_gem_gtt_info(struct seq_file *m, void *data)
> > {
> > struct drm_info_node *node = (struct drm_info_node *) m->private;
> > @@ -422,7 +467,7 @@ static int i915_gem_gtt_info(struct seq_file *m, void *data)
> > seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
> > count, total_obj_size, total_gtt_size);
> >
> > - return 0;
> > + return i915_gem_gtt_contents(m, dev);
> > }
> >
> > static int i915_gem_pageflip_info(struct seq_file *m, void *data)
> > --
> > 1.8.4.rc2
> >
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ben Widawsky, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list