[PATCH 2/5] drm/vmwgfx: Add debugfs entries for various ttm resource managers

Zack Rusin zack at kde.org
Thu Apr 7 02:56:48 UTC 2022


From: Zack Rusin <zackr at vmware.com>

Use the newly added TTM's ability to automatically create debugfs entries
for specified placements. This creates entries in /sys/kernel/debug/ttm/
that can be read to get information about various TTM resource
managers which are used by vmwgfx.

Signed-off-by: Zack Rusin <zackr at vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index decd54b8333d..59d0d1cd564b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1630,6 +1630,13 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct vmw_private *vmw;
 	int ret;
+	const char * const ttm_placement_names[] = {
+		[TTM_PL_SYSTEM] = "system_ttm",
+		[TTM_PL_VRAM] = "vram_ttm",
+		[VMW_PL_GMR] = "gmr_ttm",
+		[VMW_PL_MOB] = "mob_ttm",
+		[VMW_PL_SYSTEM] = "system_mob_ttm"
+	};
 
 	ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &driver);
 	if (ret)
@@ -1657,6 +1664,9 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto out_unload;
 
 	vmw_debugfs_gem_init(vmw);
+	ttm_resource_manager_debugfs_init(&vmw->bdev,
+					  ttm_placement_names,
+					  ARRAY_SIZE(ttm_placement_names));
 
 	return 0;
 out_unload:
-- 
2.32.0



More information about the dri-devel mailing list