[RFC 4/5] drm/amdgpu: Show engine capacity in fdinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxx>

In cases where there is more than one user visible engine of the same type
DRM fdinfo spec allows the capacity tag to be emitted.

Start doing that so that gputop can adapt and show, for example, 50% if
only one of the two engine instances is fully loaded, while the other is
idle.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
index c7df7fa3459f..a09944104c41 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
@@ -57,6 +57,7 @@ static const char *amdgpu_ip_name[AMDGPU_HW_IP_NUM] = {
 void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
 {
 	struct amdgpu_fpriv *fpriv = file->driver_priv;
+	struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
 	struct amdgpu_vm *vm = &fpriv->vm;
 
 	struct amdgpu_mem_stats stats;
@@ -105,7 +106,12 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
 		if (!usage[hw_ip])
 			continue;
 
-		drm_printf(p, "drm-engine-%s:\t%lld ns\n", amdgpu_ip_name[hw_ip],
-			   ktime_to_ns(usage[hw_ip]));
+		drm_printf(p, "drm-engine-%s:\t%lld ns\n",
+			   amdgpu_ip_name[hw_ip], ktime_to_ns(usage[hw_ip]));
+
+		if (adev->num_ip_rings[hw_ip] > 1)
+			drm_printf(p, "drm-engine-capacity-%s:\t%u\n",
+				   amdgpu_ip_name[hw_ip],
+				   adev->num_ip_rings[hw_ip]);
 	}
 }
-- 
2.44.0




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux