diff options
author | Christian König <christian.koenig@amd.com> | 2017-08-07 09:47:51 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-08-17 15:46:01 -0400 |
commit | 97cbb28451c21212cc20f2a5e6c074ba33150c3d (patch) | |
tree | 755660b357958975e12eae60658e8494899405db | |
parent | 12d4ac584465845af3c7fba090a82c8ee84180d1 (diff) |
drm/amdgpu: move debug print into the MM managers
Instead of the separate switch/case in the calling function.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 6 |
3 files changed, 11 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index 26818b0a0cc8..97c63ee1e20a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | |||
@@ -153,15 +153,6 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man, | |||
153 | return r; | 153 | return r; |
154 | } | 154 | } |
155 | 155 | ||
156 | void amdgpu_gtt_mgr_print(struct seq_file *m, struct ttm_mem_type_manager *man) | ||
157 | { | ||
158 | struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev); | ||
159 | struct amdgpu_gtt_mgr *mgr = man->priv; | ||
160 | |||
161 | seq_printf(m, "man size:%llu pages, gtt available:%llu pages, usage:%lluMB\n", | ||
162 | man->size, mgr->available, (u64)atomic64_read(&adev->gtt_usage) >> 20); | ||
163 | |||
164 | } | ||
165 | /** | 156 | /** |
166 | * amdgpu_gtt_mgr_new - allocate a new node | 157 | * amdgpu_gtt_mgr_new - allocate a new node |
167 | * | 158 | * |
@@ -260,11 +251,16 @@ static void amdgpu_gtt_mgr_del(struct ttm_mem_type_manager *man, | |||
260 | static void amdgpu_gtt_mgr_debug(struct ttm_mem_type_manager *man, | 251 | static void amdgpu_gtt_mgr_debug(struct ttm_mem_type_manager *man, |
261 | struct drm_printer *printer) | 252 | struct drm_printer *printer) |
262 | { | 253 | { |
254 | struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev); | ||
263 | struct amdgpu_gtt_mgr *mgr = man->priv; | 255 | struct amdgpu_gtt_mgr *mgr = man->priv; |
264 | 256 | ||
265 | spin_lock(&mgr->lock); | 257 | spin_lock(&mgr->lock); |
266 | drm_mm_print(&mgr->mm, printer); | 258 | drm_mm_print(&mgr->mm, printer); |
267 | spin_unlock(&mgr->lock); | 259 | spin_unlock(&mgr->lock); |
260 | |||
261 | drm_printf(printer, "man size:%llu pages, gtt available:%llu pages, usage:%lluMB\n", | ||
262 | man->size, mgr->available, | ||
263 | (u64)atomic64_read(&adev->gtt_usage) >> 20); | ||
268 | } | 264 | } |
269 | 265 | ||
270 | const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func = { | 266 | const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func = { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index e0520974e863..8b2c294f6f79 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -1641,8 +1641,6 @@ error_free: | |||
1641 | 1641 | ||
1642 | #if defined(CONFIG_DEBUG_FS) | 1642 | #if defined(CONFIG_DEBUG_FS) |
1643 | 1643 | ||
1644 | extern void amdgpu_gtt_mgr_print(struct seq_file *m, struct ttm_mem_type_manager | ||
1645 | *man); | ||
1646 | static int amdgpu_mm_dump_table(struct seq_file *m, void *data) | 1644 | static int amdgpu_mm_dump_table(struct seq_file *m, void *data) |
1647 | { | 1645 | { |
1648 | struct drm_info_node *node = (struct drm_info_node *)m->private; | 1646 | struct drm_info_node *node = (struct drm_info_node *)m->private; |
@@ -1653,17 +1651,6 @@ static int amdgpu_mm_dump_table(struct seq_file *m, void *data) | |||
1653 | struct drm_printer p = drm_seq_file_printer(m); | 1651 | struct drm_printer p = drm_seq_file_printer(m); |
1654 | 1652 | ||
1655 | man->func->debug(man, &p); | 1653 | man->func->debug(man, &p); |
1656 | switch (ttm_pl) { | ||
1657 | case TTM_PL_VRAM: | ||
1658 | seq_printf(m, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n", | ||
1659 | adev->mman.bdev.man[ttm_pl].size, | ||
1660 | (u64)atomic64_read(&adev->vram_usage) >> 20, | ||
1661 | (u64)atomic64_read(&adev->vram_vis_usage) >> 20); | ||
1662 | break; | ||
1663 | case TTM_PL_TT: | ||
1664 | amdgpu_gtt_mgr_print(m, &adev->mman.bdev.man[TTM_PL_TT]); | ||
1665 | break; | ||
1666 | } | ||
1667 | return 0; | 1654 | return 0; |
1668 | } | 1655 | } |
1669 | 1656 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c index 3f86b47984a0..1eb8d5d3acf2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | |||
@@ -211,11 +211,17 @@ static void amdgpu_vram_mgr_del(struct ttm_mem_type_manager *man, | |||
211 | static void amdgpu_vram_mgr_debug(struct ttm_mem_type_manager *man, | 211 | static void amdgpu_vram_mgr_debug(struct ttm_mem_type_manager *man, |
212 | struct drm_printer *printer) | 212 | struct drm_printer *printer) |
213 | { | 213 | { |
214 | struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev); | ||
214 | struct amdgpu_vram_mgr *mgr = man->priv; | 215 | struct amdgpu_vram_mgr *mgr = man->priv; |
215 | 216 | ||
216 | spin_lock(&mgr->lock); | 217 | spin_lock(&mgr->lock); |
217 | drm_mm_print(&mgr->mm, printer); | 218 | drm_mm_print(&mgr->mm, printer); |
218 | spin_unlock(&mgr->lock); | 219 | spin_unlock(&mgr->lock); |
220 | |||
221 | drm_printf(printer, "man size:%llu pages, ram usage:%lluMB, vis usage:%lluMB\n", | ||
222 | adev->mman.bdev.man[TTM_PL_VRAM].size, | ||
223 | (u64)atomic64_read(&adev->vram_usage) >> 20, | ||
224 | (u64)atomic64_read(&adev->vram_vis_usage) >> 20); | ||
219 | } | 225 | } |
220 | 226 | ||
221 | const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func = { | 227 | const struct ttm_mem_type_manager_func amdgpu_vram_mgr_func = { |