diff options
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 20 | ||||
-rw-r--r-- | include/drm/drm_mm.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index a5c2773ccf27..d7d7eac3ddd2 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -469,6 +469,26 @@ void drm_mm_takedown(struct drm_mm * mm) | |||
469 | } | 469 | } |
470 | EXPORT_SYMBOL(drm_mm_takedown); | 470 | EXPORT_SYMBOL(drm_mm_takedown); |
471 | 471 | ||
472 | void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) | ||
473 | { | ||
474 | struct drm_mm_node *entry; | ||
475 | int total_used = 0, total_free = 0, total = 0; | ||
476 | |||
477 | list_for_each_entry(entry, &mm->ml_entry, ml_entry) { | ||
478 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8ld: %s\n", | ||
479 | prefix, entry->start, entry->start + entry->size, | ||
480 | entry->size, entry->free ? "free" : "used"); | ||
481 | total += entry->size; | ||
482 | if (entry->free) | ||
483 | total_free += entry->size; | ||
484 | else | ||
485 | total_used += entry->size; | ||
486 | } | ||
487 | printk(KERN_DEBUG "%s total: %d, used %d free %d\n", prefix, total, | ||
488 | total_used, total_free); | ||
489 | } | ||
490 | EXPORT_SYMBOL(drm_mm_debug_table); | ||
491 | |||
472 | #if defined(CONFIG_DEBUG_FS) | 492 | #if defined(CONFIG_DEBUG_FS) |
473 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) | 493 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) |
474 | { | 494 | { |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index b40b2f062039..4c10be39a43b 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -133,6 +133,7 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) | |||
133 | return block->mm; | 133 | return block->mm; |
134 | } | 134 | } |
135 | 135 | ||
136 | extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); | ||
136 | #ifdef CONFIG_DEBUG_FS | 137 | #ifdef CONFIG_DEBUG_FS |
137 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); | 138 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); |
138 | #endif | 139 | #endif |