diff options
author | Dave Airlie <airlied@linux.ie> | 2009-08-25 23:13:37 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2009-09-01 19:39:43 -0400 |
commit | fa8a123855e20068204982596b8fafceb1a67f0b (patch) | |
tree | efdfa7fb3cbff6f474cb89de289203f736aa0d81 /drivers/gpu/drm/radeon/radeon_ttm.c | |
parent | 3420e74262a7d6496d0ac433d6f61c9972f015f6 (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/radeon/radeon_ttm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 0a85e7b5d592..dc7a44274ea8 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -35,11 +35,14 @@ | |||
35 | #include <ttm/ttm_module.h> | 35 | #include <ttm/ttm_module.h> |
36 | #include <drm/drmP.h> | 36 | #include <drm/drmP.h> |
37 | #include <drm/radeon_drm.h> | 37 | #include <drm/radeon_drm.h> |
38 | #include <linux/seq_file.h> | ||
38 | #include "radeon_reg.h" | 39 | #include "radeon_reg.h" |
39 | #include "radeon.h" | 40 | #include "radeon.h" |
40 | 41 | ||
41 | #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) | 42 | #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) |
42 | 43 | ||
44 | static int radeon_ttm_debugfs_init(struct radeon_device *rdev); | ||
45 | |||
43 | static struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev) | 46 | static struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev) |
44 | { | 47 | { |
45 | struct radeon_mman *mman; | 48 | struct radeon_mman *mman; |
@@ -504,6 +507,12 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
504 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { | 507 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { |
505 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; | 508 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; |
506 | } | 509 | } |
510 | |||
511 | r = radeon_ttm_debugfs_init(rdev); | ||
512 | if (r) { | ||
513 | DRM_ERROR("Failed to init debugfs\n"); | ||
514 | return r; | ||
515 | } | ||
507 | return 0; | 516 | return 0; |
508 | } | 517 | } |
509 | 518 | ||
@@ -678,3 +687,50 @@ struct ttm_backend *radeon_ttm_backend_create(struct radeon_device *rdev) | |||
678 | gtt->bound = false; | 687 | gtt->bound = false; |
679 | return >t->backend; | 688 | return >t->backend; |
680 | } | 689 | } |
690 | |||
691 | #define RADEON_DEBUGFS_MEM_TYPES 2 | ||
692 | |||
693 | static struct drm_info_list radeon_mem_types_list[RADEON_DEBUGFS_MEM_TYPES]; | ||
694 | static char radeon_mem_types_names[RADEON_DEBUGFS_MEM_TYPES][32]; | ||
695 | |||
696 | #if defined(CONFIG_DEBUG_FS) | ||
697 | static int radeon_mm_dump_table(struct seq_file *m, void *data) | ||
698 | { | ||
699 | struct drm_info_node *node = (struct drm_info_node *)m->private; | ||
700 | struct drm_mm *mm = (struct drm_mm *)node->info_ent->data; | ||
701 | struct drm_device *dev = node->minor->dev; | ||
702 | struct radeon_device *rdev = dev->dev_private; | ||
703 | int ret; | ||
704 | struct ttm_bo_global *glob = rdev->mman.bdev.glob; | ||
705 | |||
706 | spin_lock(&glob->lru_lock); | ||
707 | ret = drm_mm_dump_table(m, mm); | ||
708 | spin_unlock(&glob->lru_lock); | ||
709 | return ret; | ||
710 | } | ||
711 | #endif | ||
712 | |||
713 | static int radeon_ttm_debugfs_init(struct radeon_device *rdev) | ||
714 | { | ||
715 | unsigned i; | ||
716 | |||
717 | #if defined(CONFIG_DEBUG_FS) | ||
718 | for (i = 0; i < RADEON_DEBUGFS_MEM_TYPES; i++) { | ||
719 | if (i == 0) | ||
720 | sprintf(radeon_mem_types_names[i], "radeon_vram_mm"); | ||
721 | else | ||
722 | sprintf(radeon_mem_types_names[i], "radeon_gtt_mm"); | ||
723 | radeon_mem_types_list[i].name = radeon_mem_types_names[i]; | ||
724 | radeon_mem_types_list[i].show = &radeon_mm_dump_table; | ||
725 | radeon_mem_types_list[i].driver_features = 0; | ||
726 | if (i == 0) | ||
727 | radeon_mem_types_list[i].data = &rdev->mman.bdev.man[TTM_PL_VRAM].manager; | ||
728 | else | ||
729 | radeon_mem_types_list[i].data = &rdev->mman.bdev.man[TTM_PL_TT].manager; | ||
730 | |||
731 | } | ||
732 | return radeon_debugfs_add_files(rdev, radeon_mem_types_list, RADEON_DEBUGFS_MEM_TYPES); | ||
733 | |||
734 | #endif | ||
735 | return 0; | ||
736 | } | ||