Commit 373533f8 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/ttm: make ttm_mem_type_manager_func debug more useful

Provide the drm printer directly instead of just the callback.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent aca81718
...@@ -253,18 +253,17 @@ static void amdgpu_gtt_mgr_del(struct ttm_mem_type_manager *man, ...@@ -253,18 +253,17 @@ static void amdgpu_gtt_mgr_del(struct ttm_mem_type_manager *man,
* amdgpu_gtt_mgr_debug - dump VRAM table * amdgpu_gtt_mgr_debug - dump VRAM table
* *
* @man: TTM memory type manager * @man: TTM memory type manager
* @prefix: text prefix * @printer: DRM printer to use
* *
* Dump the table content using printk. * Dump the table content using printk.
*/ */
static void amdgpu_gtt_mgr_debug(struct ttm_mem_type_manager *man, static void amdgpu_gtt_mgr_debug(struct ttm_mem_type_manager *man,
const char *prefix) struct drm_printer *printer)
{ {
struct amdgpu_gtt_mgr *mgr = man->priv; struct amdgpu_gtt_mgr *mgr = man->priv;
struct drm_printer p = drm_debug_printer(prefix);
spin_lock(&mgr->lock); spin_lock(&mgr->lock);
drm_mm_print(&mgr->mm, &p); drm_mm_print(&mgr->mm, printer);
spin_unlock(&mgr->lock); spin_unlock(&mgr->lock);
} }
......
...@@ -204,18 +204,17 @@ static void amdgpu_vram_mgr_del(struct ttm_mem_type_manager *man, ...@@ -204,18 +204,17 @@ static void amdgpu_vram_mgr_del(struct ttm_mem_type_manager *man,
* amdgpu_vram_mgr_debug - dump VRAM table * amdgpu_vram_mgr_debug - dump VRAM table
* *
* @man: TTM memory type manager * @man: TTM memory type manager
* @prefix: text prefix * @printer: DRM printer to use
* *
* Dump the table content using printk. * Dump the table content using printk.
*/ */
static void amdgpu_vram_mgr_debug(struct ttm_mem_type_manager *man, static void amdgpu_vram_mgr_debug(struct ttm_mem_type_manager *man,
const char *prefix) struct drm_printer *printer)
{ {
struct amdgpu_vram_mgr *mgr = man->priv; struct amdgpu_vram_mgr *mgr = man->priv;
struct drm_printer p = drm_debug_printer(prefix);
spin_lock(&mgr->lock); spin_lock(&mgr->lock);
drm_mm_print(&mgr->mm, &p); drm_mm_print(&mgr->mm, printer);
spin_unlock(&mgr->lock); spin_unlock(&mgr->lock);
} }
......
...@@ -179,7 +179,8 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man, ...@@ -179,7 +179,8 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
} }
static void static void
nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) nouveau_gart_manager_debug(struct ttm_mem_type_manager *man,
struct drm_printer *printer)
{ {
} }
...@@ -252,7 +253,8 @@ nv04_gart_manager_new(struct ttm_mem_type_manager *man, ...@@ -252,7 +253,8 @@ nv04_gart_manager_new(struct ttm_mem_type_manager *man,
} }
static void static void
nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) nv04_gart_manager_debug(struct ttm_mem_type_manager *man,
struct drm_printer *printer)
{ {
} }
......
...@@ -70,6 +70,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place, ...@@ -70,6 +70,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type)
{ {
struct ttm_mem_type_manager *man = &bdev->man[mem_type]; struct ttm_mem_type_manager *man = &bdev->man[mem_type];
struct drm_printer p = drm_debug_printer(TTM_PFX);
pr_err(" has_type: %d\n", man->has_type); pr_err(" has_type: %d\n", man->has_type);
pr_err(" use_type: %d\n", man->use_type); pr_err(" use_type: %d\n", man->use_type);
...@@ -79,7 +80,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) ...@@ -79,7 +80,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type)
pr_err(" available_caching: 0x%08X\n", man->available_caching); pr_err(" available_caching: 0x%08X\n", man->available_caching);
pr_err(" default_caching: 0x%08X\n", man->default_caching); pr_err(" default_caching: 0x%08X\n", man->default_caching);
if (mem_type != TTM_PL_SYSTEM) if (mem_type != TTM_PL_SYSTEM)
(*man->func->debug)(man, TTM_PFX); (*man->func->debug)(man, &p);
} }
static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo,
......
...@@ -136,13 +136,12 @@ static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man) ...@@ -136,13 +136,12 @@ static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
} }
static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
const char *prefix) struct drm_printer *printer)
{ {
struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv; struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
struct drm_printer p = drm_debug_printer(prefix);
spin_lock(&rman->lock); spin_lock(&rman->lock);
drm_mm_print(&rman->mm, &p); drm_mm_print(&rman->mm, printer);
spin_unlock(&rman->lock); spin_unlock(&rman->lock);
} }
......
...@@ -192,7 +192,7 @@ static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man) ...@@ -192,7 +192,7 @@ static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
} }
static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
const char *prefix) struct drm_printer *printer)
{ {
} }
......
...@@ -157,9 +157,9 @@ static int vmw_gmrid_man_takedown(struct ttm_mem_type_manager *man) ...@@ -157,9 +157,9 @@ static int vmw_gmrid_man_takedown(struct ttm_mem_type_manager *man)
} }
static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man, static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man,
const char *prefix) struct drm_printer *printer)
{ {
pr_info("%s: No debug info available for the GMR id manager\n", prefix); drm_printf(printer, "No debug info available for the GMR id manager\n");
} }
const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = { const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = {
......
...@@ -229,13 +229,14 @@ struct ttm_mem_type_manager_func { ...@@ -229,13 +229,14 @@ struct ttm_mem_type_manager_func {
* struct ttm_mem_type_manager member debug * struct ttm_mem_type_manager member debug
* *
* @man: Pointer to a memory type manager. * @man: Pointer to a memory type manager.
* @prefix: Prefix to be used in printout to identify the caller. * @printer: Prefix to be used in printout to identify the caller.
* *
* This function is called to print out the state of the memory * This function is called to print out the state of the memory
* type manager to aid debugging of out-of-memory conditions. * type manager to aid debugging of out-of-memory conditions.
* It may not be called from within atomic context. * It may not be called from within atomic context.
*/ */
void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); void (*debug)(struct ttm_mem_type_manager *man,
struct drm_printer *printer);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment