aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_mm.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2009-08-25 23:13:37 -0400
committerDave Airlie <airlied@linux.ie>2009-09-01 19:39:43 -0400
commitfa8a123855e20068204982596b8fafceb1a67f0b (patch)
treeefdfa7fb3cbff6f474cb89de289203f736aa0d81 /drivers/gpu/drm/drm_mm.c
parent3420e74262a7d6496d0ac433d6f61c9972f015f6 (diff)
drm/mm: add ability to dump mm lists via debugfs
This adds code to the drm_mm to talk to debugfs, and adds support to radeon to add the VRAM and GTT mm lists to debugfs. I tested with spinlock debugging and it doesn't give out. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_mm.c')
-rw-r--r--drivers/gpu/drm/drm_mm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 3e47869d6dae..c861d80fd779 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -44,6 +44,7 @@
44#include "drmP.h" 44#include "drmP.h"
45#include "drm_mm.h" 45#include "drm_mm.h"
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/seq_file.h>
47 48
48#define MM_UNUSED_TARGET 4 49#define MM_UNUSED_TARGET 4
49 50
@@ -370,3 +371,23 @@ void drm_mm_takedown(struct drm_mm * mm)
370 BUG_ON(mm->num_unused != 0); 371 BUG_ON(mm->num_unused != 0);
371} 372}
372EXPORT_SYMBOL(drm_mm_takedown); 373EXPORT_SYMBOL(drm_mm_takedown);
374
375#if defined(CONFIG_DEBUG_FS)
376int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm)
377{
378 struct drm_mm_node *entry;
379 int total_used = 0, total_free = 0, total = 0;
380
381 list_for_each_entry(entry, &mm->ml_entry, ml_entry) {
382 seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: %s\n", entry->start, entry->start + entry->size, entry->size, entry->free ? "free" : "used");
383 total += entry->size;
384 if (entry->free)
385 total_free += entry->size;
386 else
387 total_used += entry->size;
388 }
389 seq_printf(m, "total: %d, used %d free %d\n", total, total_free, total_used);
390 return 0;
391}
392EXPORT_SYMBOL(drm_mm_dump_table);
393#endif