]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm: use drm_file client_name in fdinfo
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 3 Oct 2024 12:43:10 +0000 (14:43 +0200)
committerChristian König <christian.koenig@amd.com>
Tue, 8 Oct 2024 08:02:24 +0000 (10:02 +0200)
Add an optional drm-client-name field to drm fdinfo's output.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241003124506.470931-3-pierre-eric.pelloux-prayer@amd.com
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Documentation/gpu/drm-usage-stats.rst
drivers/gpu/drm/drm_file.c

index a80f95ca1b2f4951b5c0c3e836551283229bd10b..566e122e6e6052c8aeaec523c75916541870d68a 100644 (file)
@@ -73,6 +73,11 @@ scope of each device, in which case `drm-pdev` shall be present as well.
 Userspace should make sure to not double account any usage statistics by using
 the above described criteria in order to associate data to individual clients.
 
+- drm-client-name: <valstr>
+
+String optionally set by userspace using DRM_IOCTL_SET_CLIENT_NAME.
+
+
 Utilization
 ^^^^^^^^^^^
 
index 65c40ce3d61cdd31df9d18157fc182bcbd8705e1..2ee1c3233b0c67b2f7ab48af7fd985c86e8e13e2 100644 (file)
@@ -955,6 +955,11 @@ void drm_show_fdinfo(struct seq_file *m, struct file *f)
                           PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
        }
 
+       mutex_lock(&file->client_name_lock);
+       if (file->client_name)
+               drm_printf(&p, "drm-client-name:\t%s\n", file->client_name);
+       mutex_unlock(&file->client_name_lock);
+
        if (dev->driver->show_fdinfo)
                dev->driver->show_fdinfo(&p, file);
 }