Skip to content

Commit

Permalink
drm/radeon: Use TTM builtin resource manager debugfs code
Browse files Browse the repository at this point in the history
Switch to using the TTM resource manager debugfs helpers. The
functionality is largely the same.
The TTM resource managers need to stay valid for as long as the
drm debugfs_root is valid.

Signed-off-by: Zack Rusin <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: "Pan, Xinhui" <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: [email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Christian König <[email protected]>
  • Loading branch information
zackr committed Apr 21, 2022
1 parent d0719e0 commit 40d8d4b
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions drivers/gpu/drm/radeon/radeon_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,37 +781,13 @@ void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size)

#if defined(CONFIG_DEBUG_FS)

static int radeon_mm_vram_dump_table_show(struct seq_file *m, void *unused)
{
struct radeon_device *rdev = (struct radeon_device *)m->private;
struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev,
TTM_PL_VRAM);
struct drm_printer p = drm_seq_file_printer(m);

ttm_resource_manager_debug(man, &p);
return 0;
}

static int radeon_ttm_page_pool_show(struct seq_file *m, void *data)
{
struct radeon_device *rdev = (struct radeon_device *)m->private;

return ttm_pool_debugfs(&rdev->mman.bdev.pool, m);
}

static int radeon_mm_gtt_dump_table_show(struct seq_file *m, void *unused)
{
struct radeon_device *rdev = (struct radeon_device *)m->private;
struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev,
TTM_PL_TT);
struct drm_printer p = drm_seq_file_printer(m);

ttm_resource_manager_debug(man, &p);
return 0;
}

DEFINE_SHOW_ATTRIBUTE(radeon_mm_vram_dump_table);
DEFINE_SHOW_ATTRIBUTE(radeon_mm_gtt_dump_table);
DEFINE_SHOW_ATTRIBUTE(radeon_ttm_page_pool);

static int radeon_ttm_vram_open(struct inode *inode, struct file *filep)
Expand Down Expand Up @@ -930,15 +906,15 @@ static void radeon_ttm_debugfs_init(struct radeon_device *rdev)

debugfs_create_file("radeon_vram", 0444, root, rdev,
&radeon_ttm_vram_fops);

debugfs_create_file("radeon_gtt", 0444, root, rdev,
&radeon_ttm_gtt_fops);

debugfs_create_file("radeon_vram_mm", 0444, root, rdev,
&radeon_mm_vram_dump_table_fops);
debugfs_create_file("radeon_gtt_mm", 0444, root, rdev,
&radeon_mm_gtt_dump_table_fops);
debugfs_create_file("ttm_page_pool", 0444, root, rdev,
&radeon_ttm_page_pool_fops);
ttm_resource_manager_create_debugfs(ttm_manager_type(&rdev->mman.bdev,
TTM_PL_VRAM),
root, "radeon_vram_mm");
ttm_resource_manager_create_debugfs(ttm_manager_type(&rdev->mman.bdev,
TTM_PL_TT),
root, "radeon_gtt_mm");
#endif
}

0 comments on commit 40d8d4b

Please sign in to comment.