[RFC 5/5] drm/amdgpu: Only show VRAM in fdinfo if it exists

Tvrtko Ursulin tursulin at igalia.com
Tue Apr 30 17:27:48 UTC 2024


From: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>

Do not emit the key-value pairs if the VRAM does not exist ie. VRAM
placement is not valid and accessible.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 29 +++++++++++++---------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
index a09944104c41..603a5c010f5d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
@@ -83,25 +83,30 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
 	 */
 
 	drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
-	drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
 	drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
 	drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
-	drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
-		   stats.visible_vram/1024UL);
-	drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
-		   stats.evicted_vram/1024UL);
-	drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
-		   stats.evicted_visible_vram/1024UL);
-	drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
-		   stats.requested_vram/1024UL);
-	drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
-		   stats.requested_visible_vram/1024UL);
 	drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
 		   stats.requested_gtt/1024UL);
-	drm_printf(p, "drm-shared-vram:\t%llu KiB\n", stats.vram_shared/1024UL);
 	drm_printf(p, "drm-shared-gtt:\t%llu KiB\n", stats.gtt_shared/1024UL);
 	drm_printf(p, "drm-shared-cpu:\t%llu KiB\n", stats.cpu_shared/1024UL);
 
+	if (!adev->gmc.is_app_apu) {
+		drm_printf(p, "drm-memory-vram:\t%llu KiB\n",
+			   stats.vram/1024UL);
+		drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
+			   stats.visible_vram/1024UL);
+		drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
+			   stats.evicted_vram/1024UL);
+		drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
+			   stats.evicted_visible_vram/1024UL);
+		drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
+			   stats.requested_vram/1024UL);
+		drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
+			   stats.requested_visible_vram/1024UL);
+		drm_printf(p, "drm-shared-vram:\t%llu KiB\n",
+			   stats.vram_shared/1024UL);
+	}
+
 	for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) {
 		if (!usage[hw_ip])
 			continue;
-- 
2.44.0



More information about the amd-gfx mailing list