svn commit: r249081 - stable/9/sys/dev/drm2
Konstantin Belousov
kib at FreeBSD.org
Thu Apr 4 05:39:38 UTC 2013
Author: kib
Date: Thu Apr 4 05:39:37 2013
New Revision: 249081
URL: http://svnweb.freebsd.org/changeset/base/249081
Log:
MFC r247833:
Import the drm_mm_debug_table() function.
Modified:
stable/9/sys/dev/drm2/drm_mm.c
stable/9/sys/dev/drm2/drm_mm.h
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/dev/ (props changed)
Modified: stable/9/sys/dev/drm2/drm_mm.c
==============================================================================
--- stable/9/sys/dev/drm2/drm_mm.c Thu Apr 4 05:36:11 2013 (r249080)
+++ stable/9/sys/dev/drm2/drm_mm.c Thu Apr 4 05:39:37 2013 (r249081)
@@ -561,3 +561,40 @@ void drm_mm_takedown(struct drm_mm * mm)
KASSERT(mm->num_unused == 0, ("num_unused != 0"));
}
+
+void drm_mm_debug_table(struct drm_mm *mm, const char *prefix)
+{
+ struct drm_mm_node *entry;
+ unsigned long total_used = 0, total_free = 0, total = 0;
+ unsigned long hole_start, hole_end, hole_size;
+
+ hole_start = drm_mm_hole_node_start(&mm->head_node);
+ hole_end = drm_mm_hole_node_end(&mm->head_node);
+ hole_size = hole_end - hole_start;
+ if (hole_size)
+ printf("%s 0x%08lx-0x%08lx: %8lu: free\n",
+ prefix, hole_start, hole_end,
+ hole_size);
+ total_free += hole_size;
+
+ drm_mm_for_each_node(entry, mm) {
+ printf("%s 0x%08lx-0x%08lx: %8lu: used\n",
+ prefix, entry->start, entry->start + entry->size,
+ entry->size);
+ total_used += entry->size;
+
+ if (entry->hole_follows) {
+ hole_start = drm_mm_hole_node_start(entry);
+ hole_end = drm_mm_hole_node_end(entry);
+ hole_size = hole_end - hole_start;
+ printf("%s 0x%08lx-0x%08lx: %8lu: free\n",
+ prefix, hole_start, hole_end,
+ hole_size);
+ total_free += hole_size;
+ }
+ }
+ total = total_free + total_used;
+
+ printf("%s total: %lu, used %lu free %lu\n", prefix, total,
+ total_used, total_free);
+}
Modified: stable/9/sys/dev/drm2/drm_mm.h
==============================================================================
--- stable/9/sys/dev/drm2/drm_mm.h Thu Apr 4 05:36:11 2013 (r249080)
+++ stable/9/sys/dev/drm2/drm_mm.h Thu Apr 4 05:39:37 2013 (r249081)
@@ -182,4 +182,6 @@ void drm_mm_init_scan_with_range(struct
int drm_mm_scan_add_block(struct drm_mm_node *node);
int drm_mm_scan_remove_block(struct drm_mm_node *node);
+void drm_mm_debug_table(struct drm_mm *mm, const char *prefix);
+
#endif
More information about the svn-src-stable-9
mailing list