]> git.ipfire.org Git - thirdparty/linux.git/commit
drm: add DRM_SET_CLIENT_NAME ioctl
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 3 Oct 2024 12:43:09 +0000 (14:43 +0200)
committerChristian König <christian.koenig@amd.com>
Tue, 8 Oct 2024 08:00:30 +0000 (10:00 +0200)
commit56c594d8df64e726e803652ee9f4ab08659d4574
tree23a653bd9dbff74cb140c8977429dcb4c1cbee65
parent82fe69e63d2b5a5e86ea94c7361c833d3848ab69
drm: add DRM_SET_CLIENT_NAME ioctl

Giving the opportunity to userspace to associate a free-form
name with a drm_file struct is helpful for tracking and debugging.

This is similar to the existing DMA_BUF_SET_NAME ioctl.

Access to client_name is protected by a mutex, and the 'clients' debugfs
file has been updated to print it.

Userspace MR to use this ioctl:
   https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1428

If the string passed by userspace contains chars that would mess up output
when it's going to be printed (in dmesg, fdinfo, etc), -EINVAL is returned.

A 0-length string is a valid use, and clears the existing name.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241003124506.470931-2-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>
drivers/gpu/drm/drm_debugfs.c
drivers/gpu/drm/drm_file.c
drivers/gpu/drm/drm_ioctl.c
include/drm/drm_file.h
include/uapi/drm/drm.h