[Intel-gfx] [PATCH] drm/i915: Dump the contents of the GTT

Sedat Dilek sedat.dilek at gmail.com
Wed Aug 14 13:45:09 CEST 2013


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?
>

Compiling... next-20130814 with drm-intel-nightly (up to commit
d93f59e86ae93066969fa8ae2a6c9ccc7fc4728d) plus this patch.

How do you want your Doner-Kebap? (Going into the city...)

- Sedat -

> ---
>  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(&gtt_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
>



More information about the Intel-gfx mailing list