[Intel-gfx] [PATCH] drm/i915: PPGTT dump for debug

Ben Widawsky ben at bwidawsk.net
Mon Jun 24 19:01:33 CEST 2013


No users yet

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 893007a..005358f 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -99,6 +99,37 @@ static gen6_gtt_pte_t hsw_pte_encode(dma_addr_t addr,
 
 	return pte;
 }
+void gen6_dump_ppgtt(struct i915_hw_ppgtt *ppgtt)
+{
+	struct drm_i915_private *dev_priv = ppgtt->base.dev->dev_private;
+	gen6_gtt_pte_t __iomem *pd_addr;
+	uint32_t pd_entry;
+	int i, j;
+
+	pd_addr = (gen6_gtt_pte_t __iomem*)dev_priv->gtt.gsm +
+		ppgtt->pd_offset / sizeof(gen6_gtt_pte_t);
+
+	for (i = 0; i < ppgtt->num_pd_entries; i++) {
+		gen6_gtt_pte_t *pt_vaddr;
+		dma_addr_t pt_addr = ppgtt->pt_dma_addr[i];
+		pd_entry = readl(pd_addr + i);
+
+		if (pd_entry != (u32)(GEN6_PDE_ADDR_ENCODE(pt_addr) | GEN6_PDE_VALID))
+			DRM_ERROR("Actual PDE: %x Expected PDE: %x",
+				  pd_entry,
+				  (u32)(GEN6_PDE_ADDR_ENCODE(pt_addr) | GEN6_PDE_VALID));
+
+		pt_vaddr = kmap_atomic(ppgtt->pt_pages[i]);
+		for (j = 0; j < I915_PPGTT_PT_ENTRIES; j++) {
+			gen6_gtt_pte_t scratch_pte =
+				ppgtt->base.pte_encode(ppgtt->base.scratch.addr,
+						       I915_CACHE_LLC);
+			if (pt_vaddr[j] != scratch_pte)
+				DRM_ERROR("\tPTE = %x (%d %d)", pt_vaddr[j], i,j);
+		}
+		kunmap_atomic(pt_vaddr);
+	}
+}
 
 static void gen6_write_pdes(struct i915_hw_ppgtt *ppgtt)
 {
-- 
1.8.3.1




More information about the Intel-gfx mailing list